summaryrefslogtreecommitdiffstats
path: root/source/slang/ir.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/ir.cpp')
-rw-r--r--source/slang/ir.cpp32
1 files changed, 17 insertions, 15 deletions
diff --git a/source/slang/ir.cpp b/source/slang/ir.cpp
index d2c3f5ba5..b6af6aabb 100644
--- a/source/slang/ir.cpp
+++ b/source/slang/ir.cpp
@@ -622,20 +622,23 @@ namespace Slang
getTypeType());
}
- IRType* IRBuilder::getStructType(
- UInt fieldCount,
- IRType* const* fieldTypes)
+ IRStructDecl* IRBuilder::createStructType()
{
- auto inst = createInstWithTrailingArgs<IRStructType>(
+ return createInst<IRStructDecl>(
this,
kIROp_StructType,
- getTypeType(),
- fieldCount,
- (IRValue* const*)fieldTypes);
- addInst(inst);
- return inst;
+ getTypeType());
}
+ IRStructField* IRBuilder::createStructField(IRType* fieldType)
+ {
+ return createInst<IRStructField>(
+ this,
+ kIROp_StructField,
+ fieldType);
+ }
+
+
IRType* IRBuilder::getFuncType(
UInt paramCount,
IRType* const* paramTypes,
@@ -753,17 +756,16 @@ namespace Slang
}
IRInst* IRBuilder::emitFieldExtract(
- IRType* type,
- IRValue* base,
- UInt fieldIndex)
+ IRType* type,
+ IRValue* base,
+ IRStructField* field)
{
auto inst = createInst<IRFieldExtract>(
this,
kIROp_FieldExtract,
type,
- base);
-
- inst->fieldIndex = fieldIndex;
+ base,
+ field);
addInst(inst);
return inst;