diff options
author | Owen Anderson <resistor@mac.com> | 2009-07-13 21:27:19 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2009-07-13 21:27:19 +0000 |
commit | 1ca29d318a6632c115b9f62c791077b575494e42 (patch) | |
tree | 2b9e595e121059ef1a578089d6451f3b3b72589d /lib | |
parent | 43da8fbe524f4f1921209e6280678173393fb461 (diff) | |
download | external_llvm-1ca29d318a6632c115b9f62c791077b575494e42.zip external_llvm-1ca29d318a6632c115b9f62c791077b575494e42.tar.gz external_llvm-1ca29d318a6632c115b9f62c791077b575494e42.tar.bz2 |
As Chris pointed out, this doesn't actually need an LLVMContext to operate.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75508 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/CodeGen/MachOWriter.cpp | 2 | ||||
-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/VMCore/Constants.cpp | 8 |
5 files changed, 10 insertions, 10 deletions
diff --git a/lib/CodeGen/MachOWriter.cpp b/lib/CodeGen/MachOWriter.cpp index 35f7107..7542d9e 100644 --- a/lib/CodeGen/MachOWriter.cpp +++ b/lib/CodeGen/MachOWriter.cpp @@ -123,7 +123,7 @@ bool MachOWriter::doFinalization(Module &M) { // getConstSection - Get constant section for Constant 'C' MachOSection *MachOWriter::getConstSection(Constant *C) { const ConstantArray *CVA = dyn_cast<ConstantArray>(C); - if (CVA && CVA->isCString(*Context)) + if (CVA && CVA->isCString()) return getSection("__TEXT", "__cstring", MachOSection::S_CSTRING_LITERALS); diff --git a/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp b/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp index 89e9426..17c7640 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(GVar->getParent()->getContext())) + if (CVA && CVA->isCString()) printSizeAndType = false; break; case GlobalValue::GhostLinkage: diff --git a/lib/Target/Mips/MipsISelLowering.cpp b/lib/Target/Mips/MipsISelLowering.cpp index 3727918..f3fa179 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(GV->getParent()->getContext())) + if (CVA && CVA->isCString()) return false; } diff --git a/lib/Target/TargetAsmInfo.cpp b/lib/Target/TargetAsmInfo.cpp index 3df09bc..08ae2cf 100644 --- a/lib/Target/TargetAsmInfo.cpp +++ b/lib/Target/TargetAsmInfo.cpp @@ -171,11 +171,11 @@ static bool isSuitableForBSS(const GlobalVariable *GV) { return (C->isNullValue() && !GV->isConstant() && !NoZerosInBSS); } -static bool isConstantString(LLVMContext &Context, const Constant *C) { +static bool isConstantString(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(Context)) + if (CVA && CVA->isCString()) return true; // Another possibility: [1 x i8] zeroinitializer @@ -230,7 +230,7 @@ TargetAsmInfo::SectionKindForGlobal(const GlobalValue *GV) const { } } else { // Check, if initializer is a null-terminated string - if (isConstantString(GV->getParent()->getContext(), C)) + if (isConstantString(C)) return SectionKind::RODataMergeStr; else return SectionKind::RODataMergeConst; diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp index a1b4c93..184ae9d 100644 --- a/lib/VMCore/Constants.cpp +++ b/lib/VMCore/Constants.cpp @@ -1416,19 +1416,19 @@ bool ConstantArray::isString() const { /// isCString - This method returns true if the array is a string (see /// isString) and it ends in a null byte \\0 and does not contains any other /// null bytes except its terminator. -bool ConstantArray::isCString(LLVMContext &Context) const { +bool ConstantArray::isCString() const { // Check the element type for i8... if (getType()->getElementType() != Type::Int8Ty) return false; - Constant *Zero = Context.getNullValue(getOperand(0)->getType()); + // Last element must be a null. - if (getOperand(getNumOperands()-1) != Zero) + if (!getOperand(getNumOperands()-1)->isNullValue()) return false; // Other elements must be non-null integers. for (unsigned i = 0, e = getNumOperands()-1; i != e; ++i) { if (!isa<ConstantInt>(getOperand(i))) return false; - if (getOperand(i) == Zero) + if (getOperand(i)->isNullValue()) return false; } return true; |