diff options
author | Heejin Ahn <aheejin@gmail.com> | 2019-05-21 13:25:14 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-21 13:25:14 -0700 |
commit | 1a3c1a58cc7e97a846f612baf7f74a370980458f (patch) | |
tree | cbe62ea58b2c0dd6d98225265419fea0b829aeab /src/passes/AlignmentLowering.cpp | |
parent | d78be9ac6c02910bbf8ac71118e68adff4fdc570 (diff) | |
download | binaryen-1a3c1a58cc7e97a846f612baf7f74a370980458f.tar.gz binaryen-1a3c1a58cc7e97a846f612baf7f74a370980458f.tar.bz2 binaryen-1a3c1a58cc7e97a846f612baf7f74a370980458f.zip |
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.
Diffstat (limited to 'src/passes/AlignmentLowering.cpp')
-rw-r--r-- | src/passes/AlignmentLowering.cpp | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/src/passes/AlignmentLowering.cpp b/src/passes/AlignmentLowering.cpp index fc03a8b74..05ec2892f 100644 --- a/src/passes/AlignmentLowering.cpp +++ b/src/passes/AlignmentLowering.cpp @@ -43,13 +43,13 @@ struct AlignmentLowering : public WalkerPass<PostWalker<AlignmentLowering>> { ret = builder.makeBinary( OrInt32, builder.makeLoad( - 1, false, curr->offset, 1, builder.makeGetLocal(temp, i32), i32), + 1, false, curr->offset, 1, builder.makeLocalGet(temp, i32), i32), builder.makeBinary(ShlInt32, builder.makeLoad(1, false, curr->offset + 1, 1, - builder.makeGetLocal(temp, i32), + builder.makeLocalGet(temp, i32), i32), builder.makeConst(Literal(int32_t(8))))); if (curr->signed_) { @@ -62,13 +62,13 @@ struct AlignmentLowering : public WalkerPass<PostWalker<AlignmentLowering>> { builder.makeBinary( OrInt32, builder.makeLoad( - 1, false, curr->offset, 1, builder.makeGetLocal(temp, i32), i32), + 1, false, curr->offset, 1, builder.makeLocalGet(temp, i32), i32), builder.makeBinary(ShlInt32, builder.makeLoad(1, false, curr->offset + 1, 1, - builder.makeGetLocal(temp, i32), + builder.makeLocalGet(temp, i32), i32), builder.makeConst(Literal(int32_t(8))))), builder.makeBinary( @@ -78,7 +78,7 @@ struct AlignmentLowering : public WalkerPass<PostWalker<AlignmentLowering>> { false, curr->offset + 2, 1, - builder.makeGetLocal(temp, i32), + builder.makeLocalGet(temp, i32), i32), builder.makeConst(Literal(int32_t(16)))), builder.makeBinary(ShlInt32, @@ -86,20 +86,20 @@ struct AlignmentLowering : public WalkerPass<PostWalker<AlignmentLowering>> { false, curr->offset + 3, 1, - builder.makeGetLocal(temp, i32), + builder.makeLocalGet(temp, i32), i32), builder.makeConst(Literal(int32_t(24)))))); } else if (curr->align == 2) { ret = builder.makeBinary( OrInt32, builder.makeLoad( - 2, false, curr->offset, 2, builder.makeGetLocal(temp, i32), i32), + 2, false, curr->offset, 2, builder.makeLocalGet(temp, i32), i32), builder.makeBinary(ShlInt32, builder.makeLoad(2, false, curr->offset + 2, 2, - builder.makeGetLocal(temp, i32), + builder.makeLocalGet(temp, i32), i32), builder.makeConst(Literal(int32_t(16))))); } else { @@ -109,7 +109,7 @@ struct AlignmentLowering : public WalkerPass<PostWalker<AlignmentLowering>> { WASM_UNREACHABLE(); } replaceCurrent( - builder.makeBlock({builder.makeSetLocal(temp, curr->ptr), ret})); + builder.makeBlock({builder.makeLocalSet(temp, curr->ptr), ret})); } void visitStore(Store* curr) { @@ -126,23 +126,23 @@ struct AlignmentLowering : public WalkerPass<PostWalker<AlignmentLowering>> { auto tempPtr = builder.addVar(getFunction(), i32); auto tempValue = builder.addVar(getFunction(), i32); auto* block = - builder.makeBlock({builder.makeSetLocal(tempPtr, curr->ptr), - builder.makeSetLocal(tempValue, curr->value)}); + builder.makeBlock({builder.makeLocalSet(tempPtr, curr->ptr), + builder.makeLocalSet(tempValue, curr->value)}); if (curr->bytes == 2) { block->list.push_back( builder.makeStore(1, curr->offset, 1, - builder.makeGetLocal(tempPtr, i32), - builder.makeGetLocal(tempValue, i32), + builder.makeLocalGet(tempPtr, i32), + builder.makeLocalGet(tempValue, i32), i32)); block->list.push_back(builder.makeStore( 1, curr->offset + 1, 1, - builder.makeGetLocal(tempPtr, i32), + builder.makeLocalGet(tempPtr, i32), builder.makeBinary(ShrUInt32, - builder.makeGetLocal(tempValue, i32), + builder.makeLocalGet(tempValue, i32), builder.makeConst(Literal(int32_t(8)))), i32)); } else if (curr->bytes == 4) { @@ -151,34 +151,34 @@ struct AlignmentLowering : public WalkerPass<PostWalker<AlignmentLowering>> { builder.makeStore(1, curr->offset, 1, - builder.makeGetLocal(tempPtr, i32), - builder.makeGetLocal(tempValue, i32), + builder.makeLocalGet(tempPtr, i32), + builder.makeLocalGet(tempValue, i32), i32)); block->list.push_back(builder.makeStore( 1, curr->offset + 1, 1, - builder.makeGetLocal(tempPtr, i32), + builder.makeLocalGet(tempPtr, i32), builder.makeBinary(ShrUInt32, - builder.makeGetLocal(tempValue, i32), + builder.makeLocalGet(tempValue, i32), builder.makeConst(Literal(int32_t(8)))), i32)); block->list.push_back(builder.makeStore( 1, curr->offset + 2, 1, - builder.makeGetLocal(tempPtr, i32), + builder.makeLocalGet(tempPtr, i32), builder.makeBinary(ShrUInt32, - builder.makeGetLocal(tempValue, i32), + builder.makeLocalGet(tempValue, i32), builder.makeConst(Literal(int32_t(16)))), i32)); block->list.push_back(builder.makeStore( 1, curr->offset + 3, 1, - builder.makeGetLocal(tempPtr, i32), + builder.makeLocalGet(tempPtr, i32), builder.makeBinary(ShrUInt32, - builder.makeGetLocal(tempValue, i32), + builder.makeLocalGet(tempValue, i32), builder.makeConst(Literal(int32_t(24)))), i32)); } else if (curr->align == 2) { @@ -186,16 +186,16 @@ struct AlignmentLowering : public WalkerPass<PostWalker<AlignmentLowering>> { builder.makeStore(2, curr->offset, 2, - builder.makeGetLocal(tempPtr, i32), - builder.makeGetLocal(tempValue, i32), + builder.makeLocalGet(tempPtr, i32), + builder.makeLocalGet(tempValue, i32), i32)); block->list.push_back(builder.makeStore( 2, curr->offset + 2, 2, - builder.makeGetLocal(tempPtr, i32), + builder.makeLocalGet(tempPtr, i32), builder.makeBinary(ShrUInt32, - builder.makeGetLocal(tempValue, i32), + builder.makeLocalGet(tempValue, i32), builder.makeConst(Literal(int32_t(16)))), i32)); } else { |