[llvm-commits] CVS: llvm/lib/CodeGen/AsmPrinter.cpp IntrinsicLowering.cpp MachineDebugInfo.cpp
Reid Spencer
reid at x10sys.com
Mon Dec 11 17:17:59 PST 2006
Changes in directory llvm/lib/CodeGen:
AsmPrinter.cpp updated: 1.120 -> 1.121
IntrinsicLowering.cpp updated: 1.49 -> 1.50
MachineDebugInfo.cpp updated: 1.63 -> 1.64
---
Log message:
Change inferred cast creation calls to more specific cast creations.
---
Diffs of the changes: (+11 -7)
AsmPrinter.cpp | 6 +++++-
IntrinsicLowering.cpp | 2 +-
MachineDebugInfo.cpp | 10 +++++-----
3 files changed, 11 insertions(+), 7 deletions(-)
Index: llvm/lib/CodeGen/AsmPrinter.cpp
diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.120 llvm/lib/CodeGen/AsmPrinter.cpp:1.121
--- llvm/lib/CodeGen/AsmPrinter.cpp:1.120 Wed Dec 6 19:30:31 2006
+++ llvm/lib/CodeGen/AsmPrinter.cpp Mon Dec 11 19:17:40 2006
@@ -446,7 +446,11 @@
// integer type. This promotes constant folding and simplifies this code.
if (isa<PointerType>(Ty)) {
const Type *IntPtrTy = TD->getIntPtrType();
- Op = ConstantExpr::getCast(Op, IntPtrTy);
+ Instruction::CastOps opcode = Instruction::CastOps(CE->getOpcode());
+ if (opcode == Instruction::IntToPtr)
+ Op = ConstantExpr::getIntegerCast(Op, IntPtrTy, false /*ZExt*/);
+ else
+ Op = ConstantExpr::getCast(Instruction::PtrToInt, Op, IntPtrTy);
return EmitConstantValueOnly(Op);
}
Index: llvm/lib/CodeGen/IntrinsicLowering.cpp
diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.49 llvm/lib/CodeGen/IntrinsicLowering.cpp:1.50
--- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.49 Wed Dec 6 19:30:31 2006
+++ llvm/lib/CodeGen/IntrinsicLowering.cpp Mon Dec 11 19:17:40 2006
@@ -239,7 +239,7 @@
for (unsigned i = 1, ct = 0; i != BitSize; i <<= 1, ++ct) {
Value *MaskCst =
- ConstantExpr::getCast(ConstantInt::get(Type::ULongTy, MaskValues[ct]),
+ ConstantExpr::getTruncOrBitCast(ConstantInt::get(Type::ULongTy, MaskValues[ct]),
V->getType());
Value *LHS = BinaryOperator::createAnd(V, MaskCst, "cppop.and1", IP);
Value *VShift = new ShiftInst(Instruction::LShr, V,
Index: llvm/lib/CodeGen/MachineDebugInfo.cpp
diff -u llvm/lib/CodeGen/MachineDebugInfo.cpp:1.63 llvm/lib/CodeGen/MachineDebugInfo.cpp:1.64
--- llvm/lib/CodeGen/MachineDebugInfo.cpp:1.63 Thu Dec 7 14:04:42 2006
+++ llvm/lib/CodeGen/MachineDebugInfo.cpp Mon Dec 11 19:17:40 2006
@@ -292,7 +292,7 @@
if (GV) {
// Set to pointer to global.
- Elements.push_back(ConstantExpr::getCast(GV, EmptyTy));
+ Elements.push_back(ConstantExpr::getBitCast(GV, EmptyTy));
} else {
// Use NULL.
Elements.push_back(ConstantPointerNull::get(EmptyTy));
@@ -301,7 +301,7 @@
virtual void Apply(GlobalVariable *&Field) {
const PointerType *EmptyTy = SR.getEmptyStructPtrType();
if (Field) {
- Elements.push_back(ConstantExpr::getCast(Field, EmptyTy));
+ Elements.push_back(ConstantExpr::getBitCast(Field, EmptyTy));
} else {
Elements.push_back(ConstantPointerNull::get(EmptyTy));
}
@@ -315,7 +315,7 @@
for (unsigned i = 0, N = Field.size(); i < N; ++i) {
if (DebugInfoDesc *Element = Field[i]) {
GlobalVariable *GVE = SR.Serialize(Element);
- Constant *CE = ConstantExpr::getCast(GVE, EmptyTy);
+ Constant *CE = ConstantExpr::getBitCast(GVE, EmptyTy);
ArrayElements.push_back(cast<Constant>(CE));
} else {
ArrayElements.push_back(ConstantPointerNull::get(EmptyTy));
@@ -328,7 +328,7 @@
CA, "llvm.dbg.array",
SR.getModule());
CAGV->setSection("llvm.metadata");
- Constant *CAE = ConstantExpr::getCast(CAGV, EmptyTy);
+ Constant *CAE = ConstantExpr::getBitCast(CAGV, EmptyTy);
Elements.push_back(CAE);
}
};
@@ -1323,7 +1323,7 @@
ConstStr, "str", M);
StrGV->setSection("llvm.metadata");
// Convert to generic string pointer.
- Slot = ConstantExpr::getCast(StrGV, getStrPtrType());
+ Slot = ConstantExpr::getBitCast(StrGV, getStrPtrType());
}
return Slot;
More information about the llvm-commits
mailing list