From 1d0be15f89cb5056e20e2d24faa8d6afb1573bca Mon Sep 17 00:00:00 2001 From: Owen Anderson Date: Thu, 13 Aug 2009 21:58:54 +0000 Subject: Push LLVMContexts through the IntegerType APIs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78948 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/ELFWriter.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'lib/CodeGen/ELFWriter.cpp') diff --git a/lib/CodeGen/ELFWriter.cpp b/lib/CodeGen/ELFWriter.cpp index 1518a34acb..e62079f947 100644 --- a/lib/CodeGen/ELFWriter.cpp +++ b/lib/CodeGen/ELFWriter.cpp @@ -440,15 +440,16 @@ void ELFWriter::EmitGlobalConstant(const Constant *CV, ELFSection &GblS) { return; } else if (const ConstantFP *CFP = dyn_cast(CV)) { APInt Val = CFP->getValueAPF().bitcastToAPInt(); - if (CFP->getType() == Type::DoubleTy) + if (CFP->getType() == Type::getDoubleTy(CV->getContext())) GblS.emitWord64(Val.getZExtValue()); - else if (CFP->getType() == Type::FloatTy) + else if (CFP->getType() == Type::getFloatTy(CV->getContext())) GblS.emitWord32(Val.getZExtValue()); - else if (CFP->getType() == Type::X86_FP80Ty) { - unsigned PadSize = TD->getTypeAllocSize(Type::X86_FP80Ty)- - TD->getTypeStoreSize(Type::X86_FP80Ty); + else if (CFP->getType() == Type::getX86_FP80Ty(CV->getContext())) { + unsigned PadSize = + TD->getTypeAllocSize(Type::getX86_FP80Ty(CV->getContext()))- + TD->getTypeStoreSize(Type::getX86_FP80Ty(CV->getContext())); GblS.emitWordFP80(Val.getRawData(), PadSize); - } else if (CFP->getType() == Type::PPC_FP128Ty) + } else if (CFP->getType() == Type::getPPC_FP128Ty(CV->getContext())) llvm_unreachable("PPC_FP128Ty global emission not implemented"); return; } else if (const ConstantInt *CI = dyn_cast(CV)) { @@ -526,7 +527,8 @@ CstExprResTy ELFWriter::ResolveConstantExpr(const Constant *CV) { } case Instruction::IntToPtr: { Constant *Op = CE->getOperand(0); - Op = ConstantExpr::getIntegerCast(Op, TD->getIntPtrType(), false/*ZExt*/); + Op = ConstantExpr::getIntegerCast(Op, TD->getIntPtrType(CV->getContext()), + false/*ZExt*/); return ResolveConstantExpr(Op); } case Instruction::PtrToInt: { -- cgit v1.2.3-70-g09d2