diff options
author | Chris Lattner <sabre@nondot.org> | 2003-07-23 15:22:26 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-07-23 15:22:26 +0000 |
commit | 6077c3195f74b27b75ed3e9df3af7a13798b437f (patch) | |
tree | 48a5a2e54b7d1a5762d782e838db817d8a2e78ca /llvm/lib/Target/Sparc/SparcInstrInfo.cpp | |
parent | 79f22fe02fe354c50fc4d6a1c08a894fdd847dba (diff) | |
download | bcm5719-llvm-6077c3195f74b27b75ed3e9df3af7a13798b437f.tar.gz bcm5719-llvm-6077c3195f74b27b75ed3e9df3af7a13798b437f.zip |
Simplify code by using ConstantInt::getRawValue instead of checking to see
whether the constant is signed or unsigned, then casting
llvm-svn: 7252
Diffstat (limited to 'llvm/lib/Target/Sparc/SparcInstrInfo.cpp')
-rw-r--r-- | llvm/lib/Target/Sparc/SparcInstrInfo.cpp | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/llvm/lib/Target/Sparc/SparcInstrInfo.cpp b/llvm/lib/Target/Sparc/SparcInstrInfo.cpp index 75bea0d7774..39d6dcc6a15 100644 --- a/llvm/lib/Target/Sparc/SparcInstrInfo.cpp +++ b/llvm/lib/Target/Sparc/SparcInstrInfo.cpp @@ -43,10 +43,8 @@ GetConstantValueAsUnsignedInt(const Value *V, if (isa<Constant>(V)) if (const ConstantBool *CB = dyn_cast<ConstantBool>(V)) return (int64_t)CB->getValue(); - else if (const ConstantSInt *CS = dyn_cast<ConstantSInt>(V)) - return (uint64_t)CS->getValue(); - else if (const ConstantUInt *CU = dyn_cast<ConstantUInt>(V)) - return CU->getValue(); + else if (const ConstantInt *CI = dyn_cast<ConstantInt>(V)) + return CI->getRawValue(); isValidConstant = false; return 0; @@ -377,15 +375,11 @@ UltraSparcInstrInfo::ConstantMayNotFitInImmedField(const Constant* CV, if (isa<ConstantPointerNull>(CV)) // can always use %g0 return false; - if (const ConstantUInt* U = dyn_cast<ConstantUInt>(CV)) - /* Large unsigned longs may really just be small negative signed longs */ - return (labs((int64_t) U->getValue()) > MaxConstantsTable[I->getOpcode()]); - - if (const ConstantSInt* S = dyn_cast<ConstantSInt>(CV)) - return (labs(S->getValue()) > MaxConstantsTable[I->getOpcode()]); + if (const ConstantInt* CI = dyn_cast<ConstantInt>(CV)) + return labs((int64_t)CI->getRawValue()) > MaxConstantsTable[I->getOpcode()]; if (isa<ConstantBool>(CV)) - return (1 > MaxConstantsTable[I->getOpcode()]); + return 1 > MaxConstantsTable[I->getOpcode()]; return true; } |