diff options
Diffstat (limited to 'lib/Target')
-rw-r--r-- | lib/Target/CBackend/CBackend.cpp | 12 | ||||
-rw-r--r-- | lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp | 2 | ||||
-rw-r--r-- | lib/Target/Mips/MipsISelLowering.cpp | 2 | ||||
-rw-r--r-- | lib/Target/TargetAsmInfo.cpp | 6 | ||||
-rw-r--r-- | lib/Target/X86/X86FastISel.cpp | 4 | ||||
-rw-r--r-- | lib/Target/X86/X86InstrInfo.cpp | 3 |
6 files changed, 15 insertions, 14 deletions
diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp index f922146cd0..a403f2e9f1 100644 --- a/lib/Target/CBackend/CBackend.cpp +++ b/lib/Target/CBackend/CBackend.cpp @@ -1239,7 +1239,7 @@ void CWriter::printConstant(Constant *CPV, bool Static) { Out << '{'; if (AT->getNumElements()) { Out << ' '; - Constant *CZ = Constant::getNullValue(AT->getElementType()); + Constant *CZ = Context->getNullValue(AT->getElementType()); printConstant(CZ, Static); for (unsigned i = 1, e = AT->getNumElements(); i != e; ++i) { Out << ", "; @@ -1264,7 +1264,7 @@ void CWriter::printConstant(Constant *CPV, bool Static) { assert(isa<ConstantAggregateZero>(CPV) || isa<UndefValue>(CPV)); const VectorType *VT = cast<VectorType>(CPV->getType()); Out << "{ "; - Constant *CZ = Constant::getNullValue(VT->getElementType()); + Constant *CZ = Context->getNullValue(VT->getElementType()); printConstant(CZ, Static); for (unsigned i = 1, e = VT->getNumElements(); i != e; ++i) { Out << ", "; @@ -1286,10 +1286,10 @@ void CWriter::printConstant(Constant *CPV, bool Static) { Out << '{'; if (ST->getNumElements()) { Out << ' '; - printConstant(Constant::getNullValue(ST->getElementType(0)), Static); + printConstant(Context->getNullValue(ST->getElementType(0)), Static); for (unsigned i = 1, e = ST->getNumElements(); i != e; ++i) { Out << ", "; - printConstant(Constant::getNullValue(ST->getElementType(i)), Static); + printConstant(Context->getNullValue(ST->getElementType(i)), Static); } } Out << " }"; @@ -2621,11 +2621,11 @@ void CWriter::visitBinaryOperator(Instruction &I) { // If this is a negation operation, print it out as such. For FP, we don't // want to print "-0.0 - X". - if (BinaryOperator::isNeg(&I)) { + if (BinaryOperator::isNeg(*Context, &I)) { Out << "-("; writeOperand(BinaryOperator::getNegArgument(cast<BinaryOperator>(&I))); Out << ")"; - } else if (BinaryOperator::isFNeg(&I)) { + } else if (BinaryOperator::isFNeg(*Context, &I)) { Out << "-("; writeOperand(BinaryOperator::getFNegArgument(cast<BinaryOperator>(&I))); Out << ")"; diff --git a/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp b/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp index 17c7640e36..89e9426f24 100644 --- a/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp +++ b/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp @@ -541,7 +541,7 @@ printModuleLevelGV(const GlobalVariable* GVar) { // Fall Through case GlobalValue::PrivateLinkage: case GlobalValue::InternalLinkage: - if (CVA && CVA->isCString()) + if (CVA && CVA->isCString(GVar->getParent()->getContext())) printSizeAndType = false; break; case GlobalValue::GhostLinkage: diff --git a/lib/Target/Mips/MipsISelLowering.cpp b/lib/Target/Mips/MipsISelLowering.cpp index f3fa17938b..3727918eac 100644 --- a/lib/Target/Mips/MipsISelLowering.cpp +++ b/lib/Target/Mips/MipsISelLowering.cpp @@ -227,7 +227,7 @@ bool MipsTargetLowering::IsGlobalInSmallSection(GlobalValue *GV) if (GVA->hasInitializer() && GV->hasLocalLinkage()) { Constant *C = GVA->getInitializer(); const ConstantArray *CVA = dyn_cast<ConstantArray>(C); - if (CVA && CVA->isCString()) + if (CVA && CVA->isCString(GV->getParent()->getContext())) return false; } diff --git a/lib/Target/TargetAsmInfo.cpp b/lib/Target/TargetAsmInfo.cpp index 782e7b4d87..4fbe1ae55e 100644 --- a/lib/Target/TargetAsmInfo.cpp +++ b/lib/Target/TargetAsmInfo.cpp @@ -170,11 +170,11 @@ static bool isSuitableForBSS(const GlobalVariable *GV) { return (C->isNullValue() && !GV->isConstant() && !NoZerosInBSS); } -static bool isConstantString(const Constant *C) { +static bool isConstantString(LLVMContext &Context, const Constant *C) { // First check: is we have constant array of i8 terminated with zero const ConstantArray *CVA = dyn_cast<ConstantArray>(C); // Check, if initializer is a null-terminated string - if (CVA && CVA->isCString()) + if (CVA && CVA->isCString(Context)) return true; // Another possibility: [1 x i8] zeroinitializer @@ -229,7 +229,7 @@ TargetAsmInfo::SectionKindForGlobal(const GlobalValue *GV) const { } } else { // Check, if initializer is a null-terminated string - if (isConstantString(C)) + if (isConstantString(GV->getParent()->getContext(), C)) return SectionKind::RODataMergeStr; else return SectionKind::RODataMergeConst; diff --git a/lib/Target/X86/X86FastISel.cpp b/lib/Target/X86/X86FastISel.cpp index feb3d4c72e..2b3304d19c 100644 --- a/lib/Target/X86/X86FastISel.cpp +++ b/lib/Target/X86/X86FastISel.cpp @@ -272,7 +272,7 @@ bool X86FastISel::X86FastEmitStore(MVT VT, Value *Val, const X86AddressMode &AM) { // Handle 'null' like i32/i64 0. if (isa<ConstantPointerNull>(Val)) - Val = Constant::getNullValue(TD.getIntPtrType()); + Val = Context->getNullValue(TD.getIntPtrType()); // If this is a store of a simple constant, fold the constant into the store. if (ConstantInt *CI = dyn_cast<ConstantInt>(Val)) { @@ -672,7 +672,7 @@ bool X86FastISel::X86FastEmitCompare(Value *Op0, Value *Op1, MVT VT) { // Handle 'null' like i32/i64 0. if (isa<ConstantPointerNull>(Op1)) - Op1 = Constant::getNullValue(TD.getIntPtrType()); + Op1 = Context->getNullValue(TD.getIntPtrType()); // We have two options: compare with register or immediate. If the RHS of // the compare is an immediate that we can fold into this compare, use diff --git a/lib/Target/X86/X86InstrInfo.cpp b/lib/Target/X86/X86InstrInfo.cpp index 572b71dbc0..cb98c057c4 100644 --- a/lib/Target/X86/X86InstrInfo.cpp +++ b/lib/Target/X86/X86InstrInfo.cpp @@ -20,6 +20,7 @@ #include "X86TargetMachine.h" #include "llvm/GlobalVariable.h" #include "llvm/DerivedTypes.h" +#include "llvm/LLVMContext.h" #include "llvm/ADT/STLExtras.h" #include "llvm/CodeGen/MachineConstantPool.h" #include "llvm/CodeGen/MachineFrameInfo.h" @@ -2312,7 +2313,7 @@ MachineInstr* X86InstrInfo::foldMemoryOperandImpl(MachineFunction &MF, MachineConstantPool &MCP = *MF.getConstantPool(); const VectorType *Ty = VectorType::get(Type::Int32Ty, 4); Constant *C = LoadMI->getOpcode() == X86::V_SET0 ? - ConstantVector::getNullValue(Ty) : + MF.getFunction()->getContext()->getNullValue(Ty) : ConstantVector::getAllOnesValue(Ty); unsigned CPI = MCP.getConstantPoolIndex(C, 16); |