diff options
| author | Dan Gohman <gohman@apple.com> | 2008-02-08 22:59:30 +0000 |
|---|---|---|
| committer | Dan Gohman <gohman@apple.com> | 2008-02-08 22:59:30 +0000 |
| commit | 6394b099e836f56a937cdcc7332c9487b504ca68 (patch) | |
| tree | 28185f34de843851bd8e3fe1d9bdcf783fa2d03d /include/llvm/CodeGen | |
| parent | 82ada54da02a0b2a977fdeb6782c8e5ab9a9b9ea (diff) | |
Change ConstantSDNode to store an APInt instead of a uint64_t, and
begin adding some methods to use it this way.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46899 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen')
| -rw-r--r-- | include/llvm/CodeGen/SelectionDAG.h | 4 | ||||
| -rw-r--r-- | include/llvm/CodeGen/SelectionDAGNodes.h | 10 |
2 files changed, 10 insertions, 4 deletions
diff --git a/include/llvm/CodeGen/SelectionDAG.h b/include/llvm/CodeGen/SelectionDAG.h index 0585e3e5d1..665419bdd1 100644 --- a/include/llvm/CodeGen/SelectionDAG.h +++ b/include/llvm/CodeGen/SelectionDAG.h @@ -172,10 +172,14 @@ public: // SDOperand getString(const std::string &Val); SDOperand getConstant(uint64_t Val, MVT::ValueType VT, bool isTarget = false); + SDOperand getConstant(const APInt &Val, MVT::ValueType VT, bool isTarget = false); SDOperand getIntPtrConstant(uint64_t Val, bool isTarget = false); SDOperand getTargetConstant(uint64_t Val, MVT::ValueType VT) { return getConstant(Val, VT, true); } + SDOperand getTargetConstant(const APInt &Val, MVT::ValueType VT) { + return getConstant(Val, VT, true); + } SDOperand getConstantFP(double Val, MVT::ValueType VT, bool isTarget = false); SDOperand getConstantFP(const APFloat& Val, MVT::ValueType VT, bool isTarget = false); diff --git a/include/llvm/CodeGen/SelectionDAGNodes.h b/include/llvm/CodeGen/SelectionDAGNodes.h index 2c35e3181b..43d22a402c 100644 --- a/include/llvm/CodeGen/SelectionDAGNodes.h +++ b/include/llvm/CodeGen/SelectionDAGNodes.h @@ -24,6 +24,7 @@ #include "llvm/ADT/GraphTraits.h" #include "llvm/ADT/iterator" #include "llvm/ADT/APFloat.h" +#include "llvm/ADT/APInt.h" #include "llvm/CodeGen/ValueTypes.h" #include "llvm/CodeGen/MemOperand.h" #include "llvm/Support/DataTypes.h" @@ -1173,21 +1174,22 @@ public: }; class ConstantSDNode : public SDNode { - uint64_t Value; + APInt Value; virtual void ANCHOR(); // Out-of-line virtual method to give class a home. protected: friend class SelectionDAG; - ConstantSDNode(bool isTarget, uint64_t val, MVT::ValueType VT) + ConstantSDNode(bool isTarget, const APInt &val, MVT::ValueType VT) : SDNode(isTarget ? ISD::TargetConstant : ISD::Constant, getSDVTList(VT)), Value(val) { } public: - uint64_t getValue() const { return Value; } + const APInt &getAPIntValue() const { return Value; } + uint64_t getValue() const { return Value.getZExtValue(); } int64_t getSignExtended() const { unsigned Bits = MVT::getSizeInBits(getValueType(0)); - return ((int64_t)Value << (64-Bits)) >> (64-Bits); + return ((int64_t)Value.getZExtValue() << (64-Bits)) >> (64-Bits); } bool isNullValue() const { return Value == 0; } |
