summaryrefslogtreecommitdiffstats
path: root/source/slang/ir.h
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/ir.h')
-rw-r--r--source/slang/ir.h23
1 files changed, 15 insertions, 8 deletions
diff --git a/source/slang/ir.h b/source/slang/ir.h
index 028468308..407506116 100644
--- a/source/slang/ir.h
+++ b/source/slang/ir.h
@@ -82,22 +82,27 @@ IROpInfo getIROpInfo(IROp op);
// A use of another value/inst within an IR operation
struct IRUse
{
+ IRValue* get() { return usedValue; }
+ IRUser* getUser() { return user; }
+
+ void init(IRUser* user, IRValue* usedValue);
+ void set(IRValue* usedValue);
+ void clear();
+
// The value that is being used
- IRValue* usedValue;
+ IRValue* usedValue = nullptr;
// The value that is doing the using.
- IRUser* user;
+ IRUser* user = nullptr;
// The next use of the same value
- IRUse* nextUse;
+ IRUse* nextUse = nullptr;
// A "link" back to where this use is referenced,
// so that we can simplify updates.
- IRUse** prevLink;
+ IRUse** prevLink = nullptr;
- void init(IRUser* user, IRValue* usedValue);
- void set(IRValue* usedValue);
- void clear();
+ void debugValidate();
};
enum IRDecorationOp : uint16_t
@@ -262,7 +267,7 @@ struct IRUser : IRChildValue
IRValue* getArg(UInt index)
{
- return getArgs()[index].usedValue;
+ return getArgs()[index].get();
}
void setArg(UInt index, IRValue* value)
@@ -542,6 +547,8 @@ void printSlangIRAssembly(StringBuilder& builder, IRModule* module);
String getSlangIRAssembly(IRModule* module);
void dumpIR(IRModule* module);
+void dumpIR(IRGlobalValue* globalVal);
+
String dumpIRFunc(IRFunc* func);
}