summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-ir-constexpr.cpp
diff options
context:
space:
mode:
authorTim Foley <tfoleyNV@users.noreply.github.com>2021-02-16 11:48:21 -0800
committerGitHub <noreply@github.com>2021-02-16 11:48:21 -0800
commite474c4e3aadc22a1b9f9b006104409f10936244f (patch)
treeb5f9567d3795fd2ea77d6c0478a58a569ea8eda9 /source/slang/slang-ir-constexpr.cpp
parent5777545ab7f82b91fde8779e7375628551add955 (diff)
Add an accessor for IRInst opcode (#1707)
* Add an accessor for IRInst opcode This main changing is renaming `IRInst::op` over to `IRInst::m_op` and then adds an accessor `IRInst::getOp()` to read it. The rest of the changes are just changing use sites to `getOp` (or to `m_op` in the limited cases where we write to it). This work is in anticipation of a future change that might need to store an extra bit in the same field as the opcode. It seemed better to do this massive refactoring as a separate PR. * fixup
Diffstat (limited to 'source/slang/slang-ir-constexpr.cpp')
-rw-r--r--source/slang/slang-ir-constexpr.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/source/slang/slang-ir-constexpr.cpp b/source/slang/slang-ir-constexpr.cpp
index 041258153..98af664d7 100644
--- a/source/slang/slang-ir-constexpr.cpp
+++ b/source/slang/slang-ir-constexpr.cpp
@@ -44,7 +44,7 @@ bool isConstExpr(IRInst* value)
//
// TODO: should we just go ahead and make that explicit
// in the type system?
- switch(value->op)
+ switch(value->getOp())
{
case kIROp_IntLit:
case kIROp_FloatLit:
@@ -95,7 +95,7 @@ bool opCanBeConstExpr(IRInst* value)
// callee function is fixed/known, and if it is
// whether it has been decoared as constant-foldable
- return opCanBeConstExpr(value->op);
+ return opCanBeConstExpr(value->getOp());
}
void markConstExpr(
@@ -186,7 +186,7 @@ bool maybeMarkConstExpr(
// (Or eventually we'd have a rule that only non-`public` symbols
// can have this kind of propagation applied).
- if(value->op == kIROp_Param)
+ if(value->getOp() == kIROp_Param)
{
auto param = (IRParam*) value;
auto block = (IRBlock*) param->parent;
@@ -203,7 +203,7 @@ bool maybeMarkConstExpr(
{
auto user = u->getUser();
- switch( user->op )
+ switch( user->getOp() )
{
case kIROp_Call:
{
@@ -272,7 +272,7 @@ bool propagateConstExprBackward(
}
}
}
- else if( ii->op == kIROp_Call )
+ else if( ii->getOp() == kIROp_Call )
{
// A non-constexpr call might be calling a function with one or
// more constexpr parameters. We should check if we can resolve
@@ -391,7 +391,7 @@ bool propagateConstExprBackward(
for(auto pred : bb->getPredecessors())
{
auto terminator = pred->getLastInst();
- if(terminator->op != kIROp_unconditionalBranch)
+ if(terminator->getOp() != kIROp_unconditionalBranch)
continue;
UInt operandIndex = paramIndex + 1;
@@ -496,7 +496,7 @@ void propagateConstExpr(
context.workList.fastRemoveAt(0);
context.onWorkList.Remove(gv);
- switch( gv->op )
+ switch( gv->getOp() )
{
default:
break;
@@ -532,7 +532,7 @@ void propagateConstExpr(
for(auto ii : module->getGlobalInsts())
{
- switch( ii->op )
+ switch( ii->getOp() )
{
default:
break;