summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2015-05-21 19:20:38 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2015-05-21 19:20:38 +0000
commit0709a7bd1a75191a13580ca2a505fa0f7c4326bd (patch)
treed77dc6bcc145992fbd6a9deebe5e82c4aa553cae /llvm/lib/CodeGen
parent85d1965abd5e1d452e68e70473d856373c6ca845 (diff)
downloadbcm5719-llvm-0709a7bd1a75191a13580ca2a505fa0f7c4326bd.tar.gz
bcm5719-llvm-0709a7bd1a75191a13580ca2a505fa0f7c4326bd.zip
Move alignment from MCSectionData to MCSection.
This starts merging MCSection and MCSectionData. There are a few issues with the current split between MCSection and MCSectionData. * It optimizes the the not as important case. We want the production of .o files to be really fast, but the split puts the information used for .o emission in a separate data structure. * The ELF/COFF/MachO hierarchy is not represented in MCSectionData, leading to some ad-hoc ways to represent the various flags. * It makes it harder to remember where each item is. The attached patch starts merging the two by moving the alignment from MCSectionData to MCSection. Most of the patch is actually just dropping 'const', since MCSectionData is mutable, but MCSection was not. llvm-svn: 237936
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/AddressPool.cpp2
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/AddressPool.h2
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp28
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp25
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h4
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp7
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfFile.h5
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.cpp4
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.h4
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp2
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h6
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/EHStreamer.cpp2
-rw-r--r--llvm/lib/CodeGen/StackMaps.cpp4
-rw-r--r--llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp69
14 files changed, 76 insertions, 88 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AddressPool.cpp b/llvm/lib/CodeGen/AsmPrinter/AddressPool.cpp
index 4dc5e9f66b6..2487aba448c 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AddressPool.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AddressPool.cpp
@@ -24,7 +24,7 @@ unsigned AddressPool::getIndex(const MCSymbol *Sym, bool TLS) {
}
// Emit addresses into the section given.
-void AddressPool::emit(AsmPrinter &Asm, const MCSection *AddrSection) {
+void AddressPool::emit(AsmPrinter &Asm, MCSection *AddrSection) {
if (Pool.empty())
return;
diff --git a/llvm/lib/CodeGen/AsmPrinter/AddressPool.h b/llvm/lib/CodeGen/AsmPrinter/AddressPool.h
index 802e050cdf6..211fc98c7f6 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AddressPool.h
+++ b/llvm/lib/CodeGen/AsmPrinter/AddressPool.h
@@ -40,7 +40,7 @@ public:
/// label/symbol.
unsigned getIndex(const MCSymbol *Sym, bool TLS = false);
- void emit(AsmPrinter &Asm, const MCSection *AddrSection);
+ void emit(AsmPrinter &Asm, MCSection *AddrSection);
bool isEmpty() { return Pool.empty(); }
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 17bbf01c43f..206be702e72 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -405,8 +405,8 @@ void AsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) {
// Handle local BSS symbols.
if (MAI->hasMachoZeroFillDirective()) {
- const MCSection *TheSection =
- getObjFileLowering().SectionForGlobal(GV, GVKind, *Mang, TM);
+ MCSection *TheSection =
+ getObjFileLowering().SectionForGlobal(GV, GVKind, *Mang, TM);
// .zerofill __DATA, __bss, _foo, 400, 5
OutStreamer->EmitZerofill(TheSection, GVSym, Size, Align);
return;
@@ -434,8 +434,8 @@ void AsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) {
return;
}
- const MCSection *TheSection =
- getObjFileLowering().SectionForGlobal(GV, GVKind, *Mang, TM);
+ MCSection *TheSection =
+ getObjFileLowering().SectionForGlobal(GV, GVKind, *Mang, TM);
// Handle the zerofill directive on darwin, which is a special form of BSS
// emission.
@@ -479,8 +479,7 @@ void AsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) {
OutStreamer->AddBlankLine();
// Emit the variable struct for the runtime.
- const MCSection *TLVSect
- = getObjFileLowering().getTLSExtraDataSection();
+ MCSection *TLVSect = getObjFileLowering().getTLSExtraDataSection();
OutStreamer->SwitchSection(TLVSect);
// Emit the linkage here.
@@ -1122,7 +1121,7 @@ bool AsmPrinter::doFinalization(Module &M) {
// Emit __morestack address if needed for indirect calls.
if (MMI->usesMorestackAddr()) {
- const MCSection *ReadOnlySection =
+ MCSection *ReadOnlySection =
getObjFileLowering().getSectionForConstant(SectionKind::getReadOnly(),
/*C=*/nullptr);
OutStreamer->SwitchSection(ReadOnlySection);
@@ -1140,7 +1139,7 @@ bool AsmPrinter::doFinalization(Module &M) {
// to be executable. Some targets have a directive to declare this.
Function *InitTrampolineIntrinsic = M.getFunction("llvm.init.trampoline");
if (!InitTrampolineIntrinsic || InitTrampolineIntrinsic->use_empty())
- if (const MCSection *S = MAI->getNonexecutableStackSection(OutContext))
+ if (MCSection *S = MAI->getNonexecutableStackSection(OutContext))
OutStreamer->SwitchSection(S);
// Allow the target to emit any magic that it wants at the end of the file,
@@ -1182,12 +1181,12 @@ void AsmPrinter::SetupMachineFunction(MachineFunction &MF) {
}
namespace {
- // SectionCPs - Keep track the alignment, constpool entries per Section.
+// Keep track the alignment, constpool entries per Section.
struct SectionCPs {
- const MCSection *S;
+ MCSection *S;
unsigned Alignment;
SmallVector<unsigned, 4> CPEs;
- SectionCPs(const MCSection *s, unsigned a) : S(s), Alignment(a) {}
+ SectionCPs(MCSection *s, unsigned a) : S(s), Alignment(a) {}
};
}
@@ -1215,7 +1214,7 @@ void AsmPrinter::EmitConstantPool() {
if (!CPE.isMachineConstantPoolEntry())
C = CPE.Val.ConstVal;
- const MCSection *S = getObjFileLowering().getSectionForConstant(Kind, C);
+ MCSection *S = getObjFileLowering().getSectionForConstant(Kind, C);
// The number of sections are small, just do a linear search from the
// last section to the first.
@@ -1294,8 +1293,7 @@ void AsmPrinter::EmitJumpTableInfo() {
*F);
if (JTInDiffSection) {
// Drop it in the readonly section.
- const MCSection *ReadOnlySection =
- TLOF.getSectionForJumpTable(*F, *Mang, TM);
+ MCSection *ReadOnlySection = TLOF.getSectionForJumpTable(*F, *Mang, TM);
OutStreamer->SwitchSection(ReadOnlySection);
}
@@ -1539,7 +1537,7 @@ void AsmPrinter::EmitXXStructorList(const Constant *List, bool isCtor) {
KeySym = getSymbol(GV);
}
- const MCSection *OutputSection =
+ MCSection *OutputSection =
(isCtor ? Obj.getStaticCtorSection(S.Priority, KeySym)
: Obj.getStaticDtorSection(S.Priority, KeySym));
OutStreamer->SwitchSection(OutputSection);
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 7b7c8be372a..bc2917d42b3 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -1285,7 +1285,7 @@ void DwarfDebug::emitAbbreviations() {
Holder.emitAbbrevs(Asm->getObjFileLowering().getDwarfAbbrevSection());
}
-void DwarfDebug::emitAccel(DwarfAccelTable &Accel, const MCSection *Section,
+void DwarfDebug::emitAccel(DwarfAccelTable &Accel, MCSection *Section,
StringRef TableName) {
Accel.FinalizeTable(Asm, TableName);
Asm->OutStreamer->SwitchSection(Section);
@@ -1379,16 +1379,16 @@ static dwarf::PubIndexEntryDescriptor computeIndexValue(DwarfUnit *CU,
/// emitDebugPubNames - Emit visible names into a debug pubnames section.
///
void DwarfDebug::emitDebugPubNames(bool GnuStyle) {
- const MCSection *PSec =
- GnuStyle ? Asm->getObjFileLowering().getDwarfGnuPubNamesSection()
- : Asm->getObjFileLowering().getDwarfPubNamesSection();
+ MCSection *PSec = GnuStyle
+ ? Asm->getObjFileLowering().getDwarfGnuPubNamesSection()
+ : Asm->getObjFileLowering().getDwarfPubNamesSection();
emitDebugPubSection(GnuStyle, PSec, "Names",
&DwarfCompileUnit::getGlobalNames);
}
void DwarfDebug::emitDebugPubSection(
- bool GnuStyle, const MCSection *PSec, StringRef Name,
+ bool GnuStyle, MCSection *PSec, StringRef Name,
const StringMap<const DIE *> &(DwarfCompileUnit::*Accessor)() const) {
for (const auto &NU : CUMap) {
DwarfCompileUnit *TheU = NU.second;
@@ -1448,9 +1448,9 @@ void DwarfDebug::emitDebugPubSection(
}
void DwarfDebug::emitDebugPubTypes(bool GnuStyle) {
- const MCSection *PSec =
- GnuStyle ? Asm->getObjFileLowering().getDwarfGnuPubTypesSection()
- : Asm->getObjFileLowering().getDwarfPubTypesSection();
+ MCSection *PSec = GnuStyle
+ ? Asm->getObjFileLowering().getDwarfGnuPubTypesSection()
+ : Asm->getObjFileLowering().getDwarfPubTypesSection();
emitDebugPubSection(GnuStyle, PSec, "Types",
&DwarfCompileUnit::getGlobalTypes);
@@ -1611,13 +1611,13 @@ struct ArangeSpan {
// address we can tie back to a CU.
void DwarfDebug::emitDebugARanges() {
// Provides a unique id per text section.
- MapVector<const MCSection *, SmallVector<SymbolCU, 8>> SectionMap;
+ MapVector<MCSection *, SmallVector<SymbolCU, 8>> SectionMap;
// Filter labels by section.
for (const SymbolCU &SCU : ArangeLabels) {
if (SCU.Sym->isInSection()) {
// Make a note of this symbol and it's section.
- const MCSection *Section = &SCU.Sym->getSection();
+ MCSection *Section = &SCU.Sym->getSection();
if (!Section->getKind().isMetadata())
SectionMap[Section].push_back(SCU);
} else {
@@ -1630,7 +1630,7 @@ void DwarfDebug::emitDebugARanges() {
// Add terminating symbols for each section.
for (const auto &I : SectionMap) {
- const MCSection *Section = I.first;
+ MCSection *Section = I.first;
MCSymbol *Sym = nullptr;
if (Section)
@@ -1873,8 +1873,7 @@ void DwarfDebug::emitDebugLineDWO() {
// sections.
void DwarfDebug::emitDebugStrDWO() {
assert(useSplitDwarf() && "No split dwarf?");
- const MCSection *OffSec =
- Asm->getObjFileLowering().getDwarfStrOffDWOSection();
+ MCSection *OffSec = Asm->getObjFileLowering().getDwarfStrOffDWOSection();
InfoHolder.emitStrings(Asm->getObjFileLowering().getDwarfStrDWOSection(),
OffSec);
}
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
index 59024a78a7c..700f736009c 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
@@ -371,7 +371,7 @@ class DwarfDebug : public AsmPrinterHandler {
void emitAbbreviations();
/// \brief Emit a specified accelerator table.
- void emitAccel(DwarfAccelTable &Accel, const MCSection *Section,
+ void emitAccel(DwarfAccelTable &Accel, MCSection *Section,
StringRef TableName);
/// \brief Emit visible names into a hashed accelerator table section.
@@ -400,7 +400,7 @@ class DwarfDebug : public AsmPrinterHandler {
void emitDebugPubTypes(bool GnuStyle = false);
void emitDebugPubSection(
- bool GnuStyle, const MCSection *PSec, StringRef Name,
+ bool GnuStyle, MCSection *PSec, StringRef Name,
const StringMap<const DIE *> &(DwarfCompileUnit::*Accessor)() const);
/// \brief Emit visible names into a debug str section.
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp
index 1d6298c228a..10b58d4e86a 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp
@@ -50,7 +50,7 @@ void DwarfFile::addUnit(std::unique_ptr<DwarfUnit> U) {
void DwarfFile::emitUnits(bool UseOffsets) {
for (const auto &TheU : CUs) {
DIE &Die = TheU->getUnitDie();
- const MCSection *USection = TheU->getSection();
+ MCSection *USection = TheU->getSection();
Asm->OutStreamer->SwitchSection(USection);
TheU->emitHeader(UseOffsets);
@@ -120,7 +120,7 @@ unsigned DwarfFile::computeSizeAndOffset(DIE &Die, unsigned Offset) {
return Offset;
}
-void DwarfFile::emitAbbrevs(const MCSection *Section) {
+void DwarfFile::emitAbbrevs(MCSection *Section) {
// Check to see if it is worth the effort.
if (!Abbreviations.empty()) {
// Start the debug abbrev section.
@@ -130,8 +130,7 @@ void DwarfFile::emitAbbrevs(const MCSection *Section) {
}
// Emit strings into a string section.
-void DwarfFile::emitStrings(const MCSection *StrSection,
- const MCSection *OffsetSection) {
+void DwarfFile::emitStrings(MCSection *StrSection, MCSection *OffsetSection) {
StrPool.emit(*Asm, StrSection, OffsetSection);
}
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfFile.h b/llvm/lib/CodeGen/AsmPrinter/DwarfFile.h
index a3a5e99e3a8..27e6ff6036d 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfFile.h
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfFile.h
@@ -82,11 +82,10 @@ public:
void emitUnits(bool UseOffsets);
/// \brief Emit a set of abbreviations to the specific section.
- void emitAbbrevs(const MCSection *);
+ void emitAbbrevs(MCSection *);
/// \brief Emit all of the strings to the section given.
- void emitStrings(const MCSection *StrSection,
- const MCSection *OffsetSection = nullptr);
+ void emitStrings(MCSection *StrSection, MCSection *OffsetSection = nullptr);
/// \brief Returns the string pool.
DwarfStringPool &getStringPool() { return StrPool; }
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.cpp
index ee224f8b4d9..b7a421f5a1b 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.cpp
@@ -32,8 +32,8 @@ unsigned DwarfStringPool::getIndex(AsmPrinter &Asm, StringRef Str) {
return getEntry(Asm, Pool, Prefix, Str).second;
}
-void DwarfStringPool::emit(AsmPrinter &Asm, const MCSection *StrSection,
- const MCSection *OffsetSection) {
+void DwarfStringPool::emit(AsmPrinter &Asm, MCSection *StrSection,
+ MCSection *OffsetSection) {
if (Pool.empty())
return;
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.h b/llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.h
index 63e34123d85..9f32b98e2b3 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.h
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.h
@@ -32,8 +32,8 @@ public:
DwarfStringPool(BumpPtrAllocator &A, AsmPrinter &Asm, StringRef Prefix)
: Pool(A), Prefix(Prefix) {}
- void emit(AsmPrinter &Asm, const MCSection *StrSection,
- const MCSection *OffsetSection = nullptr);
+ void emit(AsmPrinter &Asm, MCSection *StrSection,
+ MCSection *OffsetSection = nullptr);
/// \brief Returns an entry into the string pool with the given
/// string text.
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
index ee233f710f2..47a8c6d8264 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
@@ -1513,7 +1513,7 @@ void DwarfUnit::emitHeader(bool UseOffsets) {
Asm->EmitInt8(Asm->getDataLayout().getPointerSize());
}
-void DwarfUnit::initSection(const MCSection *Section) {
+void DwarfUnit::initSection(MCSection *Section) {
assert(!this->Section);
this->Section = Section;
}
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h
index a0ea3c870c3..0d01a9e9fb3 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h
@@ -115,7 +115,7 @@ protected:
DIEInteger *DIEIntegerOne;
/// The section this unit will be emitted in.
- const MCSection *Section;
+ MCSection *Section;
DwarfUnit(unsigned UID, dwarf::Tag, const DICompileUnit *CU, AsmPrinter *A,
DwarfDebug *DW, DwarfFile *DWU);
@@ -132,9 +132,9 @@ protected:
public:
virtual ~DwarfUnit();
- void initSection(const MCSection *Section);
+ void initSection(MCSection *Section);
- const MCSection *getSection() const {
+ MCSection *getSection() const {
assert(Section);
return Section;
}
diff --git a/llvm/lib/CodeGen/AsmPrinter/EHStreamer.cpp b/llvm/lib/CodeGen/AsmPrinter/EHStreamer.cpp
index 6fd332cba54..1be3fd74d60 100644
--- a/llvm/lib/CodeGen/AsmPrinter/EHStreamer.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/EHStreamer.cpp
@@ -388,7 +388,7 @@ void EHStreamer::emitExceptionTable() {
}
// Type infos.
- const MCSection *LSDASection = Asm->getObjFileLowering().getLSDASection();
+ MCSection *LSDASection = Asm->getObjFileLowering().getLSDASection();
unsigned TTypeEncoding;
unsigned TypeFormatSize;
diff --git a/llvm/lib/CodeGen/StackMaps.cpp b/llvm/lib/CodeGen/StackMaps.cpp
index c1aa8c1d2a6..ffe59c19d3e 100644
--- a/llvm/lib/CodeGen/StackMaps.cpp
+++ b/llvm/lib/CodeGen/StackMaps.cpp
@@ -524,8 +524,8 @@ void StackMaps::serializeToStackMapSection() {
MCStreamer &OS = *AP.OutStreamer;
// Create the section.
- const MCSection *StackMapSection =
- OutContext.getObjectFileInfo()->getStackMapSection();
+ MCSection *StackMapSection =
+ OutContext.getObjectFileInfo()->getStackMapSection();
OS.SwitchSection(StackMapSection);
// Emit a dummy symbol to force section inclusion.
diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
index 69142d7902e..a32bdf8955c 100644
--- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
+++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
@@ -69,10 +69,8 @@ void TargetLoweringObjectFileELF::emitPersonalityValue(MCStreamer &Streamer,
StringRef Prefix = ".data.";
NameData.insert(NameData.begin(), Prefix.begin(), Prefix.end());
unsigned Flags = ELF::SHF_ALLOC | ELF::SHF_WRITE | ELF::SHF_GROUP;
- const MCSection *Sec = getContext().getELFSection(NameData,
- ELF::SHT_PROGBITS,
- Flags,
- 0, Label->getName());
+ MCSection *Sec = getContext().getELFSection(NameData, ELF::SHT_PROGBITS,
+ Flags, 0, Label->getName());
unsigned Size = TM.getDataLayout()->getPointerSize();
Streamer.SwitchSection(Sec);
Streamer.EmitValueToAlignment(TM.getDataLayout()->getPointerABIAlignment());
@@ -201,7 +199,7 @@ static const Comdat *getELFComdat(const GlobalValue *GV) {
return C;
}
-const MCSection *TargetLoweringObjectFileELF::getExplicitSectionGlobal(
+MCSection *TargetLoweringObjectFileELF::getExplicitSectionGlobal(
const GlobalValue *GV, SectionKind Kind, Mangler &Mang,
const TargetMachine &TM) const {
StringRef SectionName = GV->getSection();
@@ -245,7 +243,7 @@ static StringRef getSectionPrefixForGlobal(SectionKind Kind) {
return ".data.rel.ro";
}
-static const MCSectionELF *
+static MCSectionELF *
selectELFSectionForGlobal(MCContext &Ctx, const GlobalValue *GV,
SectionKind Kind, Mangler &Mang,
const TargetMachine &TM, bool EmitUniqueSection,
@@ -308,7 +306,7 @@ selectELFSectionForGlobal(MCContext &Ctx, const GlobalValue *GV,
EntrySize, Group, UniqueID);
}
-const MCSection *TargetLoweringObjectFileELF::SelectSectionForGlobal(
+MCSection *TargetLoweringObjectFileELF::SelectSectionForGlobal(
const GlobalValue *GV, SectionKind Kind, Mangler &Mang,
const TargetMachine &TM) const {
unsigned Flags = getELFSectionFlags(Kind);
@@ -328,7 +326,7 @@ const MCSection *TargetLoweringObjectFileELF::SelectSectionForGlobal(
EmitUniqueSection, Flags, &NextUniqueID);
}
-const MCSection *TargetLoweringObjectFileELF::getSectionForJumpTable(
+MCSection *TargetLoweringObjectFileELF::getSectionForJumpTable(
const Function &F, Mangler &Mang, const TargetMachine &TM) const {
// If the function can be removed, produce a unique section so that
// the table doesn't prevent the removal.
@@ -349,10 +347,9 @@ bool TargetLoweringObjectFileELF::shouldPutJumpTableInFunctionSection(
return false;
}
-/// getSectionForConstant - Given a mergeable constant with the
-/// specified size and relocation information, return a section that it
-/// should be placed in.
-const MCSection *
+/// Given a mergeable constant with the specified size and relocation
+/// information, return a section that it should be placed in.
+MCSection *
TargetLoweringObjectFileELF::getSectionForConstant(SectionKind Kind,
const Constant *C) const {
if (Kind.isMergeableConst4() && MergeableConst4Section)
@@ -369,11 +366,9 @@ TargetLoweringObjectFileELF::getSectionForConstant(SectionKind Kind,
return DataRelROSection;
}
-static const MCSectionELF *getStaticStructorSection(MCContext &Ctx,
- bool UseInitArray,
- bool IsCtor,
- unsigned Priority,
- const MCSymbol *KeySym) {
+static MCSectionELF *getStaticStructorSection(MCContext &Ctx, bool UseInitArray,
+ bool IsCtor, unsigned Priority,
+ const MCSymbol *KeySym) {
std::string Name;
unsigned Type;
unsigned Flags = ELF::SHF_ALLOC | ELF::SHF_WRITE;
@@ -411,13 +406,13 @@ static const MCSectionELF *getStaticStructorSection(MCContext &Ctx,
return Ctx.getELFSection(Name, Type, Flags, 0, COMDAT);
}
-const MCSection *TargetLoweringObjectFileELF::getStaticCtorSection(
+MCSection *TargetLoweringObjectFileELF::getStaticCtorSection(
unsigned Priority, const MCSymbol *KeySym) const {
return getStaticStructorSection(getContext(), UseInitArray, true, Priority,
KeySym);
}
-const MCSection *TargetLoweringObjectFileELF::getStaticDtorSection(
+MCSection *TargetLoweringObjectFileELF::getStaticDtorSection(
unsigned Priority, const MCSymbol *KeySym) const {
return getStaticStructorSection(getContext(), UseInitArray, false, Priority,
KeySym);
@@ -520,9 +515,8 @@ emitModuleFlags(MCStreamer &Streamer,
ErrorCode + ".");
// Get the section.
- const MCSectionMachO *S =
- getContext().getMachOSection(Segment, Section, TAA, StubSize,
- SectionKind::getDataNoRel());
+ MCSectionMachO *S = getContext().getMachOSection(
+ Segment, Section, TAA, StubSize, SectionKind::getDataNoRel());
Streamer.SwitchSection(S);
Streamer.EmitLabel(getContext().
getOrCreateSymbol(StringRef("L_OBJC_IMAGE_INFO")));
@@ -540,7 +534,7 @@ static void checkMachOComdat(const GlobalValue *GV) {
"' cannot be lowered.");
}
-const MCSection *TargetLoweringObjectFileMachO::getExplicitSectionGlobal(
+MCSection *TargetLoweringObjectFileMachO::getExplicitSectionGlobal(
const GlobalValue *GV, SectionKind Kind, Mangler &Mang,
const TargetMachine &TM) const {
// Parse the section specifier and create it if valid.
@@ -561,8 +555,8 @@ const MCSection *TargetLoweringObjectFileMachO::getExplicitSectionGlobal(
}
// Get the section.
- const MCSectionMachO *S =
- getContext().getMachOSection(Segment, Section, TAA, StubSize, Kind);
+ MCSectionMachO *S =
+ getContext().getMachOSection(Segment, Section, TAA, StubSize, Kind);
// If TAA wasn't set by ParseSectionSpecifier() above,
// use the value returned by getMachOSection() as a default.
@@ -582,9 +576,9 @@ const MCSection *TargetLoweringObjectFileMachO::getExplicitSectionGlobal(
return S;
}
-const MCSection *TargetLoweringObjectFileMachO::
-SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
- Mangler &Mang, const TargetMachine &TM) const {
+MCSection *TargetLoweringObjectFileMachO::SelectSectionForGlobal(
+ const GlobalValue *GV, SectionKind Kind, Mangler &Mang,
+ const TargetMachine &TM) const {
checkMachOComdat(GV);
// Handle thread local data.
@@ -649,7 +643,7 @@ SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
return DataSection;
}
-const MCSection *
+MCSection *
TargetLoweringObjectFileMachO::getSectionForConstant(SectionKind Kind,
const Constant *C) const {
// If this constant requires a relocation, we have to put it in the data
@@ -861,7 +855,7 @@ static int getSelectionForCOFF(const GlobalValue *GV) {
return 0;
}
-const MCSection *TargetLoweringObjectFileCOFF::getExplicitSectionGlobal(
+MCSection *TargetLoweringObjectFileCOFF::getExplicitSectionGlobal(
const GlobalValue *GV, SectionKind Kind, Mangler &Mang,
const TargetMachine &TM) const {
int Selection = 0;
@@ -903,10 +897,9 @@ static const char *getCOFFSectionNameForUniqueGlobal(SectionKind Kind) {
return ".data";
}
-
-const MCSection *TargetLoweringObjectFileCOFF::
-SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
- Mangler &Mang, const TargetMachine &TM) const {
+MCSection *TargetLoweringObjectFileCOFF::SelectSectionForGlobal(
+ const GlobalValue *GV, SectionKind Kind, Mangler &Mang,
+ const TargetMachine &TM) const {
// If we have -ffunction-sections then we should emit the global value to a
// uniqued section specifically for it.
bool EmitUniquedSection;
@@ -971,7 +964,7 @@ void TargetLoweringObjectFileCOFF::getNameWithPrefix(
Mang.getNameWithPrefix(OutName, GV, CannotUsePrivateLabel);
}
-const MCSection *TargetLoweringObjectFileCOFF::getSectionForJumpTable(
+MCSection *TargetLoweringObjectFileCOFF::getSectionForJumpTable(
const Function &F, Mangler &Mang, const TargetMachine &TM) const {
// If the function can be removed, produce a unique section so that
// the table doesn't prevent the removal.
@@ -1026,7 +1019,7 @@ emitModuleFlags(MCStreamer &Streamer,
// Emit the linker options to the linker .drectve section. According to the
// spec, this section is a space-separated string containing flags for linker.
- const MCSection *Sec = getDrectveSection();
+ MCSection *Sec = getDrectveSection();
Streamer.SwitchSection(Sec);
for (unsigned i = 0, e = LinkerOptions->getNumOperands(); i != e; ++i) {
MDNode *MDOptions = cast<MDNode>(LinkerOptions->getOperand(i));
@@ -1040,13 +1033,13 @@ emitModuleFlags(MCStreamer &Streamer,
}
}
-const MCSection *TargetLoweringObjectFileCOFF::getStaticCtorSection(
+MCSection *TargetLoweringObjectFileCOFF::getStaticCtorSection(
unsigned Priority, const MCSymbol *KeySym) const {
return getContext().getAssociativeCOFFSection(
cast<MCSectionCOFF>(StaticCtorSection), KeySym);
}
-const MCSection *TargetLoweringObjectFileCOFF::getStaticDtorSection(
+MCSection *TargetLoweringObjectFileCOFF::getStaticDtorSection(
unsigned Priority, const MCSymbol *KeySym) const {
return getContext().getAssociativeCOFFSection(
cast<MCSectionCOFF>(StaticDtorSection), KeySym);
OpenPOWER on IntegriCloud