summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
Diffstat (limited to 'llvm')
-rw-r--r--llvm/include/llvm/MC/MCObjectStreamer.h4
-rw-r--r--llvm/include/llvm/MC/MCStreamer.h1
-rw-r--r--llvm/lib/MC/MCELFStreamer.cpp14
-rw-r--r--llvm/lib/MC/MCMachOStreamer.cpp2
-rw-r--r--llvm/lib/MC/MCObjectStreamer.cpp8
5 files changed, 14 insertions, 15 deletions
diff --git a/llvm/include/llvm/MC/MCObjectStreamer.h b/llvm/include/llvm/MC/MCObjectStreamer.h
index 3661de13b19..437e09af6b8 100644
--- a/llvm/include/llvm/MC/MCObjectStreamer.h
+++ b/llvm/include/llvm/MC/MCObjectStreamer.h
@@ -63,13 +63,11 @@ public:
void EmitCFISections(bool EH, bool Debug) override;
protected:
- MCSection *getCurrentSectionData() const { return getCurrentSection().first; }
-
MCFragment *getCurrentFragment() const;
void insert(MCFragment *F) {
flushPendingLabels(F);
- MCSection *CurSection = getCurrentSectionData();
+ MCSection *CurSection = getCurrentSectionOnly();
CurSection->getFragmentList().insert(CurInsertionPoint, F);
F->setParent(CurSection);
}
diff --git a/llvm/include/llvm/MC/MCStreamer.h b/llvm/include/llvm/MC/MCStreamer.h
index 957913e934c..580a1b4ab81 100644
--- a/llvm/include/llvm/MC/MCStreamer.h
+++ b/llvm/include/llvm/MC/MCStreamer.h
@@ -272,6 +272,7 @@ public:
return SectionStack.back().first;
return MCSectionSubPair();
}
+ MCSection *getCurrentSectionOnly() const { return getCurrentSection().first; }
/// \brief Return the previous section that the streamer is emitting code to.
MCSectionSubPair getPreviousSection() const {
diff --git a/llvm/lib/MC/MCELFStreamer.cpp b/llvm/lib/MC/MCELFStreamer.cpp
index aa818f9eebb..b3a9ca7f3a7 100644
--- a/llvm/lib/MC/MCELFStreamer.cpp
+++ b/llvm/lib/MC/MCELFStreamer.cpp
@@ -39,7 +39,7 @@
using namespace llvm;
bool MCELFStreamer::isBundleLocked() const {
- return getCurrentSectionData()->isBundleLocked();
+ return getCurrentSectionOnly()->isBundleLocked();
}
MCELFStreamer::~MCELFStreamer() {
@@ -146,7 +146,7 @@ static void setSectionAlignmentForBundling(const MCAssembler &Assembler,
void MCELFStreamer::ChangeSection(MCSection *Section,
const MCExpr *Subsection) {
- MCSection *CurSection = getCurrentSectionData();
+ MCSection *CurSection = getCurrentSectionOnly();
if (CurSection && isBundleLocked())
report_fatal_error("Unterminated .bundle_lock when changing a section");
@@ -204,7 +204,7 @@ bool MCELFStreamer::EmitSymbolAttribute(MCSymbol *Symbol,
// important for matching the string table that 'as' generates.
IndirectSymbolData ISD;
ISD.Symbol = Symbol;
- ISD.Section = getCurrentSectionData();
+ ISD.Section = getCurrentSectionOnly();
getAssembler().getIndirectSymbols().push_back(ISD);
return true;
}
@@ -509,7 +509,7 @@ void MCELFStreamer::EmitInstToData(const MCInst &Inst,
MCDataFragment *DF;
if (Assembler.isBundlingEnabled()) {
- MCSection &Sec = *getCurrentSectionData();
+ MCSection &Sec = *getCurrentSectionOnly();
if (Assembler.getRelaxAll() && isBundleLocked())
// If the -mc-relax-all flag is used and we are bundle-locked, we re-use
// the current bundle group.
@@ -577,7 +577,7 @@ void MCELFStreamer::EmitBundleAlignMode(unsigned AlignPow2) {
}
void MCELFStreamer::EmitBundleLock(bool AlignToEnd) {
- MCSection &Sec = *getCurrentSectionData();
+ MCSection &Sec = *getCurrentSectionOnly();
// Sanity checks
//
@@ -598,7 +598,7 @@ void MCELFStreamer::EmitBundleLock(bool AlignToEnd) {
}
void MCELFStreamer::EmitBundleUnlock() {
- MCSection &Sec = *getCurrentSectionData();
+ MCSection &Sec = *getCurrentSectionOnly();
// Sanity checks
if (!getAssembler().isBundlingEnabled())
@@ -656,7 +656,7 @@ void MCELFStreamer::Flush() {
void MCELFStreamer::FinishImpl() {
// Ensure the last section gets aligned if necessary.
- MCSection *CurSection = getCurrentSectionData();
+ MCSection *CurSection = getCurrentSectionOnly();
setSectionAlignmentForBundling(getAssembler(), CurSection);
EmitFrames(nullptr);
diff --git a/llvm/lib/MC/MCMachOStreamer.cpp b/llvm/lib/MC/MCMachOStreamer.cpp
index e951073cb69..6591259758f 100644
--- a/llvm/lib/MC/MCMachOStreamer.cpp
+++ b/llvm/lib/MC/MCMachOStreamer.cpp
@@ -288,7 +288,7 @@ bool MCMachOStreamer::EmitSymbolAttribute(MCSymbol *Symbol,
// important for matching the string table that 'as' generates.
IndirectSymbolData ISD;
ISD.Symbol = Symbol;
- ISD.Section = getCurrentSectionData();
+ ISD.Section = getCurrentSectionOnly();
getAssembler().getIndirectSymbols().push_back(ISD);
return true;
}
diff --git a/llvm/lib/MC/MCObjectStreamer.cpp b/llvm/lib/MC/MCObjectStreamer.cpp
index 1f6c3acb4fc..88ea478478f 100644
--- a/llvm/lib/MC/MCObjectStreamer.cpp
+++ b/llvm/lib/MC/MCObjectStreamer.cpp
@@ -42,7 +42,7 @@ void MCObjectStreamer::flushPendingLabels(MCFragment *F, uint64_t FOffset) {
if (PendingLabels.size()) {
if (!F) {
F = new MCDataFragment();
- MCSection *CurSection = getCurrentSectionData();
+ MCSection *CurSection = getCurrentSectionOnly();
CurSection->getFragmentList().insert(CurInsertionPoint, F);
F->setParent(CurSection);
}
@@ -99,9 +99,9 @@ void MCObjectStreamer::EmitFrames(MCAsmBackend *MAB) {
}
MCFragment *MCObjectStreamer::getCurrentFragment() const {
- assert(getCurrentSectionData() && "No current section!");
+ assert(getCurrentSectionOnly() && "No current section!");
- if (CurInsertionPoint != getCurrentSectionData()->getFragmentList().begin())
+ if (CurInsertionPoint != getCurrentSectionOnly()->getFragmentList().begin())
return std::prev(CurInsertionPoint);
return nullptr;
@@ -237,7 +237,7 @@ void MCObjectStreamer::EmitInstruction(const MCInst &Inst,
const MCSubtargetInfo &STI) {
MCStreamer::EmitInstruction(Inst, STI);
- MCSection *Sec = getCurrentSectionData();
+ MCSection *Sec = getCurrentSectionOnly();
Sec->setHasInstructions(true);
// Now that a machine instruction has been assembled into this section, make
OpenPOWER on IntegriCloud