diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2008-08-08 06:34:07 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2008-08-08 06:34:07 +0000 |
commit | 42a19b693398fdfe9b2e1d0065f4111d1a53cf58 (patch) | |
tree | c9693c92439a2c2d222b4f06365511aa735b36db /llvm/lib/CodeGen | |
parent | 93da7e6924b047a91ec25bef0a2e8fa0d3d37096 (diff) | |
download | bcm5719-llvm-42a19b693398fdfe9b2e1d0065f4111d1a53cf58.tar.gz bcm5719-llvm-42a19b693398fdfe9b2e1d0065f4111d1a53cf58.zip |
Don't crash printing the asm for a ConstantExpr PtrToInt just because the int
is narrower than the pointer. This testcase emits:
.byte (((17) - 16) & 255)
llvm-svn: 54517
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter.cpp index 366b8b398f9..1ee71bdc72b 100644 --- a/llvm/lib/CodeGen/AsmPrinter.cpp +++ b/llvm/lib/CodeGen/AsmPrinter.cpp @@ -821,12 +821,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 (Ty->isInteger() && - TD->getABITypeSize(Ty) >= TD->getABITypeSize(Op->getType())) + if (TD->getABITypeSize(Ty) >= TD->getABITypeSize(Op->getType())) return EmitConstantValueOnly(Op); - - assert(0 && "FIXME: Don't yet support this kind of constant cast expr"); + + O << "(("; EmitConstantValueOnly(Op); + APInt ptrMask = APInt::getAllOnesValue(TD->getABITypeSizeInBits(Ty)); + O << ") & " << ptrMask.toStringUnsigned() << ')'; break; } case Instruction::Add: |