summaryrefslogtreecommitdiff
path: root/src/ir
diff options
context:
space:
mode:
Diffstat (limited to 'src/ir')
-rw-r--r--src/ir/ReFinalize.cpp6
-rw-r--r--src/ir/block-utils.h4
-rw-r--r--src/ir/flat.h6
-rw-r--r--src/ir/load-utils.h2
-rw-r--r--src/ir/type-updating.h10
-rw-r--r--src/ir/utils.h6
6 files changed, 17 insertions, 17 deletions
diff --git a/src/ir/ReFinalize.cpp b/src/ir/ReFinalize.cpp
index b27b49bd4..9ee109f5e 100644
--- a/src/ir/ReFinalize.cpp
+++ b/src/ir/ReFinalize.cpp
@@ -50,12 +50,12 @@ void ReFinalize::visitBlock(Block* curr) {
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 (isConcreteType(curr->type)) {
+ if (curr->type.isConcrete()) {
// make sure our branches make sense for us - we may have just made
// ourselves concrete for a value flowing out, while branches did not send a
// value. such branches could not have been actually taken before, that is,
// there were in unreachable code, but we do still need to fix them up here.
- if (!isConcreteType(old)) {
+ if (!old.isConcrete()) {
auto iter = breakValues.find(curr->name);
if (iter != breakValues.end()) {
// there is a break to here
@@ -210,7 +210,7 @@ void ReFinalize::replaceUntaken(Expression* value, Expression* condition) {
// the value is unreachable, and necessary since the type of
// the condition did not have an impact before (the break/switch
// type was unreachable), and might not fit in.
- if (isConcreteType(condition->type)) {
+ if (condition->type.isConcrete()) {
condition = builder.makeDrop(condition);
}
replacement = builder.makeSequence(value, condition);
diff --git a/src/ir/block-utils.h b/src/ir/block-utils.h
index 120178a47..1ed9ee413 100644
--- a/src/ir/block-utils.h
+++ b/src/ir/block-utils.h
@@ -39,7 +39,7 @@ simplifyToContents(Block* block, T* parent, bool allowTypeChange = false) {
auto* singleton = list[0];
auto sideEffects =
EffectAnalyzer(parent->getPassOptions(), singleton).hasSideEffects();
- if (!sideEffects && !isConcreteType(singleton->type)) {
+ if (!sideEffects && !singleton->type.isConcrete()) {
// 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);
@@ -50,7 +50,7 @@ simplifyToContents(Block* block, T* parent, bool allowTypeChange = false) {
// 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(isConcreteType(block->type) && singleton->type == unreachable);
+ assert(block->type.isConcrete() && singleton->type == unreachable);
// we could replace with unreachable, but would need to update all
// the parent's types
}
diff --git a/src/ir/flat.h b/src/ir/flat.h
index 749d4532d..dd72e339d 100644
--- a/src/ir/flat.h
+++ b/src/ir/flat.h
@@ -73,10 +73,10 @@ inline void verifyFlatness(Function* func) {
UnifiedExpressionVisitor<VerifyFlatness>> {
void visitExpression(Expression* curr) {
if (isControlFlowStructure(curr)) {
- verify(!isConcreteType(curr->type),
+ verify(!curr->type.isConcrete(),
"control flow structures must not flow values");
} else if (curr->is<LocalSet>()) {
- verify(!isConcreteType(curr->type), "tees are not allowed, only sets");
+ verify(!curr->type.isConcrete(), "tees are not allowed, only sets");
} else {
for (auto* child : ChildIterator(curr)) {
verify(child->is<Const>() || child->is<LocalGet>() ||
@@ -98,7 +98,7 @@ inline void verifyFlatness(Function* func) {
VerifyFlatness verifier;
verifier.walkFunction(func);
verifier.setFunction(func);
- verifier.verify(!isConcreteType(func->body->type),
+ verifier.verify(!func->body->type.isConcrete(),
"function bodies must not flow values");
}
diff --git a/src/ir/load-utils.h b/src/ir/load-utils.h
index c7e9bad99..037f5297b 100644
--- a/src/ir/load-utils.h
+++ b/src/ir/load-utils.h
@@ -31,7 +31,7 @@ inline bool isSignRelevant(Load* load) {
if (load->type == unreachable) {
return false;
}
- return !isFloatType(type) && load->bytes < getTypeSize(type);
+ return !type.isFloat() && 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 40c17427c..1fa891ec1 100644
--- a/src/ir/type-updating.h
+++ b/src/ir/type-updating.h
@@ -234,7 +234,7 @@ struct TypeUpdater
// but exceptions exist
if (auto* block = curr->dynCast<Block>()) {
// if the block has a fallthrough, it can keep its type
- if (isConcreteType(block->list.back()->type)) {
+ if (block->list.back()->type.isConcrete()) {
return; // did not turn
}
// if the block has breaks, it can keep its type
@@ -265,7 +265,7 @@ struct TypeUpdater
// unreachable, and it does this efficiently, without scanning the full
// contents
void maybeUpdateTypeToUnreachable(Block* curr) {
- if (!isConcreteType(curr->type)) {
+ if (!curr->type.isConcrete()) {
return; // nothing concrete to change to unreachable
}
if (curr->name.is() && blockInfos[curr->name].numBreaks > 0) {
@@ -279,7 +279,7 @@ struct TypeUpdater
if (curr->type == unreachable) {
return; // no change possible
}
- if (!curr->list.empty() && isConcreteType(curr->list.back()->type)) {
+ if (!curr->list.empty() && curr->list.back()->type.isConcrete()) {
// should keep type due to fallthrough, even if has an unreachable child
return;
}
@@ -296,7 +296,7 @@ struct TypeUpdater
// can remove a concrete type and turn the if unreachable when it is
// unreachable
void maybeUpdateTypeToUnreachable(If* curr) {
- if (!isConcreteType(curr->type)) {
+ if (!curr->type.isConcrete()) {
return; // nothing concrete to change to unreachable
}
curr->finalize();
@@ -306,7 +306,7 @@ struct TypeUpdater
}
void maybeUpdateTypeToUnreachable(Try* curr) {
- if (!isConcreteType(curr->type)) {
+ if (!curr->type.isConcrete()) {
return; // nothing concrete to change to unreachable
}
curr->finalize();
diff --git a/src/ir/utils.h b/src/ir/utils.h
index ca8803741..e8c5b78b3 100644
--- a/src/ir/utils.h
+++ b/src/ir/utils.h
@@ -251,7 +251,7 @@ struct AutoDrop : public WalkerPass<ExpressionStackWalker<AutoDrop>> {
bool maybeDrop(Expression*& child) {
bool acted = false;
- if (isConcreteType(child->type)) {
+ if (child->type.isConcrete()) {
expressionStack.push_back(child);
if (!ExpressionAnalyzer::isResultUsed(expressionStack, getFunction()) &&
!ExpressionAnalyzer::isResultDropped(expressionStack)) {
@@ -271,7 +271,7 @@ struct AutoDrop : public WalkerPass<ExpressionStackWalker<AutoDrop>> {
}
for (Index i = 0; i < curr->list.size() - 1; i++) {
auto* child = curr->list[i];
- if (isConcreteType(child->type)) {
+ if (child->type.isConcrete()) {
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 && isConcreteType(curr->body->type)) {
+ if (curr->result == none && curr->body->type.isConcrete()) {
curr->body = Builder(*getModule()).makeDrop(curr->body);
}
ReFinalize().walkFunctionInModule(curr, getModule());