From 1a3c1a58cc7e97a846f612baf7f74a370980458f Mon Sep 17 00:00:00 2001
From: Heejin Ahn <aheejin@gmail.com>
Date: Tue, 21 May 2019 13:25:14 -0700
Subject: Reflect instruction renaming in code (#2128)

- Reflected new renamed instruction names in code and tests:
  - `get_local` -> `local.get`
  - `set_local` -> `local.set`
  - `tee_local` -> `local.tee`
  - `get_global` -> `global.get`
  - `set_global` -> `global.set`
  - `current_memory` -> `memory.size`
  - `grow_memory` -> `memory.grow`

- Removed APIs related to old instruction names in Binaryen.js and added
  APIs with new names if they are missing.

- Renamed `typedef SortedVector LocalSet` to `SetsOfLocals` to prevent
  name clashes.

- Resolved several TODO renaming items in wasm-binary.h:
  - `TableSwitch` -> `BrTable`
  - `I32ConvertI64` -> `I32WrapI64`
  - `I64STruncI32` -> `I64SExtendI32`
  - `I64UTruncI32` -> `I64UExtendI32`
  - `F32ConvertF64` -> `F32DemoteI64`
  - `F64ConvertF32` -> `F64PromoteF32`

- Renamed `BinaryenGetFeatures` and `BinaryenSetFeatures` to
  `BinaryenModuleGetFeatures` and `BinaryenModuleSetFeatures` for
  consistency.
---
 src/passes/LoopInvariantCodeMotion.cpp | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

(limited to 'src/passes/LoopInvariantCodeMotion.cpp')

diff --git a/src/passes/LoopInvariantCodeMotion.cpp b/src/passes/LoopInvariantCodeMotion.cpp
index b8e00ffce..c4880114d 100644
--- a/src/passes/LoopInvariantCodeMotion.cpp
+++ b/src/passes/LoopInvariantCodeMotion.cpp
@@ -39,7 +39,7 @@ struct LoopInvariantCodeMotion
 
   Pass* create() override { return new LoopInvariantCodeMotion; }
 
-  typedef std::unordered_set<SetLocal*> LoopSets;
+  typedef std::unordered_set<LocalSet*> LoopSets;
 
   // main entry point
 
@@ -78,7 +78,7 @@ struct LoopInvariantCodeMotion
     std::fill(numSetsForIndex.begin(), numSetsForIndex.end(), 0);
     LoopSets loopSets;
     {
-      FindAll<SetLocal> finder(loop);
+      FindAll<LocalSet> finder(loop);
       for (auto* set : finder.list) {
         numSetsForIndex[set->index]++;
         loopSets.insert(set);
@@ -135,7 +135,7 @@ struct LoopInvariantCodeMotion
             // and must also check if our sets interfere with them. To do so,
             // assume temporarily that we are moving curr out; see if any sets
             // remain for its indexes.
-            FindAll<SetLocal> currSets(curr);
+            FindAll<LocalSet> currSets(curr);
             for (auto* set : currSets.list) {
               assert(numSetsForIndex[set->index] > 0);
               numSetsForIndex[set->index]--;
@@ -205,15 +205,15 @@ struct LoopInvariantCodeMotion
     // it is beneficial to run this pass later on (but that has downsides
     // too, as with more nesting moving code is harder - so something
     // like -O --flatten --licm -O may be best).
-    if (auto* set = curr->dynCast<SetLocal>()) {
+    if (auto* set = curr->dynCast<LocalSet>()) {
       while (1) {
-        auto* next = set->value->dynCast<SetLocal>();
+        auto* next = set->value->dynCast<LocalSet>();
         if (!next) {
           break;
         }
         set = next;
       }
-      if (set->value->is<GetLocal>() || set->value->is<Const>()) {
+      if (set->value->is<LocalGet>() || set->value->is<Const>()) {
         return false;
       }
     }
@@ -221,7 +221,7 @@ struct LoopInvariantCodeMotion
   }
 
   bool hasGetDependingOnLoopSet(Expression* curr, LoopSets& loopSets) {
-    FindAll<GetLocal> gets(curr);
+    FindAll<LocalGet> gets(curr);
     for (auto* get : gets.list) {
       auto& sets = localGraph->getSetses[get];
       for (auto* set : sets) {
-- 
cgit v1.2.3