summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-08-01 22:25:12 +0000
committerChris Lattner <sabre@nondot.org>2009-08-01 22:25:12 +0000
commitb4b1012d2910775bec919f7c8bf5b6f3db39fc51 (patch)
tree146f2e106a2a84ef75403b04b73e7910fea4c93c /llvm/lib/CodeGen
parent5aa4952625b007e5d5a26772d4f654f2e74e0175 (diff)
downloadbcm5719-llvm-b4b1012d2910775bec919f7c8bf5b6f3db39fc51.tar.gz
bcm5719-llvm-b4b1012d2910775bec919f7c8bf5b6f3db39fc51.zip
fix a problem Eli noticed where we would compile the attached ptrtoint
to: .quad X even on a 32-bit system, where X is not 64-bits. There isn't much that we can do here, so we just print: .quad ((X) & 4294967295) instead. llvm-svn: 77818
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index f6d77309e1a..5168c45668f 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -910,6 +910,16 @@ void AsmPrinter::EmitConstantValueOnly(const Constant *CV) {
const TargetData *TD = TM.getTargetData();
unsigned Opcode = CE->getOpcode();
switch (Opcode) {
+ case Instruction::Trunc:
+ case Instruction::ZExt:
+ case Instruction::SExt:
+ case Instruction::FPTrunc:
+ case Instruction::FPExt:
+ case Instruction::UIToFP:
+ case Instruction::SIToFP:
+ case Instruction::FPToUI:
+ case Instruction::FPToSI:
+ llvm_unreachable("FIXME: Don't support this constant cast expr");
case Instruction::GetElementPtr: {
// generate a symbolic expression for the byte address
const Constant *ptrVal = CE->getOperand(0);
@@ -934,17 +944,6 @@ void AsmPrinter::EmitConstantValueOnly(const Constant *CV) {
}
break;
}
- case Instruction::Trunc:
- case Instruction::ZExt:
- case Instruction::SExt:
- case Instruction::FPTrunc:
- case Instruction::FPExt:
- case Instruction::UIToFP:
- case Instruction::SIToFP:
- case Instruction::FPToUI:
- case Instruction::FPToSI:
- llvm_unreachable("FIXME: Don't yet support this kind of constant cast expr");
- break;
case Instruction::BitCast:
return EmitConstantValueOnly(CE->getOperand(0));
@@ -965,12 +964,13 @@ void AsmPrinter::EmitConstantValueOnly(const Constant *CV) {
// We can emit the pointer value into this slot if the slot is an
// integer slot greater or equal to the size of the pointer.
- if (TD->getTypeAllocSize(Ty) >= TD->getTypeAllocSize(Op->getType()))
+ if (TD->getTypeAllocSize(Ty) == TD->getTypeAllocSize(Op->getType()))
return EmitConstantValueOnly(Op);
O << "((";
EmitConstantValueOnly(Op);
- APInt ptrMask = APInt::getAllOnesValue(TD->getTypeAllocSizeInBits(Ty));
+ APInt ptrMask =
+ APInt::getAllOnesValue(TD->getTypeAllocSizeInBits(Op->getType()));
SmallString<40> S;
ptrMask.toStringUnsigned(S);
OpenPOWER on IntegriCloud