Add two new methods isTargetOpcode() which returns true if the node type
authorNate Begeman <natebegeman@mac.com>
Wed, 17 Aug 2005 23:44:54 +0000 (23:44 +0000)
committerNate Begeman <natebegeman@mac.com>
Wed, 17 Aug 2005 23:44:54 +0000 (23:44 +0000)
is greater than the range of building selection dag node types, and
getTargetOpcode(), which returns the node opcode less the value of
isd::builtin_op_end, which specifies the end of the builtin types.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22844 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/SelectionDAGNodes.h

index 303d38346905266ba1e0c4be65b476cc7e6651f0..ad0c54586cb3a184f0d710e533adc842fc1c095d 100644 (file)
@@ -428,6 +428,8 @@ public:
   inline unsigned getNodeDepth() const;
   inline unsigned getNumOperands() const;
   inline const SDOperand &getOperand(unsigned i) const;
+  inline bool isTargetOpcode() const;
+  inline unsigned getTargetOpcode() const;
 
   /// hasOneUse - Return true if there is exactly one operation using this
   /// result value of the defining operator.
@@ -480,6 +482,11 @@ public:
   //  Accessors
   //
   unsigned getOpcode()  const { return NodeType; }
+  bool isTargetOpcode() const { return NodeType >= ISD::BUILTIN_OP_END; }
+  unsigned getTargetOpcode() const {
+    assert(isTargetOpcode() && "Not a target opcode!");
+    return NodeType - ISD::BUILTIN_OP_END;
+  }
 
   size_t use_size() const { return Uses.size(); }
   bool use_empty() const { return Uses.empty(); }
@@ -691,6 +698,12 @@ inline unsigned SDOperand::getNumOperands() const {
 inline const SDOperand &SDOperand::getOperand(unsigned i) const {
   return Val->getOperand(i);
 }
+inline bool SDOperand::isTargetOpcode() const {
+  return Val->isTargetOpcode();
+}
+inline unsigned SDOperand::getTargetOpcode() const {
+  return Val->getTargetOpcode();
+}
 inline bool SDOperand::hasOneUse() const {
   return Val->hasNUsesOfValue(1, ResNo);
 }