diff --git a/llvm/include/llvm/Target/DarwinTargetAsmInfo.h b/llvm/include/llvm/Target/DarwinTargetAsmInfo.h index 02f5834c97e8..69bc551970db 100644 --- a/llvm/include/llvm/Target/DarwinTargetAsmInfo.h +++ b/llvm/include/llvm/Target/DarwinTargetAsmInfo.h @@ -40,7 +40,8 @@ namespace llvm { Mangler *Mang) const; - virtual const Section *getSectionForMergableConstant(SectionKind Kind)const; + virtual const Section * + getSectionForMergeableConstant(SectionKind Kind) const; private: const Section* MergeableStringSection(const GlobalVariable *GV) const; diff --git a/llvm/include/llvm/Target/ELFTargetAsmInfo.h b/llvm/include/llvm/Target/ELFTargetAsmInfo.h index 6744b49adf6f..854217f6e8df 100644 --- a/llvm/include/llvm/Target/ELFTargetAsmInfo.h +++ b/llvm/include/llvm/Target/ELFTargetAsmInfo.h @@ -25,11 +25,11 @@ namespace llvm { struct ELFTargetAsmInfo: public TargetAsmInfo { explicit ELFTargetAsmInfo(const TargetMachine &TM); - /// getSectionForMergableConstant - Given a mergable constant with the + /// getSectionForMergeableConstant - Given a mergeable constant with the /// specified size and relocation information, return a section that it /// should be placed in. virtual const Section * - getSectionForMergableConstant(SectionKind Kind) const; + getSectionForMergeableConstant(SectionKind Kind) const; /// getFlagsForNamedSection - If this target wants to be able to infer /// section flags based on the name of the section specified for a global @@ -48,9 +48,9 @@ namespace llvm { const Section *DataRelROSection; const Section *DataRelROLocalSection; - const Section *MergableConst4Section; - const Section *MergableConst8Section; - const Section *MergableConst16Section; + const Section *MergeableConst4Section; + const Section *MergeableConst8Section; + const Section *MergeableConst16Section; private: const Section *MergeableStringSection(const GlobalVariable *GV) const; diff --git a/llvm/include/llvm/Target/TargetAsmInfo.h b/llvm/include/llvm/Target/TargetAsmInfo.h index 6345396f645a..89cb5ae692de 100644 --- a/llvm/include/llvm/Target/TargetAsmInfo.h +++ b/llvm/include/llvm/Target/TargetAsmInfo.h @@ -45,38 +45,38 @@ namespace llvm { /// ReadOnly - Data that is never written to at program runtime by the /// program or the dynamic linker. Things in the top-level readonly - /// SectionKind are not mergable. + /// SectionKind are not mergeable. ReadOnly, - /// MergableCString - This is a special section for nul-terminated + /// MergeableCString - This is a special section for nul-terminated /// strings. The linker can unique the C strings, knowing their /// semantics. Because it uniques based on the nul terminators, the /// compiler can't put strings in this section that have embeded nuls /// in them. - MergableCString, + MergeableCString, - /// MergableConst - These are sections for merging fixed-length + /// MergeableConst - These are sections for merging fixed-length /// constants together. For example, this can be used to unique /// constant pool entries etc. - MergableConst, + MergeableConst, - /// MergableConst4 - This is a section used by 4-byte constants, + /// MergeableConst4 - This is a section used by 4-byte constants, /// for example, floats. - MergableConst4, + MergeableConst4, - /// MergableConst8 - This is a section used by 8-byte constants, + /// MergeableConst8 - This is a section used by 8-byte constants, /// for example, doubles. - MergableConst8, + MergeableConst8, - /// MergableConst16 - This is a section used by 16-byte constants, + /// MergeableConst16 - This is a section used by 16-byte constants, /// for example, vectors. - MergableConst16, + MergeableConst16, - /// Writable - This is the base of all segments that need to be written + /// Writeable - This is the base of all segments that need to be written /// to during program runtime. /// ThreadLocal - This is the base of all TLS segments. All TLS - /// objects must be writable, otherwise there is no reason for them to + /// objects must be writeable, otherwise there is no reason for them to /// be thread local! /// ThreadBSS - Zero-initialized TLS data objects. @@ -85,10 +85,10 @@ namespace llvm { /// ThreadData - Initialized TLS data objects. ThreadData, - /// GlobalWritableData - Writable data that is global (not thread + /// GlobalWriteableData - Writeable data that is global (not thread /// local). - /// BSS - Zero initialized writable data. + /// BSS - Zero initialized writeable data. BSS, /// DataRel - This is the most general form of data that is written @@ -96,54 +96,59 @@ namespace llvm { /// globals. DataRel, - /// DataRelLocal - This is writable data that has a non-zero + /// DataRelLocal - This is writeable data that has a non-zero /// initializer and has relocations in it, but all of the /// relocations are known to be within the final linked image /// the global is linked into. DataRelLocal, - /// DataNoRel - This is writable data that has a non-zero + /// DataNoRel - This is writeable data that has a non-zero /// initializer, but whose initializer is known to have no /// relocations. DataNoRel, /// ReadOnlyWithRel - These are global variables that are never /// written to by the program, but that have relocations, so they - /// must be stuck in a writable section so that the dynamic linker + /// must be stuck in a writeable section so that the dynamic linker /// can write to them. If it chooses to, the dynamic linker can /// mark the pages these globals end up on as read-only after it is /// done with its relocation phase. ReadOnlyWithRel, /// ReadOnlyWithRelLocal - This is data that is readonly by the - /// program, but must be writable so that the dynamic linker + /// program, but must be writeable so that the dynamic linker /// can perform relocations in it. This is used when we know /// that all the relocations are to globals in this final /// linked image. ReadOnlyWithRelLocal - } K : 8; // This is private. + }; + + //private: + Kind K : 8; // This is private. + + //public: bool isText() const { return K == Text; } bool isReadOnly() const { - return K == ReadOnly || K == MergableCString || isMergableConst(); + return K == ReadOnly || K == MergeableCString || isMergeableConst(); } - bool isMergableCString() const { return K == MergableCString; } - bool isMergableConst() const { - return K == MergableConst || K == MergableConst4 || - K == MergableConst8 || K == MergableConst16; + bool isMergeableCString() const { return K == MergeableCString; } + bool isMergeableConst() const { + return K == MergeableConst || K == MergeableConst4 || + K == MergeableConst8 || K == MergeableConst16; } - bool isMergableConst4() const { return K == MergableConst4; } - bool isMergableConst8() const { return K == MergableConst8; } - bool isMergableConst16() const { return K == MergableConst16; } + bool isMergeableConst4() const { return K == MergeableConst4; } + bool isMergeableConst8() const { return K == MergeableConst8; } + bool isMergeableConst16() const { return K == MergeableConst16; } - bool isWritable() const { - return isThreadLocal() || isGlobalWritableData(); + bool isWriteable() const { + return isThreadLocal() || isGlobalWriteableData(); } bool isThreadLocal() const { @@ -153,7 +158,7 @@ namespace llvm { bool isThreadBSS() const { return K == ThreadBSS; } bool isThreadData() const { return K == ThreadData; } - bool isGlobalWritableData() const { + bool isGlobalWriteableData() const { return isBSS() || isDataRel() || isReadOnlyWithRel(); } @@ -187,7 +192,7 @@ namespace llvm { const unsigned Invalid = -1U; const unsigned None = 0; const unsigned Code = 1 << 0; ///< Section contains code - const unsigned Writable = 1 << 1; ///< Section is writable + const unsigned Writable = 1 << 1; ///< Section is writeable const unsigned BSS = 1 << 2; ///< Section contains only zeroes const unsigned Mergeable = 1 << 3; ///< Section contains mergeable data const unsigned Strings = 1 << 4; ///< Section contains C-type strings @@ -690,10 +695,10 @@ namespace llvm { bool Global) const; - /// getSectionForMergableConstant - Given a mergable constant with the + /// getSectionForMergeableConstant - Given a Mergeable constant with the /// specified size and relocation information, return a section that it /// should be placed in. - virtual const Section *getSectionForMergableConstant(SectionKind Kind)const; + virtual const Section *getSectionForMergeableConstant(SectionKind Kind)const; /// getSectionPrefixForUniqueGlobal - Return a string that we should prepend diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index d82710fb10f8..5da01a225094 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -315,14 +315,14 @@ void AsmPrinter::EmitConstantPool(MachineConstantPool *MCP) { case 1: Kind = SectionKind::get(SectionKind::ReadOnlyWithRelLocal); break; case 0: switch (TM.getTargetData()->getTypeAllocSize(CPE.getType())) { - case 4: Kind = SectionKind::get(SectionKind::MergableConst4); break; - case 8: Kind = SectionKind::get(SectionKind::MergableConst8); break; - case 16: Kind = SectionKind::get(SectionKind::MergableConst16); break; - default: Kind = SectionKind::get(SectionKind::MergableConst); break; + case 4: Kind = SectionKind::get(SectionKind::MergeableConst4); break; + case 8: Kind = SectionKind::get(SectionKind::MergeableConst8); break; + case 16: Kind = SectionKind::get(SectionKind::MergeableConst16); break; + default: Kind = SectionKind::get(SectionKind::MergeableConst); break; } } - const Section *S = TAI->getSectionForMergableConstant(Kind); + const Section *S = TAI->getSectionForMergeableConstant(Kind); // The number of sections are small, just do a linear search from the // last section to the first. diff --git a/llvm/lib/CodeGen/ELFWriter.cpp b/llvm/lib/CodeGen/ELFWriter.cpp index f34f86b4f4b0..97b7ff0c8d96 100644 --- a/llvm/lib/CodeGen/ELFWriter.cpp +++ b/llvm/lib/CodeGen/ELFWriter.cpp @@ -161,15 +161,14 @@ ELFSection &ELFWriter::getConstantPoolSection(MachineConstantPoolEntry &CPE) { case 1: Kind = SectionKind::get(SectionKind::ReadOnlyWithRelLocal); break; case 0: switch (TM.getTargetData()->getTypeAllocSize(CPE.getType())) { - case 4: Kind = SectionKind::get(SectionKind::MergableConst4); break; - case 8: Kind = SectionKind::get(SectionKind::MergableConst8); break; - case 16: Kind = SectionKind::get(SectionKind::MergableConst16); break; - default: Kind = SectionKind::get(SectionKind::MergableConst); break; + case 4: Kind = SectionKind::get(SectionKind::MergeableConst4); break; + case 8: Kind = SectionKind::get(SectionKind::MergeableConst8); break; + case 16: Kind = SectionKind::get(SectionKind::MergeableConst16); break; + default: Kind = SectionKind::get(SectionKind::MergeableConst); break; } } - std::string CstPoolName = TAI->getSectionForMergableConstant(Kind)->getName(); - return getSection(CstPoolName, + return getSection(TAI->getSectionForMergeableConstant(Kind)->getName(), ELFSection::SHT_PROGBITS, ELFSection::SHF_MERGE | ELFSection::SHF_ALLOC, CPE.getAlignment()); diff --git a/llvm/lib/Target/DarwinTargetAsmInfo.cpp b/llvm/lib/Target/DarwinTargetAsmInfo.cpp index 778aa22e8858..503df19a3ff5 100644 --- a/llvm/lib/Target/DarwinTargetAsmInfo.cpp +++ b/llvm/lib/Target/DarwinTargetAsmInfo.cpp @@ -144,21 +144,21 @@ DarwinTargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV, } // FIXME: Alignment check should be handled by section classifier. - if (Kind.isMergableCString()) + if (Kind.isMergeableCString()) return MergeableStringSection(cast(GV)); - if (Kind.isMergableConst()) { - if (Kind.isMergableConst4()) + if (Kind.isMergeableConst()) { + if (Kind.isMergeableConst4()) return FourByteConstantSection; - if (Kind.isMergableConst8()) + if (Kind.isMergeableConst8()) return EightByteConstantSection; - if (Kind.isMergableConst16() && SixteenByteConstantSection) + if (Kind.isMergeableConst16() && SixteenByteConstantSection) return SixteenByteConstantSection; return ReadOnlySection; // .const } // FIXME: ROData -> const in -static mode that is relocatable but they happen - // by the static linker. Why not mergable? + // by the static linker. Why not mergeable? if (Kind.isReadOnly()) return getReadOnlySection(); @@ -188,17 +188,17 @@ DarwinTargetAsmInfo::MergeableStringSection(const GlobalVariable *GV) const { } const Section * -DarwinTargetAsmInfo::getSectionForMergableConstant(SectionKind Kind) const { +DarwinTargetAsmInfo::getSectionForMergeableConstant(SectionKind Kind) const { // If this constant requires a relocation, we have to put it in the data // segment, not in the text segment. if (Kind.isDataRel()) return ConstDataSection; - if (Kind.isMergableConst4()) + if (Kind.isMergeableConst4()) return FourByteConstantSection; - if (Kind.isMergableConst8()) + if (Kind.isMergeableConst8()) return EightByteConstantSection; - if (Kind.isMergableConst16() && SixteenByteConstantSection) + if (Kind.isMergeableConst16() && SixteenByteConstantSection) return SixteenByteConstantSection; return ReadOnlySection; // .const } diff --git a/llvm/lib/Target/ELFTargetAsmInfo.cpp b/llvm/lib/Target/ELFTargetAsmInfo.cpp index 5d8d720cda0f..258542c31ed3 100644 --- a/llvm/lib/Target/ELFTargetAsmInfo.cpp +++ b/llvm/lib/Target/ELFTargetAsmInfo.cpp @@ -44,11 +44,11 @@ ELFTargetAsmInfo::ELFTargetAsmInfo(const TargetMachine &TM) DataRelROLocalSection = getNamedSection("\t.data.rel.ro.local", SectionFlags::Writable); - MergableConst4Section = getNamedSection(".rodata.cst4", + MergeableConst4Section = getNamedSection(".rodata.cst4", SectionFlags::setEntitySize(SectionFlags::Mergeable, 4)); - MergableConst8Section = getNamedSection(".rodata.cst8", + MergeableConst8Section = getNamedSection(".rodata.cst8", SectionFlags::setEntitySize(SectionFlags::Mergeable, 8)); - MergableConst16Section = getNamedSection(".rodata.cst16", + MergeableConst16Section = getNamedSection(".rodata.cst16", SectionFlags::setEntitySize(SectionFlags::Mergeable, 16)); } @@ -57,16 +57,16 @@ const Section* ELFTargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind) const { if (Kind.isText()) return TextSection; - if (Kind.isMergableCString()) + if (Kind.isMergeableCString()) return MergeableStringSection(cast(GV)); - if (Kind.isMergableConst()) { - if (Kind.isMergableConst4()) - return MergableConst4Section; - if (Kind.isMergableConst8()) - return MergableConst8Section; - if (Kind.isMergableConst16()) - return MergableConst16Section; + if (Kind.isMergeableConst()) { + if (Kind.isMergeableConst4()) + return MergeableConst4Section; + if (Kind.isMergeableConst8()) + return MergeableConst8Section; + if (Kind.isMergeableConst16()) + return MergeableConst16Section; return ReadOnlySection; // .const } @@ -88,11 +88,11 @@ ELFTargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV, return DataRelROSection; } -/// getSectionForMergableConstant - Given a mergable constant with the +/// getSectionForMergeableConstant - Given a Mergeable constant with the /// specified size and relocation information, return a section that it /// should be placed in. const Section * -ELFTargetAsmInfo::getSectionForMergableConstant(SectionKind Kind) const { +ELFTargetAsmInfo::getSectionForMergeableConstant(SectionKind Kind) const { return SelectSectionForGlobal(0, Kind); } diff --git a/llvm/lib/Target/TargetAsmInfo.cpp b/llvm/lib/Target/TargetAsmInfo.cpp index c8471021f459..205a34d97ab8 100644 --- a/llvm/lib/Target/TargetAsmInfo.cpp +++ b/llvm/lib/Target/TargetAsmInfo.cpp @@ -211,7 +211,7 @@ static unsigned SectionFlagsForGlobal(const GlobalValue *GV, Flags |= SectionFlags::TLS; if (Kind.isText()) Flags |= SectionFlags::Code; - if (Kind.isWritable()) + if (Kind.isWriteable()) Flags |= SectionFlags::Writable; return Flags; @@ -252,16 +252,16 @@ static SectionKind SectionKindForGlobal(const GlobalValue *GV, // If initializer is a null-terminated string, put it in a "cstring" // section if the target has it. if (isConstantString(C)) - return SectionKind::get(SectionKind::MergableCString); + return SectionKind::get(SectionKind::MergeableCString); // Otherwise, just drop it into a mergable constant section. If we have // a section for this size, use it, otherwise use the arbitrary sized // mergable section. switch (TM.getTargetData()->getTypeAllocSize(C->getType())) { - case 4: return SectionKind::get(SectionKind::MergableConst4); - case 8: return SectionKind::get(SectionKind::MergableConst8); - case 16: return SectionKind::get(SectionKind::MergableConst16); - default: return SectionKind::get(SectionKind::MergableConst); + case 4: return SectionKind::get(SectionKind::MergeableConst4); + case 8: return SectionKind::get(SectionKind::MergeableConst8); + case 16: return SectionKind::get(SectionKind::MergeableConst16); + default: return SectionKind::get(SectionKind::MergeableConst); } case Constant::LocalRelocation: @@ -377,7 +377,7 @@ TargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV, /// specified size and relocation information, return a section that it /// should be placed in. const Section * -TargetAsmInfo::getSectionForMergableConstant(SectionKind Kind) const { +TargetAsmInfo::getSectionForMergeableConstant(SectionKind Kind) const { if (Kind.isReadOnly()) if (const Section *S = getReadOnlySection()) return S; diff --git a/llvm/lib/Target/X86/X86TargetAsmInfo.cpp b/llvm/lib/Target/X86/X86TargetAsmInfo.cpp index 9e7973aaa056..5de9d6961470 100644 --- a/llvm/lib/Target/X86/X86TargetAsmInfo.cpp +++ b/llvm/lib/Target/X86/X86TargetAsmInfo.cpp @@ -269,7 +269,7 @@ const char *X86COFFTargetAsmInfo:: getSectionPrefixForUniqueGlobal(SectionKind Kind) const { if (Kind.isText()) return ".text$linkonce"; - if (Kind.isWritable()) + if (Kind.isWriteable()) return ".data$linkonce"; return ".rdata$linkonce"; }