diff options
Diffstat (limited to 'source/slang/ir.cpp')
| -rw-r--r-- | source/slang/ir.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/source/slang/ir.cpp b/source/slang/ir.cpp index 8fbe20aa6..313fd258b 100644 --- a/source/slang/ir.cpp +++ b/source/slang/ir.cpp @@ -167,6 +167,7 @@ namespace Slang case kIROp_ifElse: case kIROp_loopTest: case kIROp_discard: + case kIROp_switch: return true; } } @@ -1289,6 +1290,28 @@ namespace Slang return inst; } + IRInst* IRBuilder::emitSwitch( + IRValue* val, + IRBlock* breakLabel, + IRBlock* defaultLabel, + UInt caseArgCount, + IRValue* const* caseArgs) + { + IRValue* fixedArgs[] = { val, breakLabel, defaultLabel }; + UInt fixedArgCount = sizeof(fixedArgs) / sizeof(fixedArgs[0]); + + auto inst = createInstWithTrailingArgs<IRSwitch>( + this, + kIROp_switch, + nullptr, + fixedArgCount, + fixedArgs, + caseArgCount, + caseArgs); + addInst(inst); + return inst; + } + IRDecoration* IRBuilder::addDecorationImpl( IRValue* inst, UInt decorationSize, |
