[llvm] [SandboxVec][DAG] MemDGNode for memory-dependency candidate nodes (PR #109684)

via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 27 10:33:06 PDT 2024


================
@@ -66,9 +84,94 @@ class DGNode {
 #endif // NDEBUG
 };
 
+/// A DependencyGraph Node for instructiosn that may read/write memory, or have
+/// some ordering constraints, like with stacksave/stackrestore and
+/// alloca/inalloca.
+class MemDGNode final : public DGNode {
+  MemDGNode *PrevMemN = nullptr;
+  MemDGNode *NextMemN = nullptr;
+
+  void setNextNode(DGNode *N) { NextMemN = cast_or_null<MemDGNode>(N); }
+  void setPrevNode(DGNode *N) { PrevMemN = cast_or_null<MemDGNode>(N); }
+  friend class DependencyGraph; // For setNextNode(), setPrevNode().
+
+public:
+  MemDGNode(Instruction *I) : DGNode(I, DGNodeID::MemDGNode) {
+    assert(isMemDepCandidate(I) && "Expected Mem instruction!");
+  }
+  static bool classof(const DGNode *Other) {
+    return Other->SubclassID == DGNodeID::MemDGNode;
+  }
+  /// \Returns the previosu Mem DGNode in instruction order.
----------------
vporpo wrote:

Done.

https://github.com/llvm/llvm-project/pull/109684


More information about the llvm-commits mailing list