[llvm-commits] [llvm] r75508 - in /llvm/trunk: include/llvm/Constants.h lib/CodeGen/MachOWriter.cpp lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp lib/Target/Mips/MipsISelLowering.cpp lib/Target/TargetAsmInfo.cpp lib/VMCore/Constants.cpp tools/lto/LTOModule.cpp
Owen Anderson
resistor at mac.com
Mon Jul 13 14:27:19 PDT 2009
Author: resistor
Date: Mon Jul 13 16:27:19 2009
New Revision: 75508
URL: http://llvm.org/viewvc/llvm-project?rev=75508&view=rev
Log:
As Chris pointed out, this doesn't actually need an LLVMContext to operate.
Modified:
llvm/trunk/include/llvm/Constants.h
llvm/trunk/lib/CodeGen/MachOWriter.cpp
llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp
llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp
llvm/trunk/lib/Target/TargetAsmInfo.cpp
llvm/trunk/lib/VMCore/Constants.cpp
llvm/trunk/tools/lto/LTOModule.cpp
Modified: llvm/trunk/include/llvm/Constants.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Constants.h?rev=75508&r1=75507&r2=75508&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Constants.h (original)
+++ llvm/trunk/include/llvm/Constants.h Mon Jul 13 16:27:19 2009
@@ -375,7 +375,7 @@
/// isString) and it ends in a null byte \0 and does not contains any other
/// @endverbatim
/// null bytes except its terminator.
- bool isCString(LLVMContext &Context) const;
+ bool isCString() const;
/// getAsString - If this array is isString(), then this method converts the
/// array to an std::string and returns it. Otherwise, it asserts out.
Modified: llvm/trunk/lib/CodeGen/MachOWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachOWriter.cpp?rev=75508&r1=75507&r2=75508&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachOWriter.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachOWriter.cpp Mon Jul 13 16:27:19 2009
@@ -123,7 +123,7 @@
// 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);
Modified: llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp?rev=75508&r1=75507&r2=75508&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp Mon Jul 13 16:27:19 2009
@@ -541,7 +541,7 @@
// 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:
Modified: llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp?rev=75508&r1=75507&r2=75508&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp Mon Jul 13 16:27:19 2009
@@ -227,7 +227,7 @@
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;
}
Modified: llvm/trunk/lib/Target/TargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetAsmInfo.cpp?rev=75508&r1=75507&r2=75508&view=diff
==============================================================================
--- llvm/trunk/lib/Target/TargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/TargetAsmInfo.cpp Mon Jul 13 16:27:19 2009
@@ -171,11 +171,11 @@
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 @@
}
} 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;
Modified: llvm/trunk/lib/VMCore/Constants.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Constants.cpp?rev=75508&r1=75507&r2=75508&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Constants.cpp (original)
+++ llvm/trunk/lib/VMCore/Constants.cpp Mon Jul 13 16:27:19 2009
@@ -1416,19 +1416,19 @@
/// 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;
Modified: llvm/trunk/tools/lto/LTOModule.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOModule.cpp?rev=75508&r1=75507&r2=75508&view=diff
==============================================================================
--- llvm/trunk/tools/lto/LTOModule.cpp (original)
+++ llvm/trunk/tools/lto/LTOModule.cpp Mon Jul 13 16:27:19 2009
@@ -189,7 +189,7 @@
if (GlobalVariable* gvn = dyn_cast<GlobalVariable>(op)) {
Constant* cn = gvn->getInitializer();
if (ConstantArray* ca = dyn_cast<ConstantArray>(cn)) {
- if ( ca->isCString(getGlobalContext()) ) {
+ if ( ca->isCString() ) {
name = ".objc_class_name_" + ca->getAsString();
return true;
}
More information about the llvm-commits
mailing list