Added isOperand(N): true if this is an operand of N
authorEvan Cheng <evan.cheng@apple.com>
Fri, 3 Mar 2006 06:24:54 +0000 (06:24 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Fri, 3 Mar 2006 06:24:54 +0000 (06:24 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26501 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/SelectionDAGNodes.h
lib/CodeGen/SelectionDAG/SelectionDAG.cpp

index 02feba71064e7111d32dbdbac19d838caca487a7..5f66b635749c93ef88a44888c98ab253f3e67e0c 100644 (file)
@@ -542,6 +542,7 @@ public:
   inline const SDOperand &getOperand(unsigned i) const;
   inline bool isTargetOpcode() const;
   inline unsigned getTargetOpcode() const;
+  inline const bool isOperand(SDNode *N) const;
 
   /// hasOneUse - Return true if there is exactly one operation using this
   /// result value of the defining operator.
@@ -631,6 +632,9 @@ public:
   // isOnlyUse - Return true if this node is the only use of N.
   bool isOnlyUse(SDNode *N) const;
 
+  // isOperand - Return true if this node is an operand of N.
+  bool isOperand(SDNode *N) const;
+
   /// getNumOperands - Return the number of values used by this operation.
   ///
   unsigned getNumOperands() const { return NumOperands; }
@@ -937,6 +941,9 @@ inline bool SDOperand::isTargetOpcode() const {
 inline unsigned SDOperand::getTargetOpcode() const {
   return Val->getTargetOpcode();
 }
+inline const bool SDOperand::isOperand(SDNode *N) const {
+  return Val->isOperand(N);
+}
 inline bool SDOperand::hasOneUse() const {
   return Val->hasNUsesOfValue(1, ResNo);
 }
index 24497af2348e09bb2c1bc7d36cae9957af7cd2a3..293ea60c33456f85565cc889af3cfed931797302 100644 (file)
@@ -2533,6 +2533,13 @@ bool SDNode::isOnlyUse(SDNode *N) const {
   return Seen;
 }
 
+// isOperand - Return true if this node is an operand of N.
+bool SDNode::isOperand(SDNode *N) const {
+  for (unsigned i = 0, e = N->NumOperands; i != e; ++i)
+    if (this == N->OperandList[i].Val)
+      return true;
+  return false;
+}
 
 const char *SDNode::getOperationName(const SelectionDAG *G) const {
   switch (getOpcode()) {