diff options
author | Brian Gaeke <gaeke@uiuc.edu> | 2003-11-22 07:18:25 +0000 |
---|---|---|
committer | Brian Gaeke <gaeke@uiuc.edu> | 2003-11-22 07:18:25 +0000 |
commit | f9c86cf5cf3f7af65bbcb2e40d44903380d642e9 (patch) | |
tree | 08057f4c514296d6d5679e517e411a79c21dfd0a | |
parent | dfcc9cfaa877afd358c19dcd94410b4edcc09928 (diff) | |
download | external_llvm-f9c86cf5cf3f7af65bbcb2e40d44903380d642e9.zip external_llvm-f9c86cf5cf3f7af65bbcb2e40d44903380d642e9.tar.gz external_llvm-f9c86cf5cf3f7af65bbcb2e40d44903380d642e9.tar.bz2 |
Support constant casting constant pointers to ints/uints, and/or
the other way around, instead of failing a large, tumor-like assertion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10171 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Target/X86/Printer.cpp | 12 | ||||
-rw-r--r-- | lib/Target/X86/X86AsmPrinter.cpp | 12 |
2 files changed, 16 insertions, 8 deletions
diff --git a/lib/Target/X86/Printer.cpp b/lib/Target/X86/Printer.cpp index 292a465..bf90064 100644 --- a/lib/Target/X86/Printer.cpp +++ b/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"); diff --git a/lib/Target/X86/X86AsmPrinter.cpp b/lib/Target/X86/X86AsmPrinter.cpp index 292a465..bf90064 100644 --- a/lib/Target/X86/X86AsmPrinter.cpp +++ b/lib/Target/X86/X86AsmPrinter.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"); |