summaryrefslogtreecommitdiff
path: root/source/slang/slang-ir.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-ir.cpp')
-rw-r--r--source/slang/slang-ir.cpp25
1 files changed, 23 insertions, 2 deletions
diff --git a/source/slang/slang-ir.cpp b/source/slang/slang-ir.cpp
index 27eb1adfb..f7ebfdb64 100644
--- a/source/slang/slang-ir.cpp
+++ b/source/slang/slang-ir.cpp
@@ -200,7 +200,7 @@ namespace Slang
return nullptr;
}
- IROperandListBase IRInst::getAllAttrs()
+ IROperandList<IRAttr> IRInst::getAllAttrs()
{
// We assume as an invariant that all attributes appear at the end of the operand
// list, after all the non-attribute operands.
@@ -215,7 +215,7 @@ namespace Slang
while(cursor != end && !as<IRAttr>(cursor->get()))
cursor++;
- return IROperandListBase(cursor, end);
+ return IROperandList<IRAttr>(cursor, end);
}
// IRConstant
@@ -2766,6 +2766,17 @@ namespace Slang
return getType(kIROp_ConjunctionType, typeCount, (IRInst* const*)types);
}
+ IRType* IRBuilder::getAttributedType(
+ IRType* baseType,
+ UInt attributeCount,
+ IRAttr* const* attributes)
+ {
+ List<IRInst*> operands;
+ operands.add(baseType);
+ for(UInt i = 0; i < attributeCount; ++i)
+ operands.add(attributes[i]);
+ return getType(kIROp_AttributedType, operands.getCount(), operands.getBuffer());
+ }
void IRBuilder::setDataType(IRInst* inst, IRType* dataType)
@@ -4258,6 +4269,16 @@ namespace Slang
operands));
}
+ IRAttr* IRBuilder::getAttr(IROp op, UInt operandCount, IRInst* const* operands)
+ {
+ return cast<IRAttr>(findOrEmitHoistableInst(
+ getVoidType(),
+ op,
+ operandCount,
+ operands));
+ }
+
+
IRTypeLayout* IRBuilder::getTypeLayout(IROp op, List<IRInst*> const& operands)
{