OSDN Git Service

add a helper class
authorChris Lattner <sabre@nondot.org>
Wed, 5 Oct 2005 06:34:34 +0000 (06:34 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 5 Oct 2005 06:34:34 +0000 (06:34 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23633 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/SelectionDAGNodes.h

index 0ccd8e1..1f3604a 100644 (file)
@@ -309,6 +309,9 @@ namespace ISD {
     // other operands match the intrinsic.  These produce a token chain in
     // addition to a value (if any).
     READPORT, WRITEPORT, READIO, WRITEIO,
+    
+    // HANDLENODE node - Used as a handle for various purposes.
+    HANDLENODE,
 
     // BUILTIN_OP_END - This must be the last enum value in this list.
     BUILTIN_OP_END,
@@ -751,6 +754,20 @@ inline bool SDOperand::hasOneUse() const {
   return Val->hasNUsesOfValue(1, ResNo);
 }
 
+/// HandleSDNode - This class is used to form a handle around another node that
+/// is persistant and is updated across invocations of replaceAllUsesWith on its
+/// operand.  This node should be directly created by end-users and not added to
+/// the AllNodes list.
+class HandleSDNode : public SDNode {
+public:
+  HandleSDNode(SDOperand X) : SDNode(ISD::HANDLENODE, X) {}
+  ~HandleSDNode() {
+    MorphNodeTo(ISD::HANDLENODE);  // Drops operand uses.
+  }
+  
+  SDOperand getValue() const { return getOperand(0); }
+};
+
 
 class ConstantSDNode : public SDNode {
   uint64_t Value;