summaryrefslogtreecommitdiff
path: root/src/ir/local-graph.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/ir/local-graph.h')
-rw-r--r--src/ir/local-graph.h31
1 files changed, 18 insertions, 13 deletions
diff --git a/src/ir/local-graph.h b/src/ir/local-graph.h
index fd6a496c0..ae389c899 100644
--- a/src/ir/local-graph.h
+++ b/src/ir/local-graph.h
@@ -17,6 +17,8 @@
#ifndef wasm_ir_local_graph_h
#define wasm_ir_local_graph_h
+#include "wasm.h"
+
namespace wasm {
//
@@ -41,8 +43,9 @@ struct LocalGraph {
typedef std::map<Expression*, Expression**> Locations;
// externally useful information
- GetSetses getSetses; // the sets affecting each get. a nullptr set means the initial
- // value (0 for a var, the received value for a param)
+ GetSetses getSetses; // the sets affecting each get. a nullptr set means the
+ // initial value (0 for a var, the received value for a
+ // param)
Locations locations; // where each get and set is (for easy replacing)
// Optional: compute the influence graphs between sets and gets
@@ -50,15 +53,18 @@ struct LocalGraph {
void computeInfluences();
- std::unordered_map<GetLocal*, std::unordered_set<SetLocal*>> getInfluences; // for each get, the sets whose values are influenced by that get
- std::unordered_map<SetLocal*, std::unordered_set<GetLocal*>> setInfluences; // for each set, the gets whose values are influenced by that set
+ // for each get, the sets whose values are influenced by that get
+ std::unordered_map<GetLocal*, std::unordered_set<SetLocal*>> getInfluences;
+ // for each set, the gets whose values are influenced by that set
+ std::unordered_map<SetLocal*, std::unordered_set<GetLocal*>> setInfluences;
// Optional: Compute the local indexes that are SSA, in the sense of
// * a single set for all the gets for that local index
- // * the set dominates all the gets (logically implied by the former property)
+ // * the set dominates all the gets (logically implied by the former
+ // property)
// * no other set (aside from the zero-init)
- // The third property is not exactly standard SSA, but is useful since we are not in
- // SSA form in our IR. To see why it matters, consider these:
+ // The third property is not exactly standard SSA, but is useful since we are
+ // not in SSA form in our IR. To see why it matters, consider these:
//
// x = 0 // zero init
// [..]
@@ -67,11 +73,11 @@ struct LocalGraph {
// x = 30 // !!!
// f(y)
//
- // The !!! line violates that property - it is another set for x, and it may interfere
- // say with replacing f(y) with f(x + 20). Instead, if we know the only other possible set for x
- // is the zero init, then things like the !!! line cannot exist, and it is valid to replace
- // f(y) with f(x + 20).
- // (This could be simpler, but in wasm the zero init always exists.)
+ // The !!! line violates that property - it is another set for x, and it may
+ // interfere say with replacing f(y) with f(x + 20). Instead, if we know the
+ // only other possible set for x is the zero init, then things like the !!!
+ // line cannot exist, and it is valid to replace f(y) with f(x + 20). (This
+ // could be simpler, but in wasm the zero init always exists.)
void computeSSAIndexes();
@@ -84,4 +90,3 @@ private:
} // namespace wasm
#endif // wasm_ir_local_graph_h
-