diff options
| author | Yong He <yonghe@outlook.com> | 2020-08-13 12:17:59 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-08-13 12:17:59 -0700 |
| commit | 876968ccadf96ff592061c61855d77c6071f89f5 (patch) | |
| tree | 7615ff80b7db8540d4a8034e699b3f1e3a58739e /source/slang/slang-ir.cpp | |
| parent | 09adf10f646f01e177d412ba2d86602a51579b4f (diff) | |
IR support for Tuple types. (#1492)
* Tuple types.
* Fix x86 warning
* Improved deduplication
Co-authored-by: Tim Foley <tfoleyNV@users.noreply.github.com>
Diffstat (limited to 'source/slang/slang-ir.cpp')
| -rw-r--r-- | source/slang/slang-ir.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/source/slang/slang-ir.cpp b/source/slang/slang-ir.cpp index 1a6187a92..13840a84a 100644 --- a/source/slang/slang-ir.cpp +++ b/source/slang/slang-ir.cpp @@ -2270,6 +2270,23 @@ namespace Slang return (IRAnyValueType*)getType(kIROp_AnyValueType, size); } + IRTupleType* IRBuilder::getTupleType(UInt count, IRType* const* types) + { + return (IRTupleType*)getType(kIROp_TupleType, count, (IRInst*const*)types); + } + + IRTupleType* IRBuilder::getTupleType(IRType* type0, IRType* type1) + { + IRType* operands[] = { type0, type1 }; + return getTupleType(2, operands); + } + + IRTupleType* IRBuilder::getTupleType(IRType* type0, IRType* type1, IRType* type2) + { + IRType* operands[] = { type0, type1, type2 }; + return getTupleType(3, operands); + } + IRBasicBlockType* IRBuilder::getBasicBlockType() { return (IRBasicBlockType*)getType(kIROp_BasicBlockType); @@ -2721,6 +2738,17 @@ namespace Slang return inst; } + IRInst* IRBuilder::emitMakeTuple(IRType* type, UInt count, IRInst* const* args) + { + return emitIntrinsicInst(type, kIROp_MakeTuple, count, args); + } + + IRInst* IRBuilder::emitGetTupleElement(IRType* type, IRInst* tuple, UInt element) + { + IRInst* args[] = { tuple, getIntValue(getIntType(), element) }; + return emitIntrinsicInst(type, kIROp_GetTupleElement, 2, args); + } + IRInst* IRBuilder::emitMakeVector( IRType* type, UInt argCount, |
