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/Target/CBackend/Writer.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/Target/CBackend/Writer.cpp')
-rw-r--r-- | lib/Target/CBackend/Writer.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/lib/Target/CBackend/Writer.cpp b/lib/Target/CBackend/Writer.cpp index 88113a0347..f31f92018b 100644 --- a/lib/Target/CBackend/Writer.cpp +++ b/lib/Target/CBackend/Writer.cpp @@ -460,7 +460,7 @@ void CWriter::printConstantArray(ConstantArray *CPA) { // Do not include the last character, which we know is null for (unsigned i = 0, e = CPA->getNumOperands()-1; i != e; ++i) { - unsigned char C = cast<ConstantInt>(CPA->getOperand(i))->getRawValue(); + unsigned char C = cast<ConstantInt>(CPA->getOperand(i))->getZExtValue(); // Print it out literally if it is a printable character. The only thing // to be careful about is when the last letter output was a hex escape @@ -642,31 +642,31 @@ void CWriter::printConstant(Constant *CPV) { break; case Type::SByteTyID: case Type::ShortTyID: - Out << cast<ConstantSInt>(CPV)->getValue(); + Out << cast<ConstantInt>(CPV)->getSExtValue(); break; case Type::IntTyID: - if ((int)cast<ConstantSInt>(CPV)->getValue() == (int)0x80000000) + if ((int)cast<ConstantInt>(CPV)->getSExtValue() == (int)0x80000000) Out << "((int)0x80000000U)"; // Handle MININT specially to avoid warning else - Out << cast<ConstantSInt>(CPV)->getValue(); + Out << cast<ConstantInt>(CPV)->getSExtValue(); break; case Type::LongTyID: - if (cast<ConstantSInt>(CPV)->isMinValue()) + if (cast<ConstantInt>(CPV)->isMinValue()) Out << "(/*INT64_MIN*/(-9223372036854775807LL)-1)"; else - Out << cast<ConstantSInt>(CPV)->getValue() << "ll"; + Out << cast<ConstantInt>(CPV)->getSExtValue() << "ll"; break; case Type::UByteTyID: case Type::UShortTyID: - Out << cast<ConstantUInt>(CPV)->getValue(); + Out << cast<ConstantInt>(CPV)->getZExtValue(); break; case Type::UIntTyID: - Out << cast<ConstantUInt>(CPV)->getValue() << 'u'; + Out << cast<ConstantInt>(CPV)->getZExtValue() << 'u'; break; case Type::ULongTyID: - Out << cast<ConstantUInt>(CPV)->getValue() << "ull"; + Out << cast<ConstantInt>(CPV)->getZExtValue() << "ull"; break; case Type::FloatTyID: @@ -2002,14 +2002,14 @@ void CWriter::printIndexingExpression(Value *Ptr, gep_type_iterator I, // Print out the -> operator if possible... if (TmpI != E && isa<StructType>(*TmpI)) { Out << (HasImplicitAddress ? "." : "->"); - Out << "field" << cast<ConstantUInt>(TmpI.getOperand())->getValue(); + Out << "field" << cast<ConstantInt>(TmpI.getOperand())->getZExtValue(); I = ++TmpI; } } for (; I != E; ++I) if (isa<StructType>(*I)) { - Out << ".field" << cast<ConstantUInt>(I.getOperand())->getValue(); + Out << ".field" << cast<ConstantInt>(I.getOperand())->getZExtValue(); } else { Out << '['; writeOperand(I.getOperand()); |