diff options
Diffstat (limited to 'src/ir/module-utils.h')
-rw-r--r-- | src/ir/module-utils.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/ir/module-utils.h b/src/ir/module-utils.h index ab23649f7..8f89c780f 100644 --- a/src/ir/module-utils.h +++ b/src/ir/module-utils.h @@ -349,9 +349,14 @@ template<typename T> struct CallGraphPropertyAnalysis { enum IndirectCalls { IgnoreIndirectCalls, IndirectCallsHaveProperty }; // Propagate a property from a function to those that call it. + // + // hasProperty() - Check if the property is present. + // canHaveProperty() - Check if the property could be present. + // addProperty() - Adds the property. This receives a second parameter which + // is the function due to which we are adding the property. void propagateBack(std::function<bool(const T&)> hasProperty, std::function<bool(const T&)> canHaveProperty, - std::function<void(T&)> addProperty, + std::function<void(T&, Function*)> addProperty, IndirectCalls indirectCalls) { // The work queue contains items we just learned can change the state. UniqueDeferredQueue<Function*> work; @@ -359,7 +364,7 @@ template<typename T> struct CallGraphPropertyAnalysis { if (hasProperty(map[func.get()]) || (indirectCalls == IndirectCallsHaveProperty && map[func.get()].hasIndirectCall)) { - addProperty(map[func.get()]); + addProperty(map[func.get()], func.get()); work.push(func.get()); } } @@ -369,7 +374,7 @@ template<typename T> struct CallGraphPropertyAnalysis { // If we don't already have the property, and we are not forbidden // from getting it, then it propagates back to us now. if (!hasProperty(map[caller]) && canHaveProperty(map[caller])) { - addProperty(map[caller]); + addProperty(map[caller], func); work.push(caller); } } |