summaryrefslogtreecommitdiff
path: root/source/slang/ir.h
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/ir.h')
-rw-r--r--source/slang/ir.h62
1 files changed, 62 insertions, 0 deletions
diff --git a/source/slang/ir.h b/source/slang/ir.h
index 1b4529a3c..028468308 100644
--- a/source/slang/ir.h
+++ b/source/slang/ir.h
@@ -375,6 +375,68 @@ struct IRBlock : IRValue
IRGlobalValueWithCode* getParent() { return parentFunc; }
+ void insertAfter(IRBlock* other);
+ void insertAfter(IRBlock* other, IRGlobalValueWithCode* func);
+
+ struct PredecessorList
+ {
+ PredecessorList(IRUse* begin) : b(begin) {}
+ IRUse* b;
+
+ UInt getCount();
+
+ struct Iterator
+ {
+ Iterator(IRUse* use) : use(use) {}
+
+ IRBlock* operator*();
+
+ void operator++();
+
+ bool operator!=(Iterator const& that)
+ {
+ return use != that.use;
+ }
+
+ IRUse* use;
+ };
+
+ Iterator begin() { return Iterator(b); }
+ Iterator end() { return Iterator(nullptr); }
+ };
+
+ struct SuccessorList
+ {
+ SuccessorList(IRUse* begin, IRUse* end, UInt stride = 1) : begin_(begin), end_(end), stride(stride) {}
+ IRUse* begin_;
+ IRUse* end_;
+ UInt stride;
+
+ UInt getCount();
+
+ struct Iterator
+ {
+ Iterator(IRUse* use, UInt stride) : use(use), stride(stride) {}
+
+ IRBlock* operator*();
+
+ void operator++();
+
+ bool operator!=(Iterator const& that)
+ {
+ return use != that.use;
+ }
+
+ IRUse* use;
+ UInt stride;
+ };
+
+ Iterator begin() { return Iterator(begin_, stride); }
+ Iterator end() { return Iterator(end_, stride); }
+ };
+
+ PredecessorList getPredecessors();
+ SuccessorList getSuccessors();
};
// For right now, we will represent the type of