[llvm-commits] CVS: llvm/lib/VMCore/ConstantFolding.cpp Constants.cpp
Reid Spencer
reid at x10sys.com
Tue Dec 12 15:36:36 PST 2006
Changes in directory llvm/lib/VMCore:
ConstantFolding.cpp updated: 1.113 -> 1.114
Constants.cpp updated: 1.186 -> 1.187
---
Log message:
Replace inferred getCast(V,Ty) calls with more strict variants.
Rename getZeroExtend and getSignExtend to getZExt and getSExt to match
the the casting mnemonics in the rest of LLVM.
---
Diffs of the changes: (+10 -11)
ConstantFolding.cpp | 9 ++++-----
Constants.cpp | 12 ++++++------
2 files changed, 10 insertions(+), 11 deletions(-)
Index: llvm/lib/VMCore/ConstantFolding.cpp
diff -u llvm/lib/VMCore/ConstantFolding.cpp:1.113 llvm/lib/VMCore/ConstantFolding.cpp:1.114
--- llvm/lib/VMCore/ConstantFolding.cpp:1.113 Mon Dec 11 15:27:28 2006
+++ llvm/lib/VMCore/ConstantFolding.cpp Tue Dec 12 17:36:14 2006
@@ -743,8 +743,7 @@
(SrcEltTy->isFloatingPoint() && DstEltTy->isFloatingPoint())) {
for (unsigned i = 0; i != SrcNumElts; ++i)
Result.push_back(
- ConstantExpr::getCast(Instruction::BitCast, CP->getOperand(i),
- DstEltTy));
+ ConstantExpr::getBitCast(CP->getOperand(i), DstEltTy));
return ConstantPacked::get(Result);
}
@@ -1148,11 +1147,11 @@
// Ok, we have two differing integer indices. Sign extend them to be the same
// type. Long is always big enough, so we use it.
if (C1->getType() != Type::LongTy && C1->getType() != Type::ULongTy)
- C1 = ConstantExpr::getSignExtend(C1, Type::LongTy);
+ C1 = ConstantExpr::getSExt(C1, Type::LongTy);
else
C1 = ConstantExpr::getBitCast(C1, Type::LongTy);
if (C2->getType() != Type::LongTy && C1->getType() != Type::ULongTy)
- C2 = ConstantExpr::getSignExtend(C2, Type::LongTy);
+ C2 = ConstantExpr::getSExt(C2, Type::LongTy);
else
C2 = ConstantExpr::getBitCast(C2, Type::LongTy);
@@ -1672,7 +1671,7 @@
R = ConstantExpr::getSExtOrBitCast(R, Idx0->getType());
R = ConstantExpr::getMul(R, Idx0); // signed multiply
// R is a signed integer, C is the GEP pointer so -> IntToPtr
- return ConstantExpr::getCast(Instruction::IntToPtr, R, C->getType());
+ return ConstantExpr::getIntToPtr(R, C->getType());
}
}
}
Index: llvm/lib/VMCore/Constants.cpp
diff -u llvm/lib/VMCore/Constants.cpp:1.186 llvm/lib/VMCore/Constants.cpp:1.187
--- llvm/lib/VMCore/Constants.cpp:1.186 Mon Dec 11 23:38:50 2006
+++ llvm/lib/VMCore/Constants.cpp Tue Dec 12 17:36:14 2006
@@ -1391,8 +1391,8 @@
case Instruction::PtrToInt:
case Instruction::IntToPtr:
case Instruction::BitCast:
- New = ConstantExpr::getCast(
- OldC->getOpcode(), OldC->getOperand(0), NewTy);
+ New = ConstantExpr::getCast(OldC->getOpcode(), OldC->getOperand(0),
+ NewTy);
break;
case Instruction::Select:
New = ConstantExpr::getSelectTy(NewTy, OldC->getOperand(0),
@@ -1464,8 +1464,8 @@
assert(0 && "Invalid cast opcode");
break;
case Instruction::Trunc: return getTrunc(C, Ty);
- case Instruction::ZExt: return getZeroExtend(C, Ty);
- case Instruction::SExt: return getSignExtend(C, Ty);
+ case Instruction::ZExt: return getZExt(C, Ty);
+ case Instruction::SExt: return getSExt(C, Ty);
case Instruction::FPTrunc: return getFPTrunc(C, Ty);
case Instruction::FPExt: return getFPExtend(C, Ty);
case Instruction::UIToFP: return getUIToFP(C, Ty);
@@ -1547,7 +1547,7 @@
return getFoldedCast(Instruction::Trunc, C, Ty);
}
-Constant *ConstantExpr::getSignExtend(Constant *C, const Type *Ty) {
+Constant *ConstantExpr::getSExt(Constant *C, const Type *Ty) {
assert(C->getType()->isIntegral() && "SEXt operand must be integral");
assert(Ty->isInteger() && "SExt produces only integer");
assert(C->getType()->getPrimitiveSizeInBits() < Ty->getPrimitiveSizeInBits()&&
@@ -1556,7 +1556,7 @@
return getFoldedCast(Instruction::SExt, C, Ty);
}
-Constant *ConstantExpr::getZeroExtend(Constant *C, const Type *Ty) {
+Constant *ConstantExpr::getZExt(Constant *C, const Type *Ty) {
assert(C->getType()->isIntegral() && "ZEXt operand must be integral");
assert(Ty->isInteger() && "ZExt produces only integer");
assert(C->getType()->getPrimitiveSizeInBits() < Ty->getPrimitiveSizeInBits()&&
More information about the llvm-commits
mailing list