summaryrefslogtreecommitdiff
path: root/src/ir/module-utils.h
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2020-11-13 17:02:52 -0800
committerGitHub <noreply@github.com>2020-11-13 17:02:52 -0800
commitdd618f11660fc6f89211b864a3bd9dcbd14bb013 (patch)
tree914233a726cc77ca59c6147af89d5f21495477a6 /src/ir/module-utils.h
parent75e61204b67e921464af14fd13ff768d88755e8c (diff)
downloadbinaryen-dd618f11660fc6f89211b864a3bd9dcbd14bb013.tar.gz
binaryen-dd618f11660fc6f89211b864a3bd9dcbd14bb013.tar.bz2
binaryen-dd618f11660fc6f89211b864a3bd9dcbd14bb013.zip
Rename Indirect to NonDirect in CallGraphPropertyAnalysis in preparation for CallRef (#3355)
This is in preparation for CallRef, which takes a reference to a function and calls it. CallGraphPropertyAnalysis needs to be aware of anything that is not a direct call, and "NonDirect" is meant to cover both CallIndirect and CallRef.
Diffstat (limited to 'src/ir/module-utils.h')
-rw-r--r--src/ir/module-utils.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/ir/module-utils.h b/src/ir/module-utils.h
index 62a9dd921..a2d256073 100644
--- a/src/ir/module-utils.h
+++ b/src/ir/module-utils.h
@@ -308,7 +308,9 @@ template<typename T> struct CallGraphPropertyAnalysis {
struct FunctionInfo {
std::set<Function*> callsTo;
std::set<Function*> calledBy;
- bool hasIndirectCall = false;
+ // A non-direct call is any call that is not direct. That includes
+ // CallIndirect and CallRef.
+ bool hasNonDirectCall = false;
};
typedef std::map<Function*, T> Map;
@@ -331,7 +333,7 @@ template<typename T> struct CallGraphPropertyAnalysis {
}
void visitCallIndirect(CallIndirect* curr) {
- info.hasIndirectCall = true;
+ info.hasNonDirectCall = true;
}
private:
@@ -354,7 +356,7 @@ template<typename T> struct CallGraphPropertyAnalysis {
}
}
- enum IndirectCalls { IgnoreIndirectCalls, IndirectCallsHaveProperty };
+ enum NonDirectCalls { IgnoreNonDirectCalls, NonDirectCallsHaveProperty };
// Propagate a property from a function to those that call it.
//
@@ -365,13 +367,13 @@ template<typename T> struct CallGraphPropertyAnalysis {
void propagateBack(std::function<bool(const T&)> hasProperty,
std::function<bool(const T&)> canHaveProperty,
std::function<void(T&, Function*)> addProperty,
- IndirectCalls indirectCalls) {
+ NonDirectCalls nonDirectCalls) {
// The work queue contains items we just learned can change the state.
UniqueDeferredQueue<Function*> work;
for (auto& func : wasm.functions) {
if (hasProperty(map[func.get()]) ||
- (indirectCalls == IndirectCallsHaveProperty &&
- map[func.get()].hasIndirectCall)) {
+ (nonDirectCalls == NonDirectCallsHaveProperty &&
+ map[func.get()].hasNonDirectCall)) {
addProperty(map[func.get()], func.get());
work.push(func.get());
}