Add SwitchSection to return switchSection. The API will be removed soon.
MCSymbol *ColdStartLabel = LocalCtx->createTempSymbol();
MCSymbol *ColdEndLabel = LocalCtx->createTempSymbol();
- Streamer->SwitchSection(Section);
+ Streamer->switchSection(Section);
Streamer->emitLabel(StartLabel);
emitFunctionBody(*Streamer, BF, /*EmitColdPart=*/false,
/*EmitCodeOnly=*/true);
ELF::SHF_EXECINSTR | ELF::SHF_ALLOC);
ColdSection->setHasInstructions(true);
- Streamer->SwitchSection(ColdSection);
+ Streamer->switchSection(ColdSection);
Streamer->emitLabel(ColdStartLabel);
emitFunctionBody(*Streamer, BF, /*EmitColdPart=*/true,
/*EmitCodeOnly=*/true);
Streamer->emitLabel(ColdEndLabel);
// To avoid calling MCObjectStreamer::flushPendingLabels() which is private
Streamer->emitBytes(StringRef(""));
- Streamer->SwitchSection(Section);
+ Streamer->switchSection(Section);
}
// To avoid calling MCObjectStreamer::flushPendingLabels() which is private or
// Mark the start of hot text.
if (opts::HotText) {
- Streamer.SwitchSection(BC.getTextSection());
+ Streamer.switchSection(BC.getTextSection());
Streamer.emitLabel(BC.getHotTextStartSymbol());
}
// Mark the end of hot text.
if (opts::HotText) {
- Streamer.SwitchSection(BC.getTextSection());
+ Streamer.switchSection(BC.getTextSection());
Streamer.emitLabel(BC.getHotTextEndSymbol());
}
}
MCSection *Section =
BC.getCodeSection(EmitColdPart ? Function.getColdCodeSectionName()
: Function.getCodeSectionName());
- Streamer.SwitchSection(Section);
+ Streamer.switchSection(Section);
Section->setHasInstructions(true);
BC.Ctx->addGenDwarfSection(Section);
}
LabelCounts[CurrentLabel] = CurrentLabelCount;
} else {
- Streamer.SwitchSection(JT.Count > 0 ? HotSection : ColdSection);
+ Streamer.switchSection(JT.Count > 0 ? HotSection : ColdSection);
Streamer.emitValueToAlignment(JT.EntrySize);
}
MCSymbol *LastLabel = nullptr;
LLVM_DEBUG(dbgs() << "BOLT-DEBUG: jump table count: "
<< LabelCounts[LI->second] << '\n');
if (LabelCounts[LI->second] > 0)
- Streamer.SwitchSection(HotSection);
+ Streamer.switchSection(HotSection);
else
- Streamer.SwitchSection(ColdSection);
+ Streamer.switchSection(ColdSection);
Streamer.emitValueToAlignment(JT.EntrySize);
}
Streamer.emitLabel(LI->second);
for (const BinaryFunction::CallSite &CallSite : *Sites)
CallSiteTableLength += getULEB128Size(CallSite.Action);
- Streamer.SwitchSection(BC.MOFI->getLSDASection());
+ Streamer.switchSection(BC.MOFI->getLSDASection());
const unsigned TTypeEncoding = BC.TTypeEncoding;
const unsigned TTypeEncodingSize = BC.getDWARFEncodingSize(TTypeEncoding);
MCSectionELF *ELFSection =
BC.Ctx->getELFSection(SectionName, getELFType(), getELFFlags());
- Streamer.SwitchSection(ELFSection);
+ Streamer.switchSection(ELFSection);
Streamer.emitValueToAlignment(getAlignment());
if (BC.HasRelocations && opts::HotData && isReordered())
}
// Switch to the section where the table will be emitted into.
- Streamer.SwitchSection(BC.MOFI->getDwarfLineSection());
+ Streamer.switchSection(BC.MOFI->getDwarfLineSection());
const uint16_t DwarfVersion = BC.Ctx->getDwarfVersion();
// Handle the rest of the Compile Units.
if (SectionIter == KnownSections.end())
return None;
- Streamer.SwitchSection(SectionIter->second.first);
+ Streamer.switchSection(SectionIter->second.first);
StringRef OutData = SectionContents;
uint32_t DWPOffset = 0;
const DWARFUnitIndex::Entry::SectionContribution *V2) -> bool {
return V1->Offset < V2->Offset;
});
- Streamer.SwitchSection(MCOFI.getDwarfInfoDWOSection());
+ Streamer.switchSection(MCOFI.getDwarfInfoDWOSection());
for (const auto *C : TUContributions)
Streamer.emitBytes(Contents.slice(C->Offset, C->Offset + C->Length));
}
MCSymbol *InitPtr = BC.Ctx->getOrCreateSymbol("__bolt_hugify_init_ptr");
Section->setAlignment(llvm::Align(BC.RegularPageSize));
- Streamer.SwitchSection(Section);
+ Streamer.switchSection(Section);
Streamer.emitLabel(InitPtr);
Streamer.emitSymbolAttribute(InitPtr, MCSymbolAttr::MCSA_Global);
}
Section->setAlignment(llvm::Align(BC.RegularPageSize));
- Streamer.SwitchSection(Section);
+ Streamer.switchSection(Section);
// EmitOffset is used to determine padding size for data alignment
uint64_t EmitOffset = 0;
MCSection *TablesSection = BC.Ctx->getMachOSection(
"__BOLT", "__tables", MachO::S_REGULAR, SectionKind::getData());
TablesSection->setAlignment(llvm::Align(BC.RegularPageSize));
- Streamer.SwitchSection(TablesSection);
+ Streamer.switchSection(TablesSection);
emitString("__bolt_instr_tables", buildTables(BC));
}
}
if (Opts.EmbedBitcode && Ctx.getObjectFileType() == MCContext::IsMachO) {
MCSection *AsmLabel = Ctx.getMachOSection(
"__LLVM", "__asm", MachO::S_REGULAR, 4, SectionKind::getReadOnly());
- Str.get()->SwitchSection(AsmLabel);
+ Str.get()->switchSection(AsmLabel);
Str.get()->emitZeros(1);
}
is *implemented* in different ways (e.g. to output a .s file, output an ELF .o
file, etc) but whose API correspond directly to what you see in a .s file.
MCStreamer has one method per directive, such as EmitLabel, EmitSymbolAttribute,
-SwitchSection, EmitValue (for .byte, .word), etc, which directly correspond to
+switchSection, emitValue (for .byte, .word), etc, which directly correspond to
assembly level directives. It also has an EmitInstruction method, which is used
to output an MCInst to the streamer.
MCStreamer class. This is an abstract API that is implemented in different ways
(e.g. to output a .s file, output an ELF .o file, etc) that is effectively an
"assembler API". MCStreamer has one method per directive, such as EmitLabel,
-EmitSymbolAttribute, SwitchSection, etc, which directly correspond to assembly
+EmitSymbolAttribute, switchSection, etc, which directly correspond to assembly
level directives.
If you are interested in implementing a code generator for a target, there are
unsigned IntPtrSize = AP.getPointerSize();
// Put this in the data section.
- OS.SwitchSection(AP.getObjFileLowering().getDataSection());
+ OS.switchSection(AP.getObjFileLowering().getDataSection());
// For each function...
for (iterator FI = begin(), FE = end(); FI != FE; ++FI) {
auto Pair = Pool.insert(std::make_pair(Str, Offset));
if (Pair.second) {
- Out.SwitchSection(Sec);
+ Out.switchSection(Sec);
Out.emitBytes(StringRef(Str, Length));
Offset += Length;
}
/// Update streamer for a new active section.
///
- /// This is called by popSection and SwitchSection, if the current
+ /// This is called by popSection and switchSection, if the current
/// section changes.
virtual void changeSection(const MCSection *CurSection, MCSection *Section,
const MCExpr *SubSection, raw_ostream &OS);
/// Update streamer for a new active section.
///
- /// This is called by popSection and SwitchSection, if the current
+ /// This is called by popSection and switchSection, if the current
/// section changes.
virtual void changeSection(MCSection *, const MCExpr *);
if (SectionStack.empty())
return false;
- SwitchSection(SectionStack.back().first.first, Subsection);
+ switchSection(SectionStack.back().first.first, Subsection);
return true;
}
/// is required to update CurSection.
///
/// This corresponds to assembler directives like .section, .text, etc.
- virtual void SwitchSection(MCSection *Section,
+ virtual void switchSection(MCSection *Section,
const MCExpr *Subsection = nullptr);
+ void SwitchSection(MCSection *Section, const MCExpr *Subsection = nullptr) {
+ switchSection(Section, Subsection);
+ }
/// Set the current section where code is being emitted to \p Section.
/// This is required to update CurSection. This version does not call
EHInfo = Asm->OutContext.getXCOFFSection(NameStr, EHInfo->getKind(),
EHInfo->getCsectProp());
}
- Asm->OutStreamer->SwitchSection(EHInfo);
+ Asm->OutStreamer->switchSection(EHInfo);
MCSymbol *EHInfoLabel =
TargetLoweringObjectFileXCOFF::getEHInfoTableSymbol(Asm->MF);
Asm->OutStreamer->emitLabel(EHInfoLabel);
if (CompUnits.empty())
return;
- Asm->OutStreamer->SwitchSection(
+ Asm->OutStreamer->switchSection(
Asm->getObjFileLowering().getDwarfDebugNamesSection());
Contents.finalize(Asm, "names");
return;
// Start the dwarf addr section.
- Asm.OutStreamer->SwitchSection(AddrSection);
+ Asm.OutStreamer->switchSection(AddrSection);
MCSymbol *EndLabel = nullptr;
TheSection = getObjFileLowering().getTLSBSSSection();
OutStreamer->emitTBSSSymbol(TheSection, MangSym, Size, Alignment.value());
} else if (GVKind.isThreadData()) {
- OutStreamer->SwitchSection(TheSection);
+ OutStreamer->switchSection(TheSection);
emitAlignment(Alignment, GV);
OutStreamer->emitLabel(MangSym);
// Emit the variable struct for the runtime.
MCSection *TLVSect = getObjFileLowering().getTLSExtraDataSection();
- OutStreamer->SwitchSection(TLVSect);
+ OutStreamer->switchSection(TLVSect);
// Emit the linkage here.
emitLinkage(GV, GVSym);
OutStreamer->emitLabel(GVSym);
MCSymbol *EmittedInitSym = GVSym;
- OutStreamer->SwitchSection(TheSection);
+ OutStreamer->switchSection(TheSection);
emitLinkage(GV, EmittedInitSym);
emitAlignment(Alignment, GV);
MF->setSection(getObjFileLowering().getUniqueSectionForFunction(F, TM));
else
MF->setSection(getObjFileLowering().SectionForGlobal(&F, TM));
- OutStreamer->SwitchSection(MF->getSection());
+ OutStreamer->switchSection(MF->getSection());
if (!MAI->hasVisibilityOnlyWithLinkage())
emitVisibility(CurrentFnSym, F.getVisibility());
const MCSymbol *FunctionSymbol = getFunctionBegin();
OutStreamer->pushSection();
- OutStreamer->SwitchSection(BBAddrMapSection);
+ OutStreamer->switchSection(BBAddrMapSection);
OutStreamer->emitSymbolValue(FunctionSymbol, getPointerSize());
// Emit the total number of basic blocks in this function.
OutStreamer->emitULEB128IntValue(MF.size());
return;
OutStreamer->pushSection();
- OutStreamer->SwitchSection(StackSizeSection);
+ OutStreamer->switchSection(StackSizeSection);
const MCSymbol *FunctionSymbol = getFunctionBegin();
uint64_t StackSize =
}
// Switch to the original section in case basic block sections was used.
- OutStreamer->SwitchSection(MF->getSection());
+ OutStreamer->switchSection(MF->getSection());
const Function &F = MF->getFunction();
for (const auto &BB : F) {
// Switch to the remarks section.
MCSection *RemarksSection =
OutContext.getObjectFileInfo()->getRemarksSection();
- OutStreamer->SwitchSection(RemarksSection);
+ OutStreamer->switchSection(RemarksSection);
OutStreamer->emitBinaryData(OS.str());
}
// Output stubs for external and common global variables.
MachineModuleInfoELF::SymbolListTy Stubs = MMIELF.GetGVStubList();
if (!Stubs.empty()) {
- OutStreamer->SwitchSection(TLOF.getDataSection());
+ OutStreamer->switchSection(TLOF.getDataSection());
const DataLayout &DL = M.getDataLayout();
emitAlignment(Align(DL.getPointerSize()));
for (const auto &Stub : Stubs) {
SmallString<256> SectionName = StringRef(".rdata$");
SectionName += Stub.first->getName();
- OutStreamer->SwitchSection(OutContext.getCOFFSection(
+ OutStreamer->switchSection(OutContext.getCOFFSection(
SectionName,
COFF::IMAGE_SCN_CNT_INITIALIZED_DATA | COFF::IMAGE_SCN_MEM_READ |
COFF::IMAGE_SCN_LNK_COMDAT,
// Emit .note.GNU-split-stack and .note.GNU-no-split-stack sections if
// split-stack is used.
if (TM.getTargetTriple().isOSBinFormatELF() && HasSplitStack) {
- OutStreamer->SwitchSection(
- OutContext.getELFSection(".note.GNU-split-stack", ELF::SHT_PROGBITS, 0));
+ OutStreamer->switchSection(OutContext.getELFSection(".note.GNU-split-stack",
+ ELF::SHT_PROGBITS, 0));
if (HasNoSplitStack)
- OutStreamer->SwitchSection(
- OutContext.getELFSection(".note.GNU-no-split-stack", ELF::SHT_PROGBITS, 0));
+ OutStreamer->switchSection(OutContext.getELFSection(
+ ".note.GNU-no-split-stack", ELF::SHT_PROGBITS, 0));
}
// If we don't have any trampolines, then we don't require stack memory
Function *InitTrampolineIntrinsic = M.getFunction("llvm.init.trampoline");
if (!InitTrampolineIntrinsic || InitTrampolineIntrinsic->use_empty())
if (MCSection *S = MAI->getNonexecutableStackSection(OutContext))
- OutStreamer->SwitchSection(S);
+ OutStreamer->switchSection(S);
if (TM.Options.EmitAddrsig) {
// Emit address-significance attributes for all globals.
GV.getVisibility() != GlobalValue::DefaultVisibility)
continue;
- OutStreamer->SwitchSection(
+ OutStreamer->switchSection(
OutContext.getELFSection(".llvm_sympart", ELF::SHT_LLVM_SYMPART, 0, 0,
"", false, ++UniqueID, nullptr));
OutStreamer->emitBytes(GV.getPartition());
continue;
if (CurSection != CPSections[i].S) {
- OutStreamer->SwitchSection(CPSections[i].S);
+ OutStreamer->switchSection(CPSections[i].S);
emitAlignment(Align(CPSections[i].Alignment));
CurSection = CPSections[i].S;
Offset = 0;
if (JTInDiffSection) {
// Drop it in the readonly section.
MCSection *ReadOnlySection = TLOF.getSectionForJumpTable(F, TM);
- OutStreamer->SwitchSection(ReadOnlySection);
+ OutStreamer->switchSection(ReadOnlySection);
}
emitAlignment(Align(MJTI->getEntryAlignment(DL)));
MCSection *OutputSection =
(IsCtor ? Obj.getStaticCtorSection(S.Priority, KeySym)
: Obj.getStaticDtorSection(S.Priority, KeySym));
- OutStreamer->SwitchSection(OutputSection);
+ OutStreamer->switchSection(OutputSection);
if (OutStreamer->getCurrentSection() != OutStreamer->getPreviousSection())
emitAlignment(Align);
emitXXStructor(DL, S.Func);
return;
OutStreamer->pushSection();
- OutStreamer->SwitchSection(CommandLine);
+ OutStreamer->switchSection(CommandLine);
OutStreamer->emitZeros(1);
for (unsigned i = 0, e = NMD->getNumOperands(); i != e; ++i) {
const MDNode *N = NMD->getOperand(i);
// entry block is always placed in the function section and is handled
// separately.
if (MBB.isBeginSection() && !MBB.isEntryBlock()) {
- OutStreamer->SwitchSection(
+ OutStreamer->switchSection(
getObjFileLowering().getSectionForMachineBasicBlock(MF->getFunction(),
MBB, TM));
CurrentSectionBeginSym = MBB.getSymbol();
// range of sleds associated with a function.
auto &Ctx = OutContext;
MCSymbol *SledsStart = OutContext.createTempSymbol("xray_sleds_start", true);
- OutStreamer->SwitchSection(InstMap);
+ OutStreamer->switchSection(InstMap);
OutStreamer->emitLabel(SledsStart);
for (const auto &Sled : Sleds) {
MCSymbol *Dot = Ctx.createTempSymbol();
// Each entry here will be 2 * word size aligned, as we're writing down two
// pointers. This should work for both 32-bit and 64-bit platforms.
if (FnSledIndex) {
- OutStreamer->SwitchSection(FnSledIndex);
+ OutStreamer->switchSection(FnSledIndex);
OutStreamer->emitCodeAlignment(2 * WordSizeBytes, &getSubtargetInfo());
OutStreamer->emitSymbolValue(SledsStart, WordSizeBytes, false);
OutStreamer->emitSymbolValue(SledsEnd, WordSizeBytes, false);
- OutStreamer->SwitchSection(PrevSection);
+ OutStreamer->switchSection(PrevSection);
}
Sleds.clear();
}
}
LinkedToSym = cast<MCSymbolELF>(CurrentFnSym);
}
- OutStreamer->SwitchSection(OutContext.getELFSection(
+ OutStreamer->switchSection(OutContext.getELFSection(
"__patchable_function_entries", ELF::SHT_PROGBITS, Flags, 0, GroupName,
F.hasComdat(), MCSection::NonUniqueID, LinkedToSym));
emitAlignment(Align(PointerSize));
return;
// Start the .debug$T or .debug$P section with 0x4.
- OS.SwitchSection(Asm->getObjFileLowering().getCOFFDebugTypesSection());
+ OS.switchSection(Asm->getObjFileLowering().getCOFFDebugTypesSection());
emitCodeViewMagicVersion();
TypeTableCollection Table(TypeTable.records());
// Start the .debug$H section with the version and hash algorithm, currently
// hardcoded to version 0, SHA1.
- OS.SwitchSection(Asm->getObjFileLowering().getCOFFGlobalTypeHashesSection());
+ OS.switchSection(Asm->getObjFileLowering().getCOFFGlobalTypeHashesSection());
OS.emitValueToAlignment(4);
OS.AddComment("Magic");
Asm->getObjFileLowering().getCOFFDebugSymbolsSection());
DebugSec = OS.getContext().getAssociativeCOFFSection(DebugSec, KeySym);
- OS.SwitchSection(DebugSec);
+ OS.switchSection(DebugSec);
// Emit the magic version number if this is the first time we've switched to
// this section.
void DIEAbbrevSet::Emit(const AsmPrinter *AP, MCSection *Section) const {
if (!Abbreviations.empty()) {
// Start the debug abbrev section.
- AP->OutStreamer->SwitchSection(Section);
+ AP->OutStreamer->switchSection(Section);
AP->emitDwarfAbbrevs(Abbreviations);
}
}
template <typename AccelTableT>
void DwarfDebug::emitAccel(AccelTableT &Accel, MCSection *Section,
StringRef TableName) {
- Asm->OutStreamer->SwitchSection(Section);
+ Asm->OutStreamer->switchSection(Section);
// Emit the full data.
emitAppleAccelTable(Asm, Accel, TableName, Section->getBeginSymbol());
bool GnuStyle = TheU->getCUNode()->getNameTableKind() ==
DICompileUnit::DebugNameTableKind::GNU;
- Asm->OutStreamer->SwitchSection(
+ Asm->OutStreamer->switchSection(
GnuStyle ? Asm->getObjFileLowering().getDwarfGnuPubNamesSection()
: Asm->getObjFileLowering().getDwarfPubNamesSection());
emitDebugPubSection(GnuStyle, "Names", TheU, TheU->getGlobalNames());
- Asm->OutStreamer->SwitchSection(
+ Asm->OutStreamer->switchSection(
GnuStyle ? Asm->getObjFileLowering().getDwarfGnuPubTypesSection()
: Asm->getObjFileLowering().getDwarfPubTypesSection());
emitDebugPubSection(GnuStyle, "Types", TheU, TheU->getGlobalTypes());
if (DebugLocs.getLists().empty())
return;
- Asm->OutStreamer->SwitchSection(Sec);
+ Asm->OutStreamer->switchSection(Sec);
MCSymbol *TableEnd = nullptr;
if (getDwarfVersion() >= 5)
}
for (const auto &List : DebugLocs.getLists()) {
- Asm->OutStreamer->SwitchSection(
+ Asm->OutStreamer->switchSection(
Asm->getObjFileLowering().getDwarfLocDWOSection());
Asm->OutStreamer->emitLabel(List.Label);
}
// Start the dwarf aranges section.
- Asm->OutStreamer->SwitchSection(
+ Asm->OutStreamer->switchSection(
Asm->getObjFileLowering().getDwarfARangesSection());
unsigned PtrSize = Asm->MAI->getCodePointerSize();
return !Pair.second->getCUNode()->isDebugDirectivesOnly();
}));
- Asm->OutStreamer->SwitchSection(Section);
+ Asm->OutStreamer->switchSection(Section);
MCSymbol *TableEnd = nullptr;
if (getDwarfVersion() >= 5)
DIMacroNodeArray Macros = CUNode->getMacros();
if (Macros.empty())
continue;
- Asm->OutStreamer->SwitchSection(Section);
+ Asm->OutStreamer->switchSection(Section);
Asm->OutStreamer->emitLabel(U.getMacroLabelBegin());
if (UseDebugMacroSection)
emitMacroHeader(Asm, *this, U, getDwarfVersion());
if (llvm::empty(TheU->getUnitDie().values()))
return;
- Asm->OutStreamer->SwitchSection(S);
+ Asm->OutStreamer->switchSection(S);
TheU->emitHeader(UseOffsets);
Asm->emitDwarfDIE(TheU->getUnitDie());
MCSymbol *StartSym) {
if (getNumIndexedStrings() == 0)
return;
- Asm.OutStreamer->SwitchSection(Section);
+ Asm.OutStreamer->switchSection(Section);
unsigned EntrySize = Asm.getDwarfOffsetByteSize();
// We are emitting the header for a contribution to the string offsets
// table. The header consists of an entry with the contribution's
return;
// Start the dwarf str section.
- Asm.OutStreamer->SwitchSection(StrSection);
+ Asm.OutStreamer->switchSection(StrSection);
// Get all of the string pool entries and sort them by their offset.
SmallVector<const StringMapEntry<EntryTy> *, 64> Entries;
Entries[Entry.getValue().Index] = &Entry;
}
- Asm.OutStreamer->SwitchSection(OffsetSection);
+ Asm.OutStreamer->switchSection(OffsetSection);
unsigned size = Asm.getDwarfOffsetByteSize();
for (const auto &Entry : Entries)
if (UseRelativeOffsets)
// Sometimes we want not to emit the data into separate section (e.g. ARM
// EHABI). In this case LSDASection will be NULL.
if (LSDASection)
- Asm->OutStreamer->SwitchSection(LSDASection);
+ Asm->OutStreamer->switchSection(LSDASection);
Asm->emitAlignment(Align(4));
// Emit the LSDA.
unsigned IntPtrSize = M.getDataLayout().getPointerSize();
// Put this in a custom .note section.
- OS.SwitchSection(
- AP.getObjFileLowering().getContext().getELFSection(".note.gc",
- ELF::SHT_PROGBITS, 0));
+ OS.switchSection(AP.getObjFileLowering().getContext().getELFSection(
+ ".note.gc", ELF::SHT_PROGBITS, 0));
// For each function...
for (GCModuleInfo::FuncInfoVec::iterator FI = Info.funcinfo_begin(),
void OcamlGCMetadataPrinter::beginAssembly(Module &M, GCModuleInfo &Info,
AsmPrinter &AP) {
- AP.OutStreamer->SwitchSection(AP.getObjFileLowering().getTextSection());
+ AP.OutStreamer->switchSection(AP.getObjFileLowering().getTextSection());
EmitCamlGlobal(M, AP, "code_begin");
- AP.OutStreamer->SwitchSection(AP.getObjFileLowering().getDataSection());
+ AP.OutStreamer->switchSection(AP.getObjFileLowering().getDataSection());
EmitCamlGlobal(M, AP, "data_begin");
}
AsmPrinter &AP) {
unsigned IntPtrSize = M.getDataLayout().getPointerSize();
- AP.OutStreamer->SwitchSection(AP.getObjFileLowering().getTextSection());
+ AP.OutStreamer->switchSection(AP.getObjFileLowering().getTextSection());
EmitCamlGlobal(M, AP, "code_end");
- AP.OutStreamer->SwitchSection(AP.getObjFileLowering().getDataSection());
+ AP.OutStreamer->switchSection(AP.getObjFileLowering().getDataSection());
EmitCamlGlobal(M, AP, "data_end");
// FIXME: Why does ocaml emit this??
AP.OutStreamer->emitIntValue(0, IntPtrSize);
- AP.OutStreamer->SwitchSection(AP.getObjFileLowering().getDataSection());
+ AP.OutStreamer->switchSection(AP.getObjFileLowering().getDataSection());
EmitCamlGlobal(M, AP, "frametable");
int NumDescriptors = 0;
// Emit the symbol index of each GFIDs entry to form the .gfids section.
auto &OS = *Asm->OutStreamer;
- OS.SwitchSection(Asm->OutContext.getObjectFileInfo()->getGFIDsSection());
+ OS.switchSection(Asm->OutContext.getObjectFileInfo()->getGFIDsSection());
for (const MCSymbol *S : GFIDsEntries)
OS.emitCOFFSymbolIndex(S);
// Emit the symbol index of each GIATs entry to form the .giats section.
- OS.SwitchSection(Asm->OutContext.getObjectFileInfo()->getGIATsSection());
+ OS.switchSection(Asm->OutContext.getObjectFileInfo()->getGIATsSection());
for (const MCSymbol *S : GIATsEntries) {
OS.emitCOFFSymbolIndex(S);
}
// Emit the symbol index of each longjmp target to form the .gljmp section.
- OS.SwitchSection(Asm->OutContext.getObjectFileInfo()->getGLJMPSection());
+ OS.switchSection(Asm->OutContext.getObjectFileInfo()->getGLJMPSection());
for (const MCSymbol *S : LongjmpTargets) {
OS.emitCOFFSymbolIndex(S);
}
if (M->getModuleFlag("ehcontguard") && !EHContTargets.empty()) {
// Emit the symbol index of each ehcont target.
- OS.SwitchSection(Asm->OutContext.getObjectFileInfo()->getGEHContSection());
+ OS.switchSection(Asm->OutContext.getObjectFileInfo()->getGEHContSection());
for (const MCSymbol *S : EHContTargets) {
OS.emitCOFFSymbolIndex(S);
}
// Just switch sections to the right xdata section.
MCSection *XData = Asm->OutStreamer->getAssociatedXDataSection(
Asm->OutStreamer->getCurrentSectionOnly());
- Asm->OutStreamer->SwitchSection(XData);
+ Asm->OutStreamer->switchSection(XData);
// Emit the tables appropriate to the personality function in use. If we
// don't recognize the personality, assume it uses an Itanium-style LSDA.
void WinException::endFunclet() {
if (isAArch64 && CurrentFuncletEntry &&
(shouldEmitMoves || shouldEmitPersonality)) {
- Asm->OutStreamer->SwitchSection(CurrentFuncletTextSection);
+ Asm->OutStreamer->switchSection(CurrentFuncletTextSection);
Asm->OutStreamer->emitWinCFIFuncletOrFuncEnd();
}
endFuncletImpl();
// Switch back to the funclet start .text section now that we are done
// writing to .xdata, and emit an .seh_endproc directive to mark the end of
// the function.
- Asm->OutStreamer->SwitchSection(CurrentFuncletTextSection);
+ Asm->OutStreamer->switchSection(CurrentFuncletTextSection);
Asm->OutStreamer->emitWinCFIEndProc();
}
// Create the section.
MCSection *FaultMapSection =
OutContext.getObjectFileInfo()->getFaultMapSection();
- OS.SwitchSection(FaultMapSection);
+ OS.switchSection(FaultMapSection);
// Emit a dummy symbol to force section inclusion.
OS.emitLabel(OutContext.getOrCreateSymbol(Twine("__LLVM_FaultMaps")));
// Create the section.
MCSection *StackMapSection =
OutContext.getObjectFileInfo()->getStackMapSection();
- OS.SwitchSection(StackMapSection);
+ OS.switchSection(StackMapSection);
// Emit a dummy symbol to force section inclusion.
OS.emitLabel(OutContext.getOrCreateSymbol(Twine("__LLVM_StackMaps")));
auto *S = C.getELFSection(".linker-options", ELF::SHT_LLVM_LINKER_OPTIONS,
ELF::SHF_EXCLUDE);
- Streamer.SwitchSection(S);
+ Streamer.switchSection(S);
for (const auto *Operand : LinkerOptions->operands()) {
if (cast<MDNode>(Operand)->getNumOperands() != 2)
auto *S = C.getELFSection(".deplibs", ELF::SHT_LLVM_DEPENDENT_LIBRARIES,
ELF::SHF_MERGE | ELF::SHF_STRINGS, 1);
- Streamer.SwitchSection(S);
+ Streamer.switchSection(S);
for (const auto *Operand : DependentLibraries->operands()) {
Streamer.emitBytes(
auto *S = C.getObjectFileInfo()->getPseudoProbeDescSection(
TM->getFunctionSections() ? Name->getString() : StringRef());
- Streamer.SwitchSection(S);
+ Streamer.switchSection(S);
Streamer.emitInt64(GUID->getZExtValue());
Streamer.emitInt64(Hash->getZExtValue());
Streamer.emitULEB128IntValue(Name->getString().size());
GetObjCImageInfo(M, Version, Flags, Section);
if (!Section.empty()) {
auto *S = C.getELFSection(Section, ELF::SHT_PROGBITS, ELF::SHF_ALLOC);
- Streamer.SwitchSection(S);
+ Streamer.switchSection(S);
Streamer.emitLabel(C.getOrCreateSymbol(StringRef("OBJC_IMAGE_INFO")));
Streamer.emitInt32(Version);
Streamer.emitInt32(Flags);
MCSection *Sec = getContext().getELFNamedSection(".data", Label->getName(),
ELF::SHT_PROGBITS, Flags, 0);
unsigned Size = DL.getPointerSize();
- Streamer.SwitchSection(Sec);
+ Streamer.switchSection(Sec);
Streamer.emitValueToAlignment(DL.getPointerABIAlignment(0).value());
Streamer.emitSymbolAttribute(Label, MCSA_ELF_TypeObject);
const MCExpr *E = MCConstantExpr::create(Size, getContext());
// Get the section.
MCSectionMachO *S = getContext().getMachOSection(
Segment, Section, TAA, StubSize, SectionKind::getData());
- Streamer.SwitchSection(S);
+ Streamer.switchSection(S);
Streamer.emitLabel(getContext().
getOrCreateSymbol(StringRef("L_OBJC_IMAGE_INFO")));
Streamer.emitInt32(VersionVal);
COFF::IMAGE_SCN_CNT_INITIALIZED_DATA |
COFF::IMAGE_SCN_MEM_READ,
SectionKind::getReadOnly());
- Streamer.SwitchSection(S);
+ Streamer.switchSection(S);
Streamer.emitLabel(C.getOrCreateSymbol(StringRef("OBJC_IMAGE_INFO")));
Streamer.emitInt32(Version);
Streamer.emitInt32(Flags);
// spec, this section is a space-separated string containing flags for
// linker.
MCSection *Sec = getDrectveSection();
- Streamer.SwitchSection(Sec);
+ Streamer.switchSection(Sec);
for (const auto *Option : LinkerOptions->operands()) {
for (const auto &Piece : cast<MDNode>(Option)->operands()) {
// Lead with a space for consistency with our dllexport implementation.
getMangler());
OS.flush();
if (!Flags.empty()) {
- Streamer.SwitchSection(getDrectveSection());
+ Streamer.switchSection(getDrectveSection());
Streamer.emitBytes(Flags);
}
Flags.clear();
OS.flush();
if (!Flags.empty()) {
- Streamer.SwitchSection(getDrectveSection());
+ Streamer.switchSection(getDrectveSection());
Streamer.emitBytes(Flags);
}
Flags.clear();
void DwarfStreamer::finish() { MS->finish(); }
void DwarfStreamer::switchToDebugInfoSection(unsigned DwarfVersion) {
- MS->SwitchSection(MOFI->getDwarfInfoSection());
+ MS->switchSection(MOFI->getDwarfInfoSection());
MC->setDwarfVersion(DwarfVersion);
}
void DwarfStreamer::emitAbbrevs(
const std::vector<std::unique_ptr<DIEAbbrev>> &Abbrevs,
unsigned DwarfVersion) {
- MS->SwitchSection(MOFI->getDwarfAbbrevSection());
+ MS->switchSection(MOFI->getDwarfAbbrevSection());
MC->setDwarfVersion(DwarfVersion);
Asm->emitDwarfAbbrevs(Abbrevs);
}
/// Recursively emit the DIE tree rooted at \p Die.
void DwarfStreamer::emitDIE(DIE &Die) {
- MS->SwitchSection(MOFI->getDwarfInfoSection());
+ MS->switchSection(MOFI->getDwarfInfoSection());
Asm->emitDwarfDIE(Die);
DebugInfoSectionSize += Die.getSize();
}
.Default(nullptr);
if (Section) {
- MS->SwitchSection(Section);
+ MS->switchSection(Section);
MS->emitBytes(SecData);
}
/// Emit the debug_str section stored in \p Pool.
void DwarfStreamer::emitStrings(const NonRelocatableStringpool &Pool) {
- Asm->OutStreamer->SwitchSection(MOFI->getDwarfStrSection());
+ Asm->OutStreamer->switchSection(MOFI->getDwarfStrSection());
std::vector<DwarfStringPoolEntryRef> Entries = Pool.getEntriesForEmission();
for (auto Entry : Entries) {
// Emit the string itself.
#if 0
if (DwarfVersion >= 5) {
// Emit an empty string offset section.
- Asm->OutStreamer->SwitchSection(MOFI->getDwarfStrOffSection());
+ Asm->OutStreamer->switchSection(MOFI->getDwarfStrOffSection());
Asm->emitDwarfUnitLength(4, "Length of String Offsets Set");
Asm->emitInt16(DwarfVersion);
Asm->emitInt16(0);
UniqueIdToCuMap[CU.ID] = Id++;
}
- Asm->OutStreamer->SwitchSection(MOFI->getDwarfDebugNamesSection());
+ Asm->OutStreamer->switchSection(MOFI->getDwarfDebugNamesSection());
emitDWARF5AccelTable(
Asm.get(), Table, CompUnits,
[&UniqueIdToCuMap](const DWARF5AccelTableStaticData &Entry) {
void DwarfStreamer::emitAppleNamespaces(
AccelTable<AppleAccelTableStaticOffsetData> &Table) {
- Asm->OutStreamer->SwitchSection(MOFI->getDwarfAccelNamespaceSection());
+ Asm->OutStreamer->switchSection(MOFI->getDwarfAccelNamespaceSection());
auto *SectionBegin = Asm->createTempSymbol("namespac_begin");
Asm->OutStreamer->emitLabel(SectionBegin);
emitAppleAccelTable(Asm.get(), Table, "namespac", SectionBegin);
void DwarfStreamer::emitAppleNames(
AccelTable<AppleAccelTableStaticOffsetData> &Table) {
- Asm->OutStreamer->SwitchSection(MOFI->getDwarfAccelNamesSection());
+ Asm->OutStreamer->switchSection(MOFI->getDwarfAccelNamesSection());
auto *SectionBegin = Asm->createTempSymbol("names_begin");
Asm->OutStreamer->emitLabel(SectionBegin);
emitAppleAccelTable(Asm.get(), Table, "names", SectionBegin);
void DwarfStreamer::emitAppleObjc(
AccelTable<AppleAccelTableStaticOffsetData> &Table) {
- Asm->OutStreamer->SwitchSection(MOFI->getDwarfAccelObjCSection());
+ Asm->OutStreamer->switchSection(MOFI->getDwarfAccelObjCSection());
auto *SectionBegin = Asm->createTempSymbol("objc_begin");
Asm->OutStreamer->emitLabel(SectionBegin);
emitAppleAccelTable(Asm.get(), Table, "objc", SectionBegin);
void DwarfStreamer::emitAppleTypes(
AccelTable<AppleAccelTableStaticTypeData> &Table) {
- Asm->OutStreamer->SwitchSection(MOFI->getDwarfAccelTypesSection());
+ Asm->OutStreamer->switchSection(MOFI->getDwarfAccelTypesSection());
auto *SectionBegin = Asm->createTempSymbol("types_begin");
Asm->OutStreamer->emitLabel(SectionBegin);
emitAppleAccelTable(Asm.get(), Table, "types", SectionBegin);
void DwarfStreamer::emitSwiftAST(StringRef Buffer) {
MCSection *SwiftASTSection = MOFI->getDwarfSwiftASTSection();
SwiftASTSection->setAlignment(Align(32));
- MS->SwitchSection(SwiftASTSection);
+ MS->switchSection(SwiftASTSection);
MS->emitBytes(Buffer);
}
if (ReflectionSection == nullptr)
return;
ReflectionSection->setAlignment(Align(Alignment));
- MS->SwitchSection(ReflectionSection);
+ MS->switchSection(ReflectionSection);
MS->emitBytes(Buffer);
}
const FunctionIntervals::const_iterator &FuncRange,
const std::vector<DWARFDebugRangeList::RangeListEntry> &Entries,
unsigned AddressSize) {
- MS->SwitchSection(MC->getObjectFileInfo()->getDwarfRangesSection());
+ MS->switchSection(MC->getObjectFileInfo()->getDwarfRangesSection());
// Offset each range by the right amount.
int64_t PcOffset = Entries.empty() ? 0 : FuncRange.value() + UnitPcOffset;
llvm::sort(Ranges);
if (!Ranges.empty()) {
- MS->SwitchSection(MC->getObjectFileInfo()->getDwarfARangesSection());
+ MS->switchSection(MC->getObjectFileInfo()->getDwarfARangesSection());
MCSymbol *BeginLabel = Asm->createTempSymbol("Barange");
MCSymbol *EndLabel = Asm->createTempSymbol("Earange");
if (!DoDebugRanges)
return;
- MS->SwitchSection(MC->getObjectFileInfo()->getDwarfRangesSection());
+ MS->switchSection(MC->getObjectFileInfo()->getDwarfRangesSection());
// Offset each range by the right amount.
int64_t PcOffset = -Unit.getLowPc();
// Emit coalesced ranges.
if (Attributes.empty())
return;
- MS->SwitchSection(MC->getObjectFileInfo()->getDwarfLocSection());
+ MS->switchSection(MC->getObjectFileInfo()->getDwarfLocSection());
unsigned AddressSize = Unit.getOrigUnit().getAddressByteSize();
uint64_t BaseAddressMarker = (AddressSize == 8)
std::vector<DWARFDebugLine::Row> &Rows,
unsigned PointerSize) {
// Switch to the section where the table will be emitted into.
- MS->SwitchSection(MC->getObjectFileInfo()->getDwarfLineSection());
+ MS->switchSection(MC->getObjectFileInfo()->getDwarfLineSection());
MCSymbol *LineStartSym = MC->createTempSymbol();
MCSymbol *LineEndSym = MC->createTempSymbol();
/// Copy the debug_line over to the updated binary while unobfuscating the file
/// names and directories.
void DwarfStreamer::translateLineTable(DataExtractor Data, uint64_t Offset) {
- MS->SwitchSection(MC->getObjectFileInfo()->getDwarfLineSection());
+ MS->switchSection(MC->getObjectFileInfo()->getDwarfLineSection());
StringRef Contents = Data.getData();
// We have to deconstruct the line table header, because it contains to
return;
// Start the dwarf pubnames section.
- Asm->OutStreamer->SwitchSection(Sec);
+ Asm->OutStreamer->switchSection(Sec);
MCSymbol *BeginLabel = Asm->createTempSymbol("pub" + SecName + "_begin");
MCSymbol *EndLabel = Asm->createTempSymbol("pub" + SecName + "_end");
/// Emit a CIE into the debug_frame section.
void DwarfStreamer::emitCIE(StringRef CIEBytes) {
- MS->SwitchSection(MC->getObjectFileInfo()->getDwarfFrameSection());
+ MS->switchSection(MC->getObjectFileInfo()->getDwarfFrameSection());
MS->emitBytes(CIEBytes);
FrameSectionSize += CIEBytes.size();
/// which will be replaced with the parameter values.
void DwarfStreamer::emitFDE(uint32_t CIEOffset, uint32_t AddrSize,
uint32_t Address, StringRef FDEBytes) {
- MS->SwitchSection(MC->getObjectFileInfo()->getDwarfFrameSection());
+ MS->switchSection(MC->getObjectFileInfo()->getDwarfFrameSection());
MS->emitIntValue(FDEBytes.size() + 4 + AddrSize, 4);
MS->emitIntValue(CIEOffset, 4);
const DWARFUnitIndex &TUIndex, MCSection *OutputTypes,
StringRef Types, const UnitIndexEntry &TUEntry,
uint32_t &TypesOffset, unsigned TypesContributionIndex) {
- Out.SwitchSection(OutputTypes);
+ Out.switchSection(OutputTypes);
for (const DWARFUnitIndex::Entry &E : TUIndex.getRows()) {
auto *I = E.getContributions();
if (!I)
MCSection *OutputTypes, const std::vector<StringRef> &TypesSections,
const UnitIndexEntry &CUEntry, uint32_t &TypesOffset) {
for (StringRef Types : TypesSections) {
- Out.SwitchSection(OutputTypes);
+ Out.switchSection(OutputTypes);
uint64_t Offset = 0;
DataExtractor Data(Types, true, 0);
while (Data.isValidOffset(Offset)) {
Data = DataExtractor(CurStrOffsetSection, true, 0);
- Out.SwitchSection(StrOffsetSection);
+ Out.switchSection(StrOffsetSection);
uint64_t HeaderSize = debugStrOffsetsHeaderSize(Data, Version);
uint64_t Offset = 0;
++I;
}
- Out.SwitchSection(Section);
+ Out.switchSection(Section);
Out.emitIntValue(IndexVersion, 4); // Version
Out.emitIntValue(Columns, 4); // Columns
Out.emitIntValue(IndexEntries.size(), 4); // Num Units
else if (OutSection == InfoSection)
CurInfoSection.push_back(Contents);
else {
- Out.SwitchSection(OutSection);
+ Out.switchSection(OutSection);
Out.emitBytes(Contents);
}
return Error::success();
ContributionOffsets[getContributionIndex(DW_SECT_INFO, IndexVersion)];
if (CurCUIndexSection.empty()) {
bool FoundCUUnit = false;
- Out.SwitchSection(InfoSection);
+ Out.switchSection(InfoSection);
for (StringRef Info : CurInfoSection) {
uint64_t UnitOffset = 0;
while (Info.size() > UnitOffset) {
utostr(CUIndex.getVersion()) +
" and expecting " + utostr(IndexVersion));
- Out.SwitchSection(InfoSection);
+ Out.switchSection(InfoSection);
for (const DWARFUnitIndex::Entry &E : CUIndex.getRows()) {
auto *I = E.getContributions();
if (!I)
static void emitConstantPool(MCStreamer &Streamer, MCSection *Section,
ConstantPool &CP) {
if (!CP.empty()) {
- Streamer.SwitchSection(Section);
+ Streamer.switchSection(Section);
CP.emitEntries(Streamer);
}
}
void MCAsmStreamer::emitWinEHHandlerData(SMLoc Loc) {
MCStreamer::emitWinEHHandlerData(Loc);
- // Switch sections. Don't call SwitchSection directly, because that will
+ // Switch sections. Don't call switchSection directly, because that will
// cause the section switch to be visible in the emitted assembly.
// We only do this so the section switch that terminates the handler
// data block is visible.
if (!Tables.empty()) {
assert(Tables.size() == 1 && "asm output only supports one line table");
if (auto *Label = Tables.begin()->second.getLabel()) {
- SwitchSection(getContext().getObjectFileInfo()->getDwarfLineSection());
+ switchSection(getContext().getObjectFileInfo()->getDwarfLineSection());
emitLabel(Label);
}
}
LineStr = MCDwarfLineStr(context);
// Switch to the section where the table will be emitted into.
- MCOS->SwitchSection(context.getObjectFileInfo()->getDwarfLineSection());
+ MCOS->switchSection(context.getObjectFileInfo()->getDwarfLineSection());
// Handle the rest of the Compile Units.
for (const auto &CUIDTablePair : LineTables) {
if (!HasSplitLineTable)
return;
Optional<MCDwarfLineStr> NoLineStr(None);
- MCOS.SwitchSection(Section);
+ MCOS.switchSection(Section);
MCOS.emitLabel(Header.Emit(&MCOS, Params, None, NoLineStr).second);
}
void MCDwarfLineStr::emitSection(MCStreamer *MCOS) {
// Switch to the .debug_line_str section.
- MCOS->SwitchSection(
+ MCOS->switchSection(
MCOS->getContext().getObjectFileInfo()->getDwarfLineStrSection());
SmallString<0> Data = getFinalizedData();
MCOS->emitBinaryData(Data.str());
// the data for .debug_abbrev section which contains three DIEs.
static void EmitGenDwarfAbbrev(MCStreamer *MCOS) {
MCContext &context = MCOS->getContext();
- MCOS->SwitchSection(context.getObjectFileInfo()->getDwarfAbbrevSection());
+ MCOS->switchSection(context.getObjectFileInfo()->getDwarfAbbrevSection());
// DW_TAG_compile_unit DIE abbrev (1).
MCOS->emitULEB128IntValue(1);
auto &Sections = context.getGenDwarfSectionSyms();
- MCOS->SwitchSection(context.getObjectFileInfo()->getDwarfARangesSection());
+ MCOS->switchSection(context.getObjectFileInfo()->getDwarfARangesSection());
unsigned UnitLengthBytes =
dwarf::getUnitLengthFieldByteSize(context.getDwarfFormat());
const MCSymbol *RangesSymbol) {
MCContext &context = MCOS->getContext();
- MCOS->SwitchSection(context.getObjectFileInfo()->getDwarfInfoSection());
+ MCOS->switchSection(context.getObjectFileInfo()->getDwarfInfoSection());
// Create a symbol at the start and end of this section used in here for the
// expression to calculate the length in the header.
MCSymbol *RangesSymbol;
if (MCOS->getContext().getDwarfVersion() >= 5) {
- MCOS->SwitchSection(context.getObjectFileInfo()->getDwarfRnglistsSection());
+ MCOS->switchSection(context.getObjectFileInfo()->getDwarfRnglistsSection());
MCSymbol *EndSymbol = mcdwarf::emitListsTableHeaderStart(*MCOS);
MCOS->AddComment("Offset entry count");
MCOS->emitInt32(0);
MCOS->emitInt8(dwarf::DW_RLE_end_of_list);
MCOS->emitLabel(EndSymbol);
} else {
- MCOS->SwitchSection(context.getObjectFileInfo()->getDwarfRangesSection());
+ MCOS->switchSection(context.getObjectFileInfo()->getDwarfRangesSection());
RangesSymbol = context.createTempSymbol("debug_ranges_start");
MCOS->emitLabel(RangesSymbol);
for (MCSection *Sec : Sections) {
MCOS->getContext().getDwarfVersion() >= 3;
CreateDwarfSectionSymbols |= UseRangesSection;
- MCOS->SwitchSection(context.getObjectFileInfo()->getDwarfInfoSection());
+ MCOS->switchSection(context.getObjectFileInfo()->getDwarfInfoSection());
if (CreateDwarfSectionSymbols) {
InfoSectionSymbol = context.createTempSymbol();
MCOS->emitLabel(InfoSectionSymbol);
}
- MCOS->SwitchSection(context.getObjectFileInfo()->getDwarfAbbrevSection());
+ MCOS->switchSection(context.getObjectFileInfo()->getDwarfAbbrevSection());
if (CreateDwarfSectionSymbols) {
AbbrevSectionSymbol = context.createTempSymbol();
MCOS->emitLabel(AbbrevSectionSymbol);
}
- MCOS->SwitchSection(context.getObjectFileInfo()->getDwarfARangesSection());
+ MCOS->switchSection(context.getObjectFileInfo()->getDwarfARangesSection());
// Output the data for .debug_aranges section.
EmitGenDwarfAranges(MCOS, InfoSectionSymbol);
for (const MCDwarfFrameInfo &Frame : FrameArray) {
if (Frame.CompactUnwindEncoding == 0) continue;
if (!SectionEmitted) {
- Streamer.SwitchSection(MOFI->getCompactUnwindSection());
+ Streamer.switchSection(MOFI->getCompactUnwindSection());
Streamer.emitValueToAlignment(AsmInfo->getCodePointerSize());
SectionEmitted = true;
}
IsEH ? *const_cast<MCObjectFileInfo *>(MOFI)->getEHFrameSection()
: *MOFI->getDwarfFrameSection();
- Streamer.SwitchSection(&Section);
+ Streamer.switchSection(&Section);
MCSymbol *SectionStart = Context.createTempSymbol();
Streamer.emitLabel(SectionStart);
void MCELFStreamer::initSections(bool NoExecStack, const MCSubtargetInfo &STI) {
MCContext &Ctx = getContext();
- SwitchSection(Ctx.getObjectFileInfo()->getTextSection());
+ switchSection(Ctx.getObjectFileInfo()->getTextSection());
emitCodeAlignment(Ctx.getObjectFileInfo()->getTextSectionAlignment(), &STI);
if (NoExecStack)
- SwitchSection(Ctx.getAsmInfo()->getNonexecutableStackSection(Ctx));
+ switchSection(Ctx.getAsmInfo()->getNonexecutableStackSection(Ctx));
}
void MCELFStreamer::emitLabel(MCSymbol *S, SMLoc Loc) {
MCSection &Section = *getAssembler().getContext().getELFSection(
".bss", ELF::SHT_NOBITS, ELF::SHF_WRITE | ELF::SHF_ALLOC);
MCSectionSubPair P = getCurrentSection();
- SwitchSection(&Section);
+ switchSection(&Section);
emitValueToAlignment(ByteAlignment, 0, 1, 0);
emitLabel(Symbol);
emitZeros(Size);
- SwitchSection(P.first, P.second);
+ switchSection(P.first, P.second);
} else {
if(Symbol->declareCommon(Size, ByteAlignment))
report_fatal_error(Twine("Symbol: ") + Symbol->getName() +
MCSection *Comment = getAssembler().getContext().getELFSection(
".comment", ELF::SHT_PROGBITS, ELF::SHF_MERGE | ELF::SHF_STRINGS, 1);
pushSection();
- SwitchSection(Comment);
+ switchSection(Comment);
if (!SeenIdent) {
emitInt8(0);
SeenIdent = true;
".llvm.call-graph-profile", ELF::SHT_LLVM_CALL_GRAPH_PROFILE,
ELF::SHF_EXCLUDE, /*sizeof(Elf_CGProfile_Impl<>)=*/8);
pushSection();
- SwitchSection(CGProfile);
+ switchSection(CGProfile);
uint64_t Offset = 0;
for (MCAssembler::CGProfileEntry &E : Asm.CGProfile) {
finalizeCGProfileEntry(E.From, Offset);
// Switch section to AttributeSection or get/create the section.
if (AttributeSection) {
- SwitchSection(AttributeSection);
+ switchSection(AttributeSection);
} else {
AttributeSection = getContext().getELFSection(Section, Type, 0);
- SwitchSection(AttributeSection);
+ switchSection(AttributeSection);
// Format version
emitInt8(0x41);
}
pushSection();
- SwitchSection(Section);
+ switchSection(Section);
// The symbol may not be present, which only creates the section.
if (Symbol) {
// Switch back the dwarf line section, in case endSection had to switch the
// section.
MCContext &Ctx = getContext();
- SwitchSection(Ctx.getObjectFileInfo()->getDwarfLineSection());
+ switchSection(Ctx.getObjectFileInfo()->getDwarfLineSection());
const MCAsmInfo *AsmInfo = Ctx.getAsmInfo();
emitDwarfAdvanceLineAddr(INT64_MAX, LastLabel, SectionEnd,
return TokError("unexpected token in section switching directive");
Lex();
- getStreamer().SwitchSection(getContext().getCOFFSection(
+ getStreamer().switchSection(getContext().getCOFFSection(
Section, Characteristics, Kind, COMDATSymName, Type));
return false;
return TokError("unexpected token in section switching directive");
Lex();
- getStreamer().SwitchSection(getContext().getCOFFSection(
+ getStreamer().switchSection(getContext().getCOFFSection(
Section, Characteristics, Kind, COMDATSymName, Type));
return false;
COFF::IMAGE_SCN_MEM_READ;
}
SectionKind Kind = computeSectionKind(Flags);
- getStreamer().SwitchSection(getContext().getCOFFSection(
+ getStreamer().switchSection(getContext().getCOFFSection(
SectionName, Flags, Kind, "", (COFF::COMDATType)(0)));
return false;
}
unsigned Flags = COFF::IMAGE_SCN_MEM_PRELOAD | COFF::IMAGE_SCN_MEM_16BIT;
SectionKind Kind = computeSectionKind(Flags);
getStreamer().pushSection();
- getStreamer().SwitchSection(getContext().getCOFFSection(
+ getStreamer().switchSection(getContext().getCOFFSection(
".drectve", Flags, Kind, "", (COFF::COMDATType)(0)));
getStreamer().emitBytes("/DEFAULTLIB:");
getStreamer().emitBytes(Lib);
// FIXME: Arch specific.
bool isText = TAA & MachO::S_ATTR_PURE_INSTRUCTIONS;
- getStreamer().SwitchSection(getContext().getMachOSection(
+ getStreamer().switchSection(getContext().getMachOSection(
Segment, Section, TAA, StubSize,
isText ? SectionKind::getText() : SectionKind::getData()));
// FIXME: Arch specific.
bool isText = Segment == "__TEXT"; // FIXME: Hack.
- getStreamer().SwitchSection(getContext().getMachOSection(
+ getStreamer().switchSection(getContext().getMachOSection(
Segment, Section, TAA, StubSize,
isText ? SectionKind::getText() : SectionKind::getData()));
return false;
MCSectionSubPair PreviousSection = getStreamer().getPreviousSection();
if (!PreviousSection.first)
return TokError(".previous without corresponding .section");
- getStreamer().SwitchSection(PreviousSection.first, PreviousSection.second);
+ getStreamer().switchSection(PreviousSection.first, PreviousSection.second);
return false;
}
}
Lex();
- getStreamer().SwitchSection(getContext().getELFSection(Section, Type, Flags),
+ getStreamer().switchSection(getContext().getELFSection(Section, Type, Flags),
Subsection);
return false;
MCSectionELF *Section =
getContext().getELFSection(SectionName, Type, Flags, Size, GroupName,
IsComdat, UniqueID, LinkedToSym);
- getStreamer().SwitchSection(Section, Subsection);
+ getStreamer().switchSection(Section, Subsection);
// Check that flags are used consistently. However, the GNU assembler permits
// to leave out in subsequent uses of the same sections; for compatibility,
// do likewise.
MCSectionSubPair PreviousSection = getStreamer().getPreviousSection();
if (PreviousSection.first == nullptr)
return TokError(".previous without corresponding .section");
- getStreamer().SwitchSection(PreviousSection.first, PreviousSection.second);
+ getStreamer().switchSection(PreviousSection.first, PreviousSection.second);
return false;
}
MCSection *Note = getContext().getELFSection(".note", ELF::SHT_NOTE, 0);
getStreamer().pushSection();
- getStreamer().SwitchSection(Note);
+ getStreamer().switchSection(Note);
getStreamer().emitInt32(Data.size() + 1); // namesz
getStreamer().emitInt32(0); // descsz = 0 (no description).
getStreamer().emitInt32(1); // type = NT_VERSION
bool parseSectionDirectiveData(StringRef, SMLoc) {
auto *S = getContext().getObjectFileInfo()->getDataSection();
- getStreamer().SwitchSection(S);
+ getStreamer().switchSection(S);
return false;
}
WS->setPassive();
}
- getStreamer().SwitchSection(WS);
+ getStreamer().switchSection(WS);
return false;
}
if (auto *S =
Ctx.getObjectFileInfo()->getPseudoProbeSection(ProbeSec.first)) {
// Switch to the .pseudoprobe section or a comdat group.
- MCOS->SwitchSection(S);
+ MCOS->switchSection(S);
// Emit probes grouped by GUID.
ProbeSec.second.emit(MCOS, LastProbe);
}
}
void MCStreamer::initSections(bool NoExecStack, const MCSubtargetInfo &STI) {
- SwitchSection(getContext().getObjectFileInfo()->getTextSection());
+ switchSection(getContext().getObjectFileInfo()->getTextSection());
}
void MCStreamer::assignFragment(MCSymbol *Symbol, MCFragment *Fragment) {
for (size_t I = CurrentProcWinFrameInfoStartIndex, E = WinFrameInfos.size();
I != E; ++I)
emitWindowsUnwindTables(WinFrameInfos[I].get());
- SwitchSection(CurFrame->TextSection);
+ switchSection(CurFrame->TextSection);
}
void MCStreamer::emitWinCFIFuncletOrFuncEnd(SMLoc Loc) {
void MCStreamer::finishImpl() {}
void MCStreamer::emitBundleUnlock() {}
-void MCStreamer::SwitchSection(MCSection *Section, const MCExpr *Subsection) {
+void MCStreamer::switchSection(MCSection *Section, const MCExpr *Subsection) {
assert(Section && "Cannot switch to a null section!");
MCSectionSubPair curSection = SectionStack.back().first;
SectionStack.back().second = curSection;
if (Sym->isInSection())
return Sym;
- SwitchSection(Section);
+ switchSection(Section);
emitLabel(Sym);
return Sym;
}
// Emit the unwind info structs first.
for (const auto &CFI : Streamer.getWinFrameInfos()) {
MCSection *XData = Streamer.getAssociatedXDataSection(CFI->TextSection);
- Streamer.SwitchSection(XData);
+ Streamer.switchSection(XData);
::EmitUnwindInfo(Streamer, CFI.get());
}
// Now emit RUNTIME_FUNCTION entries.
for (const auto &CFI : Streamer.getWinFrameInfos()) {
MCSection *PData = Streamer.getAssociatedPDataSection(CFI->TextSection);
- Streamer.SwitchSection(PData);
+ Streamer.switchSection(PData);
EmitRuntimeFunction(Streamer, CFI.get());
}
}
// Switch sections (the static function above is meant to be called from
// here and from Emit().
MCSection *XData = Streamer.getAssociatedXDataSection(info->TextSection);
- Streamer.SwitchSection(XData);
+ Streamer.switchSection(XData);
::EmitUnwindInfo(Streamer, info);
}
if (Info->empty())
continue;
MCSection *XData = Streamer.getAssociatedXDataSection(CFI->TextSection);
- Streamer.SwitchSection(XData);
+ Streamer.switchSection(XData);
ARM64EmitUnwindInfo(Streamer, Info);
}
if (!Info->Symbol)
continue;
MCSection *PData = Streamer.getAssociatedPDataSection(CFI->TextSection);
- Streamer.SwitchSection(PData);
+ Streamer.switchSection(PData);
ARMEmitRuntimeFunction(Streamer, Info);
}
}
// end hasn't been marked yet, the xdata function length won't cover the
// whole function, only up to this point.
if (!info->FuncletOrFuncEnd) {
- Streamer.SwitchSection(info->TextSection);
+ Streamer.switchSection(info->TextSection);
info->FuncletOrFuncEnd = Streamer.emitCFILabel();
}
// Switch sections (the static function above is meant to be called from
// here and from Emit().
MCSection *XData = Streamer.getAssociatedXDataSection(info->TextSection);
- Streamer.SwitchSection(XData);
+ Streamer.switchSection(XData);
ARM64EmitUnwindInfo(Streamer, info, /* TryPacked = */ !HandlerData);
}
if (Info->empty())
continue;
MCSection *XData = Streamer.getAssociatedXDataSection(CFI->TextSection);
- Streamer.SwitchSection(XData);
+ Streamer.switchSection(XData);
ARMEmitUnwindInfo(Streamer, Info);
}
if (!Info->Symbol)
continue;
MCSection *PData = Streamer.getAssociatedPDataSection(CFI->TextSection);
- Streamer.SwitchSection(PData);
+ Streamer.switchSection(PData);
ARMEmitRuntimeFunction(Streamer, Info);
}
}
// end hasn't been marked yet, the xdata function length won't cover the
// whole function, only up to this point.
if (!info->FuncletOrFuncEnd) {
- Streamer.SwitchSection(info->TextSection);
+ Streamer.switchSection(info->TextSection);
info->FuncletOrFuncEnd = Streamer.emitCFILabel();
}
// Switch sections (the static function above is meant to be called from
// here and from Emit().
MCSection *XData = Streamer.getAssociatedXDataSection(info->TextSection);
- Streamer.SwitchSection(XData);
+ Streamer.switchSection(XData);
ARMEmitUnwindInfo(Streamer, info, /* TryPacked = */ !HandlerData);
}
// FIXME: this is identical to the ELF one.
// This emulates the same behavior of GNU as. This makes it easier
// to compare the output as the major sections are in the same order.
- SwitchSection(getContext().getObjectFileInfo()->getTextSection());
+ switchSection(getContext().getObjectFileInfo()->getTextSection());
emitCodeAlignment(4, &STI);
- SwitchSection(getContext().getObjectFileInfo()->getDataSection());
+ switchSection(getContext().getObjectFileInfo()->getDataSection());
emitCodeAlignment(4, &STI);
- SwitchSection(getContext().getObjectFileInfo()->getBSSSection());
+ switchSection(getContext().getObjectFileInfo()->getBSSSection());
emitCodeAlignment(4, &STI);
- SwitchSection(getContext().getObjectFileInfo()->getTextSection());
+ switchSection(getContext().getObjectFileInfo()->getTextSection());
}
void MCWinCOFFStreamer::emitLabel(MCSymbol *S, SMLoc Loc) {
<< Log2_32_Ceil(ByteAlignment);
pushSection();
- SwitchSection(MFI->getDrectveSection());
+ switchSection(MFI->getDrectveSection());
emitBytes(Directive);
popSection();
}
MCSection *Section = getContext().getObjectFileInfo()->getBSSSection();
pushSection();
- SwitchSection(Section);
+ switchSection(Section);
emitValueToAlignment(ByteAlignment, 0, 1, 0);
emitLabel(Symbol);
Symbol->setExternal(false);
bool CompileKernel =
(AccessInfo >> HWASanAccessInfo::CompileKernelShift) & 1;
- OutStreamer->SwitchSection(OutContext.getELFSection(
+ OutStreamer->switchSection(OutContext.getELFSection(
".text.hot", ELF::SHT_PROGBITS,
- ELF::SHF_EXECINSTR | ELF::SHF_ALLOC | ELF::SHF_GROUP, 0,
- Sym->getName(), /*IsComdat=*/true));
+ ELF::SHF_EXECINSTR | ELF::SHF_ALLOC | ELF::SHF_GROUP, 0, Sym->getName(),
+ /*IsComdat=*/true));
OutStreamer->emitSymbolAttribute(Sym, MCSA_ELF_TypeFunction);
OutStreamer->emitSymbolAttribute(Sym, MCSA_Weak);
const TargetLoweringObjectFile &TLOF = getObjFileLowering();
MCSection *ReadOnlySec = TLOF.getSectionForJumpTable(MF->getFunction(), TM);
- OutStreamer->SwitchSection(ReadOnlySec);
+ OutStreamer->switchSection(ReadOnlySec);
auto AFI = MF->getInfo<AArch64FunctionInfo>();
for (unsigned JTI = 0, e = JT.size(); JTI != e; ++JTI) {
return;
}
MCSection *Cur = OutStreamer.getCurrentSectionOnly();
- OutStreamer.SwitchSection(Nt);
+ OutStreamer.switchSection(Nt);
// Emit the note header.
OutStreamer.emitValueToAlignment(Align(8).value());
OutStreamer.emitIntValue(0, 4); // pad
OutStreamer.endSection(Nt);
- OutStreamer.SwitchSection(Cur);
+ OutStreamer.switchSection(Cur);
}
void AArch64TargetStreamer::emitInst(uint32_t Inst) {
auto &ReadOnlySection = *ObjectFileInfo.getReadOnlySection();
Streamer.pushSection();
- Streamer.SwitchSection(&ReadOnlySection);
+ Streamer.switchSection(&ReadOnlySection);
// CP microcode requires the kernel descriptor to be allocated on 64 byte
// alignment.
if ((AMDGPU::isGFX10Plus(STI) || AMDGPU::isGFX90A(STI)) &&
(STI.getTargetTriple().getOS() == Triple::AMDHSA ||
STI.getTargetTriple().getOS() == Triple::AMDPAL)) {
- OutStreamer->SwitchSection(getObjFileLowering().getTextSection());
+ OutStreamer->switchSection(getObjFileLowering().getTextSection());
getTargetStreamer()->EmitCodeEnd(STI);
}
if (!STM.isAmdHsaOS() && !STM.isAmdPalOS()) {
MCSectionELF *ConfigSection =
Context.getELFSection(".AMDGPU.config", ELF::SHT_PROGBITS, 0);
- OutStreamer->SwitchSection(ConfigSection);
+ OutStreamer->switchSection(ConfigSection);
}
if (MFI->isModuleEntryFunction()) {
if (isVerbose()) {
MCSectionELF *CommentSection =
Context.getELFSection(".AMDGPU.csdata", ELF::SHT_PROGBITS, 0);
- OutStreamer->SwitchSection(CommentSection);
+ OutStreamer->switchSection(CommentSection);
if (!MFI->isEntryFunction()) {
OutStreamer->emitRawComment(" Function info:", false);
if (DumpCodeInstEmitter) {
- OutStreamer->SwitchSection(
+ OutStreamer->switchSection(
Context.getELFSection(".AMDGPU.disasm", ELF::SHT_PROGBITS, 0));
for (size_t i = 0; i < DisasmLines.size(); ++i) {
NoteFlags = ELF::SHF_ALLOC;
S.pushSection();
- S.SwitchSection(
+ S.switchSection(
Context.getELFSection(ElfNote::SectionName, ELF::SHT_NOTE, NoteFlags));
S.emitInt32(NameSZ); // namesz
S.emitValue(DescSZ, 4); // descz
MCContext &Context = getObjFileLowering().getContext();
MCSectionELF *ConfigSection =
Context.getELFSection(".AMDGPU.config", ELF::SHT_PROGBITS, 0);
- OutStreamer->SwitchSection(ConfigSection);
+ OutStreamer->switchSection(ConfigSection);
EmitProgramInfoR600(MF);
if (isVerbose()) {
MCSectionELF *CommentSection =
Context.getELFSection(".AMDGPU.csdata", ELF::SHT_PROGBITS, 0);
- OutStreamer->SwitchSection(CommentSection);
+ OutStreamer->switchSection(CommentSection);
R600MachineFunctionInfo *MFI = MF.getInfo<R600MachineFunctionInfo>();
OutStreamer->emitRawComment(
if (!Stubs.empty()) {
// Switch with ".non_lazy_symbol_pointer" directive.
- OutStreamer->SwitchSection(TLOFMacho.getNonLazySymbolPointerSection());
+ OutStreamer->switchSection(TLOFMacho.getNonLazySymbolPointerSection());
emitAlignment(Align(4));
for (auto &Stub : Stubs)
Stubs = MMIMacho.GetThreadLocalGVStubList();
if (!Stubs.empty()) {
// Switch with ".non_lazy_symbol_pointer" directive.
- OutStreamer->SwitchSection(TLOFMacho.getThreadLocalPointerSection());
+ OutStreamer->switchSection(TLOFMacho.getThreadLocalPointerSection());
emitAlignment(Align(4));
for (auto &Stub : Stubs)
assert(EHSection && "Failed to get the required EH section");
// Switch to .ARM.extab or .ARM.exidx section
- SwitchSection(EHSection);
+ switchSection(EHSection);
emitValueToAlignment(4, 0, 1, 0);
}
}
// Switch to the section containing FnStart
- SwitchSection(&FnStart->getSection());
+ switchSection(&FnStart->getSection());
// Clean exception handling frame information
EHReset();
MCContext &Ctx = OS.getContext();
MCSectionELF *Sec = Ctx.getELFSection(".BTF", ELF::SHT_PROGBITS, 0);
Sec->setAlignment(Align(4));
- OS.SwitchSection(Sec);
+ OS.switchSection(Sec);
// Emit header.
emitCommonHeader();
MCContext &Ctx = OS.getContext();
MCSectionELF *Sec = Ctx.getELFSection(".BTF.ext", ELF::SHT_PROGBITS, 0);
Sec->setAlignment(Align(4));
- OS.SwitchSection(Sec);
+ OS.switchSection(Sec);
// Emit header.
emitCommonHeader();
return;
if (AttributeSection) {
- Streamer.SwitchSection(AttributeSection);
+ Streamer.switchSection(AttributeSection);
} else {
MCAssembler &MCA = getStreamer().getAssembler();
AttributeSection = MCA.getContext().getELFSection(
".csky.attributes", ELF::SHT_CSKY_ATTRIBUTES, 0);
- Streamer.SwitchSection(AttributeSection);
+ Streamer.switchSection(AttributeSection);
Streamer.emitInt8(ELFAttrs::Format_Version);
}
return;
if (CurrentSection != nullptr)
- Streamer.SwitchSection(CurrentSection);
+ Streamer.switchSection(CurrentSection);
Streamer.emitDataRegion(MCDR_DataRegion);
for (const ConstantPoolEntry &Entry : Entries) {
} else
llvm_unreachable("unexpected type of machine operand!");
- MES->SwitchSection(mySection);
+ MES->switchSection(mySection);
unsigned byteSize = is32bit ? 4 : 8;
getStreamer().emitCodeAlignment(byteSize, &getSTI(), byteSize);
MCSectionELF *Section = OutStreamer.getContext().getELFSection(
sectionName, ELF::SHT_PROGBITS, ELF::SHF_WRITE | ELF::SHF_ALLOC);
- OutStreamer.SwitchSection(Section);
+ OutStreamer.switchSection(Section);
Sym = AP.OutContext.getOrCreateSymbol(Twine(symbolName));
if (Sym->isUndefined()) {
MCSectionELF *Section = OutStreamer.getContext().getELFSection(
".lita", ELF::SHT_PROGBITS, ELF::SHF_WRITE | ELF::SHF_ALLOC);
- OutStreamer.SwitchSection(Section);
+ OutStreamer.switchSection(Section);
Sym = AP.OutContext.getOrCreateSymbol(Twine(LitaName));
if (Sym->isUndefined()) {
OutStreamer.emitLabel(Sym);
MCSymbol *Sym =
smallData(*this, MI, *OutStreamer, Imm, 8, getSubtargetInfo());
- OutStreamer->SwitchSection(Current.first, Current.second);
+ OutStreamer->switchSection(Current.first, Current.second);
MCInst TmpInst;
MCOperand &Reg = MappedInst.getOperand(0);
TmpInst.setOpcode(Hexagon::L2_loadrdgp);
MCSectionSubPair Current = OutStreamer->getCurrentSection();
MCSymbol *Sym =
smallData(*this, MI, *OutStreamer, Imm, 4, getSubtargetInfo());
- OutStreamer->SwitchSection(Current.first, Current.second);
+ OutStreamer->switchSection(Current.first, Current.second);
MCInst TmpInst;
MCOperand &Reg = MappedInst.getOperand(0);
TmpInst.setOpcode(Hexagon::L2_loadrigp);
MCSection &Section = *getAssembler().getContext().getELFSection(
SectionName, ELF::SHT_NOBITS, ELF::SHF_WRITE | ELF::SHF_ALLOC);
MCSectionSubPair P = getCurrentSection();
- SwitchSection(&Section);
+ switchSection(&Section);
if (ELFSymbol->isUndefined()) {
emitValueToAlignment(ByteAlignment, 0, 1, 0);
if (Align(ByteAlignment) > Section.getAlignment())
Section.setAlignment(Align(ByteAlignment));
- SwitchSection(P.first, P.second);
+ switchSection(P.first, P.second);
} else {
if (ELFSymbol->declareCommon(Size, ByteAlignment))
report_fatal_error("Symbol: " + Symbol->getName() +
// MSP430 EABI (slaa534.pdf, part 13).
MCSection *AttributeSection = getStreamer().getContext().getELFSection(
".MSP430.attributes", ELF::SHT_MSP430_ATTRIBUTES, 0);
- Streamer.SwitchSection(AttributeSection);
+ Streamer.switchSection(AttributeSection);
// Format version.
Streamer.emitInt8(0x41);
MCSection *IV = OutStreamer->getContext().getELFSection(
"__interrupt_vector_" + IVIdx,
ELF::SHT_PROGBITS, ELF::SHF_ALLOC | ELF::SHF_EXECINSTR);
- OutStreamer->SwitchSection(IV);
+ OutStreamer->switchSection(IV);
const MCSymbol *FunctionSymbol = getSymbol(F);
OutStreamer->emitSymbolValue(FunctionSymbol, TM.getProgramPointerSize());
- OutStreamer->SwitchSection(Cur);
+ OutStreamer->switchSection(Cur);
}
bool MSP430AsmPrinter::runOnMachineFunction(MachineFunction &MF) {
const MipsMCExpr *LoExpr =
MipsMCExpr::create(MipsMCExpr::MEK_LO, LoSym, getContext());
- getStreamer().SwitchSection(ReadOnlySection);
+ getStreamer().switchSection(ReadOnlySection);
getStreamer().emitLabel(Sym, IDLoc);
getStreamer().emitInt32(ImmOp32);
- getStreamer().SwitchSection(CS);
+ getStreamer().switchSection(CS);
if (emitPartialAddress(TOut, IDLoc, Sym))
return true;
const MipsMCExpr *LoExpr =
MipsMCExpr::create(MipsMCExpr::MEK_LO, LoSym, getContext());
- getStreamer().SwitchSection(ReadOnlySection);
+ getStreamer().switchSection(ReadOnlySection);
getStreamer().emitLabel(Sym, IDLoc);
getStreamer().emitValueToAlignment(8);
getStreamer().emitIntValue(ImmOp64, 8);
- getStreamer().SwitchSection(CS);
+ getStreamer().switchSection(CS);
unsigned TmpReg = getATReg(IDLoc);
if (!TmpReg)
const MipsMCExpr *LoExpr =
MipsMCExpr::create(MipsMCExpr::MEK_LO, LoSym, getContext());
- getStreamer().SwitchSection(ReadOnlySection);
+ getStreamer().switchSection(ReadOnlySection);
getStreamer().emitLabel(Sym, IDLoc);
getStreamer().emitValueToAlignment(8);
getStreamer().emitIntValue(ImmOp64, 8);
- getStreamer().SwitchSection(CS);
+ getStreamer().switchSection(CS);
if (emitPartialAddress(TOut, IDLoc, Sym))
return true;
MCSection *ELFSection = getContext().getELFSection(
Section, ELF::SHT_PROGBITS, ELF::SHF_ALLOC);
- getParser().getStreamer().SwitchSection(ELFSection);
+ getParser().getStreamer().switchSection(ELFSection);
getParser().Lex(); // Eat EndOfStatement token.
return false;
MCSection *ELFSection = getContext().getELFSection(
Section, Type, ELF::SHF_WRITE | ELF::SHF_ALLOC | ELF::SHF_MIPS_GPREL);
- getParser().getStreamer().SwitchSection(ELFSection);
+ getParser().getStreamer().switchSection(ELFSection);
getParser().Lex(); // Eat EndOfStatement token.
return false;
Labels.push_back(Symbol);
}
-void MipsELFStreamer::SwitchSection(MCSection *Section,
+void MipsELFStreamer::switchSection(MCSection *Section,
const MCExpr *Subsection) {
- MCELFStreamer::SwitchSection(Section, Subsection);
+ MCELFStreamer::switchSection(Section, Subsection);
Labels.clear();
}
/// Overriding this function allows us to dismiss all labels that are
/// candidates for marking as microMIPS when .section directive is processed.
- void SwitchSection(MCSection *Section,
+ void switchSection(MCSection *Section,
const MCExpr *Subsection = nullptr) override;
/// Overriding these functions allows us to dismiss all labels that are
ELF::SHF_ALLOC | ELF::SHF_MIPS_NOSTRIP, 1);
MCA.registerSection(*Sec);
Sec->setAlignment(Align(8));
- Streamer->SwitchSection(Sec);
+ Streamer->switchSection(Sec);
Streamer->emitInt8(ELF::ODK_REGINFO); // kind
Streamer->emitInt8(40); // size
ELF::SHF_ALLOC, 24);
MCA.registerSection(*Sec);
Sec->setAlignment(MTS->getABI().IsN32() ? Align(8) : Align(4));
- Streamer->SwitchSection(Sec);
+ Streamer->switchSection(Sec);
Streamer->emitInt32(ri_gprmask);
Streamer->emitInt32(ri_cprmask[0]);
unsigned Alignment = Section.getAlignment();
if (Alignment) {
- OS.SwitchSection(&Section);
+ OS.switchSection(&Section);
if (Section.useCodeAlign())
OS.emitCodeAlignment(Alignment, &STI, Alignment);
else
OS.pushSection();
- OS.SwitchSection(Sec);
+ OS.switchSection(Sec);
OS.emitValueImpl(ExprRef, 4);
".MIPS.abiflags", ELF::SHT_MIPS_ABIFLAGS, ELF::SHF_ALLOC, 24);
MCA.registerSection(*Sec);
Sec->setAlignment(Align(8));
- OS.SwitchSection(Sec);
+ OS.switchSection(Sec);
OS << ABIFlagsSection;
}
// Tell the assembler which ABI we are using
std::string SectionName = std::string(".mdebug.") + getCurrentABIString();
- OutStreamer->SwitchSection(
+ OutStreamer->switchSection(
OutContext.getELFSection(SectionName, ELF::SHT_PROGBITS, 0));
// NaN: At the moment we only support:
TS.emitDirectiveModuleOddSPReg();
// Switch to the .text section.
- OutStreamer->SwitchSection(getObjFileLowering().getTextSection());
+ OutStreamer->switchSection(getObjFileLowering().getTextSection());
}
void MipsAsmPrinter::emitInlineAsmStart() const {
MCSectionELF *M = OutContext.getELFSection(
".mips16.call.fp." + std::string(Symbol), ELF::SHT_PROGBITS,
ELF::SHF_ALLOC | ELF::SHF_EXECINSTR);
- OutStreamer->SwitchSection(M, nullptr);
+ OutStreamer->switchSection(M, nullptr);
//
// .align 2
//
EmitFPCallStub(Symbol, Signature);
}
// return to the text section
- OutStreamer->SwitchSection(OutContext.getObjectFileInfo()->getTextSection());
+ OutStreamer->switchSection(OutContext.getObjectFileInfo()->getTextSection());
}
void MipsAsmPrinter::EmitSled(const MachineInstr &MI, SledKind Kind) {
if (M.getPICLevel() == PICLevel::SmallPIC)
return AsmPrinter::emitStartOfAsmFile(M);
- OutStreamer->SwitchSection(OutContext.getELFSection(
+ OutStreamer->switchSection(OutContext.getELFSection(
".got2", ELF::SHT_PROGBITS, ELF::SHF_WRITE | ELF::SHF_ALLOC));
MCSymbol *TOCSym = OutContext.getOrCreateSymbol(Twine(".LTOC"));
OutStreamer->emitAssignment(TOCSym, tocExpr);
- OutStreamer->SwitchSection(getObjFileLowering().getTextSection());
+ OutStreamer->switchSection(getObjFileLowering().getTextSection());
}
void PPCLinuxAsmPrinter::emitFunctionEntryLabel() {
MCSectionSubPair Current = OutStreamer->getCurrentSection();
MCSectionELF *Section = OutStreamer->getContext().getELFSection(
".opd", ELF::SHT_PROGBITS, ELF::SHF_WRITE | ELF::SHF_ALLOC);
- OutStreamer->SwitchSection(Section);
+ OutStreamer->switchSection(Section);
OutStreamer->emitLabel(CurrentFnSym);
OutStreamer->emitValueToAlignment(8);
MCSymbol *Symbol1 = CurrentFnSymForSize;
8/*size*/);
// Emit a null environment pointer.
OutStreamer->emitIntValue(0, 8 /* size */);
- OutStreamer->SwitchSection(Current.first, Current.second);
+ OutStreamer->switchSection(Current.first, Current.second);
}
void PPCLinuxAsmPrinter::emitEndOfAsmFile(Module &M) {
const char *Name = isPPC64 ? ".toc" : ".got2";
MCSectionELF *Section = OutContext.getELFSection(
Name, ELF::SHT_PROGBITS, ELF::SHF_WRITE | ELF::SHF_ALLOC);
- OutStreamer->SwitchSection(Section);
+ OutStreamer->switchSection(Section);
if (!isPPC64)
OutStreamer->emitValueToAlignment(4);
if (!TargetLoweringObjectFileXCOFF::ShouldEmitEHBlock(MF) &&
(getNumberOfVRSaved() > 0)) {
// Emit dummy EH Info Table.
- OutStreamer->SwitchSection(getObjFileLowering().getCompactUnwindSection());
+ OutStreamer->switchSection(getObjFileLowering().getCompactUnwindSection());
MCSymbol *EHInfoLabel =
TargetLoweringObjectFileXCOFF::getEHInfoTableSymbol(MF);
OutStreamer->emitLabel(EHInfoLabel);
OutStreamer->emitIntValue(0, PointerSize);
OutStreamer->emitIntValue(0, PointerSize);
- OutStreamer->SwitchSection(MF->getSection());
+ OutStreamer->switchSection(MF->getSection());
}
}
getObjFileLowering().SectionForGlobal(GV, GVKind, TM));
// Switch to the containing csect.
- OutStreamer->SwitchSection(Csect);
+ OutStreamer->switchSection(Csect);
const DataLayout &DL = GV->getParent()->getDataLayout();
MCSectionSubPair Current = OutStreamer->getCurrentSection();
// Emit function descriptor.
- OutStreamer->SwitchSection(
+ OutStreamer->switchSection(
cast<MCSymbolXCOFF>(CurrentFnDescSym)->getRepresentedCsect());
// Emit aliasing label for function descriptor csect.
// Emit a null environment pointer.
OutStreamer->emitIntValue(0, PointerSize);
- OutStreamer->SwitchSection(Current.first, Current.second);
+ OutStreamer->switchSection(Current.first, Current.second);
}
void PPCAIXAsmPrinter::emitFunctionEntryLabel() {
XCOFF::CsectProperties(XCOFF::XMC_RW, XCOFF::XTY_SD),
/*MultiSymbolsAllowed*/ true);
- OutStreamer->SwitchSection(CntsSection);
+ OutStreamer->switchSection(CntsSection);
if (OutContext.hasXCOFFSection(
"__llvm_prf_data",
XCOFF::CsectProperties(XCOFF::XMC_RW, XCOFF::XTY_SD)))
emitPGORefs();
// Switch to section to emit TOC base.
- OutStreamer->SwitchSection(getObjFileLowering().getTOCBaseSection());
+ OutStreamer->switchSection(getObjFileLowering().getTOCBaseSection());
PPCTargetStreamer *TS =
static_cast<PPCTargetStreamer *>(OutStreamer->getTargetStreamer());
TCEntry = cast<MCSectionXCOFF>(
getObjFileLowering().getSectionForTOCEntry(I.first.first, TM));
}
- OutStreamer->SwitchSection(TCEntry);
+ OutStreamer->switchSection(TCEntry);
OutStreamer->emitLabel(I.second);
if (TS != nullptr)
return;
if (AttributeSection) {
- Streamer.SwitchSection(AttributeSection);
+ Streamer.switchSection(AttributeSection);
} else {
MCAssembler &MCA = getStreamer().getAssembler();
AttributeSection = MCA.getContext().getELFSection(
".riscv.attributes", ELF::SHT_RISCV_ATTRIBUTES, 0);
- Streamer.SwitchSection(AttributeSection);
+ Streamer.switchSection(AttributeSection);
Streamer.emitInt8(ELFAttrs::Format_Version);
}
return;
// Switch to the .text section.
const MCObjectFileInfo &OFI = *Streamer.getContext().getObjectFileInfo();
- Streamer.SwitchSection(OFI.getTextSection());
+ Streamer.switchSection(OFI.getTextSection());
for (auto &I : EXRLTargets2Sym) {
Streamer.emitLabel(I.second);
const MCInstSTIPair &MCI_STI = I.first;
if (MF->getFunction().hasFnAttribute("mrecord-mcount")) {
MCSymbol *DotSym = OutContext.createTempSymbol();
OutStreamer->pushSection();
- OutStreamer->SwitchSection(
+ OutStreamer->switchSection(
Ctx.getELFSection("__mcount_loc", ELF::SHT_PROGBITS, ELF::SHF_ALLOC));
OutStreamer->emitSymbolValue(DotSym, 8);
OutStreamer->popSection();
OutStreamer->emitLabel(FnEndSym);
OutStreamer->pushSection();
- OutStreamer->SwitchSection(getObjFileLowering().getPPA1Section());
+ OutStreamer->switchSection(getObjFileLowering().getPPA1Section());
emitPPA1(FnEndSym);
OutStreamer->popSection();
auto *WS =
getContext().getWasmSection(SecName, SectionKind::getText(), 0, Group,
MCContext::GenericSectionID, nullptr);
- getStreamer().SwitchSection(WS);
+ getStreamer().switchSection(WS);
// Also generate DWARF for this section if requested.
if (getContext().getGenDwarfForAssembly())
getContext().addGenDwarfSection(WS);
std::string SectionName = (".custom_section." + Name->getString()).str();
MCSectionWasm *MySection =
OutContext.getWasmSection(SectionName, SectionKind::getMetadata());
- OutStreamer->SwitchSection(MySection);
+ OutStreamer->switchSection(MySection);
OutStreamer->emitBytes(Contents->getString());
OutStreamer->popSection();
}
MCSectionWasm *Producers = OutContext.getWasmSection(
".custom_section.producers", SectionKind::getMetadata());
OutStreamer->pushSection();
- OutStreamer->SwitchSection(Producers);
+ OutStreamer->switchSection(Producers);
OutStreamer->emitULEB128IntValue(FieldCount);
for (auto &Producers : {std::make_pair("language", &Languages),
std::make_pair("processed-by", &Tools)}) {
MCSectionWasm *FeaturesSection = OutContext.getWasmSection(
".custom_section.target_features", SectionKind::getMetadata());
OutStreamer->pushSection();
- OutStreamer->SwitchSection(FeaturesSection);
+ OutStreamer->switchSection(FeaturesSection);
OutStreamer->emitULEB128IntValue(EmittedFeatures.size());
for (auto &F : EmittedFeatures) {
MCSection *Cur = OutStreamer->getCurrentSectionOnly();
MCSection *Nt = MMI->getContext().getELFSection(
".note.gnu.property", ELF::SHT_NOTE, ELF::SHF_ALLOC);
- OutStreamer->SwitchSection(Nt);
+ OutStreamer->switchSection(Nt);
// Emitting note header.
const int WordSize = TT.isArch64Bit() && !TT.isX32() ? 8 : 4;
emitAlignment(WordSize == 4 ? Align(4) : Align(8)); // padding
OutStreamer->endSection(Nt);
- OutStreamer->SwitchSection(Cur);
+ OutStreamer->switchSection(Cur);
}
}
if (TT.isOSBinFormatMachO())
- OutStreamer->SwitchSection(getObjFileLowering().getTextSection());
+ OutStreamer->switchSection(getObjFileLowering().getTextSection());
if (TT.isOSBinFormatCOFF()) {
// Emit an absolute @feat.00 symbol. This appears to be some kind of
// Output stubs for external and common global variables.
Stubs = MMIMacho.GetGVStubList();
if (!Stubs.empty()) {
- OutStreamer.SwitchSection(MMI->getContext().getMachOSection(
+ OutStreamer.switchSection(MMI->getContext().getMachOSection(
"__IMPORT", "__pointers", MachO::S_NON_LAZY_SYMBOL_POINTERS,
SectionKind::getMetadata()));
MCSection *ReadOnlySection = getObjFileLowering().getSectionForConstant(
getDataLayout(), SectionKind::getReadOnly(),
/*C=*/nullptr, Alignment);
- OutStreamer->SwitchSection(ReadOnlySection);
+ OutStreamer->switchSection(ReadOnlySection);
OutStreamer->emitLabel(AddrSymbol);
unsigned PtrSize = MAI->getCodePointerSize();
return;
const DataLayout &DL = getDataLayout();
- OutStreamer->SwitchSection(getObjFileLowering().SectionForGlobal(GV, TM));
+ OutStreamer->switchSection(getObjFileLowering().SectionForGlobal(GV, TM));
MCSymbol *GVSym = getSymbol(GV);
const Constant *C = GV->getInitializer();
MCSection *Sec =
TestPrinter->getCtx().getELFSection(".tst", ELF::SHT_PROGBITS, 0);
SecBeginSymbol = Sec->getBeginSymbol();
- TestPrinter->getMS().SwitchSection(Sec);
+ TestPrinter->getMS().switchSection(Sec);
Val->setFragment(&Sec->getDummyFragment());
return true;
MCContext *MC = DG->getMCContext();
// Emit two compressed sections with broken headers.
- AP->OutStreamer->SwitchSection(
+ AP->OutStreamer->switchSection(
MC->getELFSection(".zdebug_foo", 0 /*Type*/, 0 /*Flags*/));
AP->OutStreamer->emitBytes("0");
- AP->OutStreamer->SwitchSection(
+ AP->OutStreamer->switchSection(
MC->getELFSection(".zdebug_bar", 0 /*Type*/, 0 /*Flags*/));
AP->OutStreamer->emitBytes("0");
C.Streamer->initSections(false, *STI);
MCSection *Section = C.MOFI->getTextSection();
Section->setHasInstructions(true);
- C.Streamer->SwitchSection(Section);
+ C.Streamer->switchSection(Section);
C.Streamer->emitCFIStartProc(true);
auto Str = EncodeDefCfaExpr(ExprBytes);
C.Streamer->emitCFIEscape(Str);
StringPool->emit(*Asm, TLOF->getDwarfStrSection(),
TLOF->getDwarfStrOffSection());
- MS->SwitchSection(TLOF->getDwarfInfoSection());
+ MS->switchSection(TLOF->getDwarfInfoSection());
for (auto &CU : CompileUnits) {
uint16_t Version = CU->getVersion();
auto Length = CU->getLength();
Asm->emitDwarfDIE(*CU->getUnitDIE().Die);
}
- MS->SwitchSection(TLOF->getDwarfLineSection());
+ MS->switchSection(TLOF->getDwarfLineSection());
for (auto < : LineTables)
LT->generate(*MC, *Asm);
// Create a mock function
MCSection *Section = C.MOFI->getTextSection();
Section->setHasInstructions(true);
- TheStreamer->SwitchSection(Section);
+ TheStreamer->switchSection(Section);
TheStreamer->emitCFIStartProc(true);
// Create a mock dwarfloc
TheStreamer->emitCFIEndProc();
// Start emission of .debug_line
- TheStreamer->SwitchSection(C.MOFI->getDwarfLineSection());
+ TheStreamer->switchSection(C.MOFI->getDwarfLineSection());
MCDwarfLineTableHeader Header;
MCDwarfLineTableParams Params = Assembler.getDWARFLinetableParams();
Optional<MCDwarfLineStr> LineStr(None);
TheStreamer->emitLabel(LineEndSym);
if (LineStr) {
SmallString<0> Data = LineStr->getFinalizedData();
- TheStreamer->SwitchSection(TheStreamer->getContext()
+ TheStreamer->switchSection(TheStreamer->getContext()
.getObjectFileInfo()
->getDwarfLineStrSection());
TheStreamer->emitBinaryData(Data.str());