[llvm-commits] [SignlessTypes] CVS: llvm/lib/CodeGen/AsmPrinter.cpp IntrinsicLowering.cpp
Reid Spencer
reid at x10sys.com
Thu Oct 19 17:35:16 PDT 2006
Changes in directory llvm/lib/CodeGen:
AsmPrinter.cpp updated: 1.111.2.1 -> 1.111.2.2
IntrinsicLowering.cpp updated: 1.43.6.1 -> 1.43.6.2
---
Log message:
Make some simplifications for ConstantInt:
1. Get rid of getRawValue, replace with getZExtValue
2. Single constructor (uint64_t) and get method (int64_t)
3. Canonicalize the constant to a zero extended unsigned 64-bit integer when
it is created.
4. Adjust getZExtValue() to be a do-nothing (just returns the already
canonicalized value).
5. Compensate for above changes everywhere else.
---
Diffs of the changes: (+13 -21)
AsmPrinter.cpp | 6 +++---
IntrinsicLowering.cpp | 28 ++++++++++------------------
2 files changed, 13 insertions(+), 21 deletions(-)
Index: llvm/lib/CodeGen/AsmPrinter.cpp
diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.111.2.1 llvm/lib/CodeGen/AsmPrinter.cpp:1.111.2.2
--- llvm/lib/CodeGen/AsmPrinter.cpp:1.111.2.1 Wed Oct 18 22:57:55 2006
+++ llvm/lib/CodeGen/AsmPrinter.cpp Thu Oct 19 19:34:43 2006
@@ -493,7 +493,7 @@
O << "\"";
for (unsigned i = 0; i != LastElt; ++i) {
unsigned char C =
- (unsigned char)cast<ConstantInt>(CVA->getOperand(i))->getRawValue();
+ (unsigned char)cast<ConstantInt>(CVA->getOperand(i))->getZExtValue();
if (C == '"') {
O << "\\\"";
@@ -525,7 +525,7 @@
void AsmPrinter::EmitString(const ConstantArray *CVA) const {
unsigned NumElts = CVA->getNumOperands();
if (TAI->getAscizDirective() && NumElts &&
- cast<ConstantInt>(CVA->getOperand(NumElts-1))->getRawValue() == 0) {
+ cast<ConstantInt>(CVA->getOperand(NumElts-1))->getZExtValue() == 0) {
O << TAI->getAscizDirective();
printAsCString(O, CVA, NumElts-1);
} else {
@@ -605,7 +605,7 @@
}
} else if (CV->getType() == Type::ULongTy || CV->getType() == Type::LongTy) {
if (const ConstantInt *CI = dyn_cast<ConstantInt>(CV)) {
- uint64_t Val = CI->getRawValue();
+ uint64_t Val = CI->getZExtValue();
if (TAI->getData64bitsDirective())
O << TAI->getData64bitsDirective() << Val << "\n";
Index: llvm/lib/CodeGen/IntrinsicLowering.cpp
diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.43.6.1 llvm/lib/CodeGen/IntrinsicLowering.cpp:1.43.6.2
--- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.43.6.1 Wed Oct 18 22:57:55 2006
+++ llvm/lib/CodeGen/IntrinsicLowering.cpp Thu Oct 19 19:34:43 2006
@@ -166,12 +166,10 @@
Value *Tmp1 = new ShiftInst(Instruction::Shr, V,
ConstantInt::get(Type::UByteTy,24),"bswap.1", IP);
Tmp3 = BinaryOperator::createAnd(Tmp3,
- ConstantInt::get(Type::UIntTy,
- uint32_t(0xFF0000)),
+ ConstantInt::get(Type::UIntTy, 0xFF0000),
"bswap.and3", IP);
Tmp2 = BinaryOperator::createAnd(Tmp2,
- ConstantInt::get(Type::UIntTy,
- uint32_t(0xFF00)),
+ ConstantInt::get(Type::UIntTy, 0xFF00),
"bswap.and2", IP);
Tmp4 = BinaryOperator::createOr(Tmp4, Tmp3, "bswap.or1", IP);
Tmp2 = BinaryOperator::createOr(Tmp2, Tmp1, "bswap.or2", IP);
@@ -197,27 +195,22 @@
ConstantInt::get(Type::UByteTy,56),"bswap.1", IP);
Tmp7 = BinaryOperator::createAnd(Tmp7,
ConstantInt::get(Type::ULongTy,
- uint64_t(0xFF000000000000ULL)),
+ 0xFF000000000000ULL),
"bswap.and7", IP);
Tmp6 = BinaryOperator::createAnd(Tmp6,
- ConstantInt::get(Type::ULongTy,
- uint64_t(0xFF0000000000ULL)),
+ ConstantInt::get(Type::ULongTy, 0xFF0000000000ULL),
"bswap.and6", IP);
Tmp5 = BinaryOperator::createAnd(Tmp5,
- ConstantInt::get(Type::ULongTy,
- uint64_t(0xFF00000000ULL)),
+ ConstantInt::get(Type::ULongTy, 0xFF00000000ULL),
"bswap.and5", IP);
Tmp4 = BinaryOperator::createAnd(Tmp4,
- ConstantInt::get(Type::ULongTy,
- uint64_t(0xFF000000ULL)),
+ ConstantInt::get(Type::ULongTy, 0xFF000000ULL),
"bswap.and4", IP);
Tmp3 = BinaryOperator::createAnd(Tmp3,
- ConstantInt::get(Type::ULongTy,
- uint64_t(0xFF0000ULL)),
+ ConstantInt::get(Type::ULongTy, 0xFF0000ULL),
"bswap.and3", IP);
Tmp2 = BinaryOperator::createAnd(Tmp2,
- ConstantInt::get(Type::ULongTy,
- uint64_t(0xFF00ULL)),
+ ConstantInt::get(Type::ULongTy, 0xFF00ULL),
"bswap.and2", IP);
Tmp8 = BinaryOperator::createOr(Tmp8, Tmp7, "bswap.or1", IP);
Tmp6 = BinaryOperator::createOr(Tmp6, Tmp5, "bswap.or2", IP);
@@ -255,8 +248,7 @@
unsigned BitSize = V->getType()->getPrimitiveSizeInBits();
for (unsigned i = 1, ct = 0; i != BitSize; i <<= 1, ++ct) {
Value *MaskCst =
- ConstantExpr::getCast(ConstantInt::get(Type::ULongTy,
- uint64_t(MaskValues[ct])),
+ ConstantExpr::getCast(ConstantInt::get(Type::ULongTy, MaskValues[ct]),
V->getType());
Value *LHS = BinaryOperator::createAnd(V, MaskCst, "cppop.and1", IP);
Value *VShift = new ShiftInst(Instruction::Shr, V,
@@ -404,7 +396,7 @@
case Intrinsic::readcyclecounter: {
std::cerr << "WARNING: this target does not support the llvm.readcyclecoun"
<< "ter intrinsic. It is being lowered to a constant 0\n";
- CI->replaceAllUsesWith(ConstantInt::get(Type::ULongTy, uint32_t(0)));
+ CI->replaceAllUsesWith(ConstantInt::get(Type::ULongTy, 0));
break;
}
More information about the llvm-commits
mailing list