diff options
Diffstat (limited to 'src/ir')
-rw-r--r-- | src/ir/bits.h | 2 | ||||
-rw-r--r-- | src/ir/block-utils.h | 4 | ||||
-rw-r--r-- | src/ir/branch-utils.h | 2 | ||||
-rw-r--r-- | src/ir/literal-utils.h | 8 | ||||
-rw-r--r-- | src/ir/load-utils.h | 2 | ||||
-rw-r--r-- | src/ir/type-updating.h | 10 | ||||
-rw-r--r-- | src/ir/utils.h | 16 |
7 files changed, 22 insertions, 22 deletions
diff --git a/src/ir/bits.h b/src/ir/bits.h index 4196b74c1..ec33c4b11 100644 --- a/src/ir/bits.h +++ b/src/ir/bits.h @@ -44,7 +44,7 @@ struct Bits { // gets the number of effective shifts a shift operation does. In // wasm, only 5 bits matter for 32-bit shifts, and 6 for 64. - static Index getEffectiveShifts(Index amount, WasmType type) { + static Index getEffectiveShifts(Index amount, Type type) { if (type == i32) { return amount & 31; } else if (type == i64) { diff --git a/src/ir/block-utils.h b/src/ir/block-utils.h index f7c68aa39..e3ad370db 100644 --- a/src/ir/block-utils.h +++ b/src/ir/block-utils.h @@ -34,7 +34,7 @@ namespace BlockUtils { // just one element. try to replace the block auto* singleton = list[0]; auto sideEffects = EffectAnalyzer(parent->getPassOptions(), singleton).hasSideEffects(); - if (!sideEffects && !isConcreteWasmType(singleton->type)) { + if (!sideEffects && !isConcreteType(singleton->type)) { // no side effects, and singleton is not returning a value, so we can throw away // the block and its contents, basically return Builder(*parent->getModule()).replaceWithIdenticalType(block); @@ -44,7 +44,7 @@ namespace BlockUtils { // (side effects +) type change, must be block with declared value but inside is unreachable // (if both concrete, must match, and since no name on block, we can't be // branched to, so if singleton is unreachable, so is the block) - assert(isConcreteWasmType(block->type) && singleton->type == unreachable); + assert(isConcreteType(block->type) && singleton->type == unreachable); // we could replace with unreachable, but would need to update all // the parent's types } diff --git a/src/ir/branch-utils.h b/src/ir/branch-utils.h index 26e8e7c87..84be9f897 100644 --- a/src/ir/branch-utils.h +++ b/src/ir/branch-utils.h @@ -110,7 +110,7 @@ struct BranchSeeker : public PostWalker<BranchSeeker> { bool named = true; Index found; - WasmType valueType; + Type valueType; BranchSeeker(Name target) : target(target), found(0) {} diff --git a/src/ir/literal-utils.h b/src/ir/literal-utils.h index a702c52eb..166897739 100644 --- a/src/ir/literal-utils.h +++ b/src/ir/literal-utils.h @@ -23,7 +23,7 @@ namespace wasm { namespace LiteralUtils { -inline Literal makeLiteralFromInt32(int32_t x, WasmType type) { +inline Literal makeLiteralFromInt32(int32_t x, Type type) { switch (type) { case i32: return Literal(int32_t(x)); break; case i64: return Literal(int64_t(x)); break; @@ -33,18 +33,18 @@ inline Literal makeLiteralFromInt32(int32_t x, WasmType type) { } } -inline Literal makeLiteralZero(WasmType type) { +inline Literal makeLiteralZero(Type type) { return makeLiteralFromInt32(0, type); } -inline Expression* makeFromInt32(int32_t x, WasmType type, Module& wasm) { +inline Expression* makeFromInt32(int32_t x, Type type, Module& wasm) { auto* ret = wasm.allocator.alloc<Const>(); ret->value = makeLiteralFromInt32(x, type); ret->type = type; return ret; } -inline Expression* makeZero(WasmType type, Module& wasm) { +inline Expression* makeZero(Type type, Module& wasm) { return makeFromInt32(0, type, wasm); } diff --git a/src/ir/load-utils.h b/src/ir/load-utils.h index 45882dc6c..41b3c69ef 100644 --- a/src/ir/load-utils.h +++ b/src/ir/load-utils.h @@ -29,7 +29,7 @@ namespace LoadUtils { inline bool isSignRelevant(Load* load) { auto type = load->type; if (load->type == unreachable) return false; - return !isWasmTypeFloat(type) && load->bytes < getWasmTypeSize(type); + return !isTypeFloat(type) && load->bytes < getTypeSize(type); } // check if a load can be signed (which some opts want to do) diff --git a/src/ir/type-updating.h b/src/ir/type-updating.h index 79b26aa43..ba06bccf9 100644 --- a/src/ir/type-updating.h +++ b/src/ir/type-updating.h @@ -187,7 +187,7 @@ struct TypeUpdater : public ExpressionStackWalker<TypeUpdater, UnifiedExpression // alters the type of a node to a new type. // this propagates the type change through all the parents. - void changeTypeTo(Expression* curr, WasmType newType) { + void changeTypeTo(Expression* curr, Type newType) { if (curr->type == newType) return; // nothing to do curr->type = newType; propagateTypesUp(curr); @@ -214,7 +214,7 @@ struct TypeUpdater : public ExpressionStackWalker<TypeUpdater, UnifiedExpression // but exceptions exist if (auto* block = curr->dynCast<Block>()) { // if the block has a fallthrough, it can keep its type - if (isConcreteWasmType(block->list.back()->type)) { + if (isConcreteType(block->list.back()->type)) { return; // did not turn } // if the block has breaks, it can keep its type @@ -240,7 +240,7 @@ struct TypeUpdater : public ExpressionStackWalker<TypeUpdater, UnifiedExpression // unreachable, and it does this efficiently, without scanning the full // contents void maybeUpdateTypeToUnreachable(Block* curr) { - if (!isConcreteWasmType(curr->type)) { + if (!isConcreteType(curr->type)) { return; // nothing concrete to change to unreachable } if (curr->name.is() && blockInfos[curr->name].numBreaks > 0) { @@ -255,7 +255,7 @@ struct TypeUpdater : public ExpressionStackWalker<TypeUpdater, UnifiedExpression return; // no change possible } if (!curr->list.empty() && - isConcreteWasmType(curr->list.back()->type)) { + isConcreteType(curr->list.back()->type)) { return; // should keep type due to fallthrough, even if has an unreachable child } for (auto* child : curr->list) { @@ -271,7 +271,7 @@ struct TypeUpdater : public ExpressionStackWalker<TypeUpdater, UnifiedExpression // can remove a concrete type and turn the if unreachable when it is // unreachable void maybeUpdateTypeToUnreachable(If* curr) { - if (!isConcreteWasmType(curr->type)) { + if (!isConcreteType(curr->type)) { return; // nothing concrete to change to unreachable } curr->finalize(); diff --git a/src/ir/utils.h b/src/ir/utils.h index 786e04e45..fa08122b5 100644 --- a/src/ir/utils.h +++ b/src/ir/utils.h @@ -86,7 +86,7 @@ struct ReFinalize : public WalkerPass<PostWalker<ReFinalize, OverriddenVisitor<R // block finalization is O(bad) if we do each block by itself, so do it in bulk, // tracking break value types so we just do a linear pass - std::map<Name, WasmType> breakValues; + std::map<Name, Type> breakValues; void visitBlock(Block *curr) { if (curr->list.size() == 0) { @@ -99,7 +99,7 @@ struct ReFinalize : public WalkerPass<PostWalker<ReFinalize, OverriddenVisitor<R curr->type = curr->list.back()->type; // if concrete, it doesn't matter if we have an unreachable child, and we // don't need to look at breaks - if (isConcreteWasmType(curr->type)) return; + if (isConcreteType(curr->type)) return; // otherwise, we have no final fallthrough element to determine the type, // could be determined by breaks if (curr->name.is()) { @@ -111,7 +111,7 @@ struct ReFinalize : public WalkerPass<PostWalker<ReFinalize, OverriddenVisitor<R // all we have are breaks with values of type unreachable, and no // concrete fallthrough either. we must have had an existing type, then curr->type = old; - assert(isConcreteWasmType(curr->type)); + assert(isConcreteType(curr->type)); } else { curr->type = type; } @@ -183,11 +183,11 @@ struct ReFinalize : public WalkerPass<PostWalker<ReFinalize, OverriddenVisitor<R void visitMemory(Memory* curr) { WASM_UNREACHABLE(); } void visitModule(Module* curr) { WASM_UNREACHABLE(); } - WasmType getValueType(Expression* value) { + Type getValueType(Expression* value) { return value ? value->type : none; } - void updateBreakValueType(Name name, WasmType type) { + void updateBreakValueType(Name name, Type type) { if (type != unreachable || breakValues.count(name) == 0) { breakValues[name] = type; } @@ -256,7 +256,7 @@ struct AutoDrop : public WalkerPass<ExpressionStackWalker<AutoDrop>> { bool maybeDrop(Expression*& child) { bool acted = false; - if (isConcreteWasmType(child->type)) { + if (isConcreteType(child->type)) { expressionStack.push_back(child); if (!ExpressionAnalyzer::isResultUsed(expressionStack, getFunction()) && !ExpressionAnalyzer::isResultDropped(expressionStack)) { child = Builder(*getModule()).makeDrop(child); @@ -275,7 +275,7 @@ struct AutoDrop : public WalkerPass<ExpressionStackWalker<AutoDrop>> { if (curr->list.size() == 0) return; for (Index i = 0; i < curr->list.size() - 1; i++) { auto* child = curr->list[i]; - if (isConcreteWasmType(child->type)) { + if (isConcreteType(child->type)) { curr->list[i] = Builder(*getModule()).makeDrop(child); } } @@ -300,7 +300,7 @@ struct AutoDrop : public WalkerPass<ExpressionStackWalker<AutoDrop>> { void doWalkFunction(Function* curr) { ReFinalize().walkFunctionInModule(curr, getModule()); walk(curr->body); - if (curr->result == none && isConcreteWasmType(curr->body->type)) { + if (curr->result == none && isConcreteType(curr->body->type)) { curr->body = Builder(*getModule()).makeDrop(curr->body); } ReFinalize().walkFunctionInModule(curr, getModule()); |