OSDN Git Service

Add a new method to SDNode/SDOperand named getValueSizeInBits
authorDan Gohman <gohman@apple.com>
Mon, 25 Feb 2008 19:08:02 +0000 (19:08 +0000)
committerDan Gohman <gohman@apple.com>
Mon, 25 Feb 2008 19:08:02 +0000 (19:08 +0000)
that combines getValueType and MVT::getSizeInBits, since this
occurrs frequently.

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

include/llvm/CodeGen/SelectionDAGNodes.h

index d47e0a6..6996c69 100644 (file)
@@ -831,6 +831,12 @@ public:
   ///
   inline MVT::ValueType getValueType() const;
 
+  /// getValueSizeInBits - Returns MVT::getSizeInBits(getValueType()).
+  ///
+  unsigned getValueSizeInBits() const {
+    return MVT::getSizeInBits(getValueType());
+  }
+
   // Forwarding methods - These forward to the corresponding methods in SDNode.
   inline unsigned getOpcode() const;
   inline unsigned getNumOperands() const;
@@ -1011,6 +1017,12 @@ public:
     return ValueList[ResNo];
   }
 
+  /// getValueSizeInBits - Returns MVT::getSizeInBits(getValueType(ResNo)).
+  ///
+  unsigned getValueSizeInBits(unsigned ResNo) const {
+    return MVT::getSizeInBits(getValueType(ResNo));
+  }
+
   typedef const MVT::ValueType* value_iterator;
   value_iterator value_begin() const { return ValueList; }
   value_iterator value_end() const { return ValueList+NumValues; }