diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2006-10-20 07:07:24 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2006-10-20 07:07:24 +0000 |
commit | b83eb6447ba155342598f0fabe1f08f5baa9164a (patch) | |
tree | a5822f5fdac89033b7b16ba8e5aaf1ae10833b1c /lib/CodeGen/MachineDebugInfo.cpp | |
parent | 6e7dd9db6bf677c9161a6ecc12f90651cf1231e0 (diff) |
For PR950:
This patch implements the first increment for the Signless Types feature.
All changes pertain to removing the ConstantSInt and ConstantUInt classes
in favor of just using ConstantInt.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31063 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/MachineDebugInfo.cpp')
-rw-r--r-- | lib/CodeGen/MachineDebugInfo.cpp | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/lib/CodeGen/MachineDebugInfo.cpp b/lib/CodeGen/MachineDebugInfo.cpp index 7ca63b0ba4..a1f4f1338b 100644 --- a/lib/CodeGen/MachineDebugInfo.cpp +++ b/lib/CodeGen/MachineDebugInfo.cpp @@ -120,7 +120,7 @@ static bool isGlobalVariable(Value *V) { /// getUIntOperand - Return ith operand if it is an unsigned integer. /// -static ConstantUInt *getUIntOperand(GlobalVariable *GV, unsigned i) { +static ConstantInt *getUIntOperand(GlobalVariable *GV, unsigned i) { // Make sure the GlobalVariable has an initializer. if (!GV->hasInitializer()) return NULL; @@ -133,8 +133,9 @@ static ConstantUInt *getUIntOperand(GlobalVariable *GV, unsigned i) { if (i >= N) return NULL; // Check constant. - return dyn_cast<ConstantUInt>(CI->getOperand(i)); + return dyn_cast<ConstantInt>(CI->getOperand(i)); } + //===----------------------------------------------------------------------===// /// ApplyToFields - Target the visitor to each field of the debug information @@ -192,19 +193,19 @@ public: /// virtual void Apply(int &Field) { Constant *C = CI->getOperand(I++); - Field = cast<ConstantSInt>(C)->getValue(); + Field = cast<ConstantInt>(C)->getSExtValue(); } virtual void Apply(unsigned &Field) { Constant *C = CI->getOperand(I++); - Field = cast<ConstantUInt>(C)->getValue(); + Field = cast<ConstantInt>(C)->getZExtValue(); } virtual void Apply(int64_t &Field) { Constant *C = CI->getOperand(I++); - Field = cast<ConstantSInt>(C)->getValue(); + Field = cast<ConstantInt>(C)->getSExtValue(); } virtual void Apply(uint64_t &Field) { Constant *C = CI->getOperand(I++); - Field = cast<ConstantUInt>(C)->getValue(); + Field = cast<ConstantInt>(C)->getZExtValue(); } virtual void Apply(bool &Field) { Constant *C = CI->getOperand(I++); @@ -261,16 +262,16 @@ public: /// Apply - Set the value of each of the fields. /// virtual void Apply(int &Field) { - Elements.push_back(ConstantSInt::get(Type::IntTy, Field)); + Elements.push_back(ConstantInt::get(Type::IntTy, int32_t(Field))); } virtual void Apply(unsigned &Field) { - Elements.push_back(ConstantUInt::get(Type::UIntTy, Field)); + Elements.push_back(ConstantInt::get(Type::UIntTy, uint32_t(Field))); } virtual void Apply(int64_t &Field) { - Elements.push_back(ConstantSInt::get(Type::LongTy, Field)); + Elements.push_back(ConstantInt::get(Type::LongTy, int64_t(Field))); } virtual void Apply(uint64_t &Field) { - Elements.push_back(ConstantUInt::get(Type::ULongTy, Field)); + Elements.push_back(ConstantInt::get(Type::ULongTy, uint64_t(Field))); } virtual void Apply(bool &Field) { Elements.push_back(ConstantBool::get(Field)); @@ -467,8 +468,8 @@ public: /// TagFromGlobal - Returns the tag number from a debug info descriptor /// GlobalVariable. Return DIIValid if operand is not an unsigned int. unsigned DebugInfoDesc::TagFromGlobal(GlobalVariable *GV) { - ConstantUInt *C = getUIntOperand(GV, 0); - return C ? ((unsigned)C->getValue() & ~LLVMDebugVersionMask) : + ConstantInt *C = getUIntOperand(GV, 0); + return C ? ((unsigned)C->getZExtValue() & ~LLVMDebugVersionMask) : (unsigned)DW_TAG_invalid; } @@ -476,8 +477,8 @@ unsigned DebugInfoDesc::TagFromGlobal(GlobalVariable *GV) { /// descriptor GlobalVariable. Return DIIValid if operand is not an unsigned /// int. unsigned DebugInfoDesc::VersionFromGlobal(GlobalVariable *GV) { - ConstantUInt *C = getUIntOperand(GV, 0); - return C ? ((unsigned)C->getValue() & LLVMDebugVersionMask) : + ConstantInt *C = getUIntOperand(GV, 0); + return C ? ((unsigned)C->getZExtValue() & LLVMDebugVersionMask) : (unsigned)DW_TAG_invalid; } |