summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/X86
diff options
context:
space:
mode:
authorBrian Gaeke <gaeke@uiuc.edu>2003-11-22 07:18:25 +0000
committerBrian Gaeke <gaeke@uiuc.edu>2003-11-22 07:18:25 +0000
commit84c0efc9460bb4e84da10736bcf3174fa3008c52 (patch)
tree8e3de3d6b55c7555164d47154755b5c0cb7cc23f /llvm/lib/Target/X86
parent9ba9225b35c19021aa8eea8400569f6c1ff20d15 (diff)
downloadbcm5719-llvm-84c0efc9460bb4e84da10736bcf3174fa3008c52.tar.gz
bcm5719-llvm-84c0efc9460bb4e84da10736bcf3174fa3008c52.zip
Support constant casting constant pointers to ints/uints, and/or
the other way around, instead of failing a large, tumor-like assertion. llvm-svn: 10171
Diffstat (limited to 'llvm/lib/Target/X86')
-rw-r--r--llvm/lib/Target/X86/Printer.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/llvm/lib/Target/X86/Printer.cpp b/llvm/lib/Target/X86/Printer.cpp
index 292a465e725..bf90064d2dc 100644
--- a/llvm/lib/Target/X86/Printer.cpp
+++ b/llvm/lib/Target/X86/Printer.cpp
@@ -185,15 +185,19 @@ void Printer::emitConstantValueOnly(const Constant *CV) {
}
case Instruction::Cast: {
// Support only non-converting or widening casts for now, that is, ones
- // that do not involve a change in value. This assertion is not a
- // complete check.
+ // that do not involve a change in value. This assertion is really gross,
+ // and may not even be a complete check.
Constant *Op = CE->getOperand(0);
const Type *OpTy = Op->getType(), *Ty = CE->getType();
+ // Remember, kids, pointers on x86 can be losslessly converted back and
+ // forth into 32-bit or wider integers, regardless of signedness. :-P
assert(((isa<PointerType>(OpTy)
- && (Ty == Type::LongTy || Ty == Type::ULongTy))
+ && (Ty == Type::LongTy || Ty == Type::ULongTy
+ || Ty == Type::IntTy || Ty == Type::UIntTy))
|| (isa<PointerType>(Ty)
- && (OpTy == Type::LongTy || OpTy == Type::ULongTy))
+ && (OpTy == Type::LongTy || OpTy == Type::ULongTy
+ || OpTy == Type::IntTy || OpTy == Type::UIntTy))
|| (((TD.getTypeSize(Ty) >= TD.getTypeSize(OpTy))
&& OpTy->isLosslesslyConvertibleTo(Ty))))
&& "FIXME: Don't yet support this kind of constant cast expr");
OpenPOWER on IntegriCloud