Rename and move getCurrentSectionData.

I think this concludes the merge of MCSectionData and MCSection.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238358 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola 2015-05-27 21:04:14 +00:00
parent 41cea417fa
commit 792e158397
5 changed files with 14 additions and 15 deletions

View File

@ -63,13 +63,11 @@ public:
void EmitCFISections(bool EH, bool Debug) override; void EmitCFISections(bool EH, bool Debug) override;
protected: protected:
MCSection *getCurrentSectionData() const { return getCurrentSection().first; }
MCFragment *getCurrentFragment() const; MCFragment *getCurrentFragment() const;
void insert(MCFragment *F) { void insert(MCFragment *F) {
flushPendingLabels(F); flushPendingLabels(F);
MCSection *CurSection = getCurrentSectionData(); MCSection *CurSection = getCurrentSectionOnly();
CurSection->getFragmentList().insert(CurInsertionPoint, F); CurSection->getFragmentList().insert(CurInsertionPoint, F);
F->setParent(CurSection); F->setParent(CurSection);
} }

View File

@ -272,6 +272,7 @@ public:
return SectionStack.back().first; return SectionStack.back().first;
return MCSectionSubPair(); return MCSectionSubPair();
} }
MCSection *getCurrentSectionOnly() const { return getCurrentSection().first; }
/// \brief Return the previous section that the streamer is emitting code to. /// \brief Return the previous section that the streamer is emitting code to.
MCSectionSubPair getPreviousSection() const { MCSectionSubPair getPreviousSection() const {

View File

@ -39,7 +39,7 @@
using namespace llvm; using namespace llvm;
bool MCELFStreamer::isBundleLocked() const { bool MCELFStreamer::isBundleLocked() const {
return getCurrentSectionData()->isBundleLocked(); return getCurrentSectionOnly()->isBundleLocked();
} }
MCELFStreamer::~MCELFStreamer() { MCELFStreamer::~MCELFStreamer() {
@ -146,7 +146,7 @@ static void setSectionAlignmentForBundling(const MCAssembler &Assembler,
void MCELFStreamer::ChangeSection(MCSection *Section, void MCELFStreamer::ChangeSection(MCSection *Section,
const MCExpr *Subsection) { const MCExpr *Subsection) {
MCSection *CurSection = getCurrentSectionData(); MCSection *CurSection = getCurrentSectionOnly();
if (CurSection && isBundleLocked()) if (CurSection && isBundleLocked())
report_fatal_error("Unterminated .bundle_lock when changing a section"); 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. // important for matching the string table that 'as' generates.
IndirectSymbolData ISD; IndirectSymbolData ISD;
ISD.Symbol = Symbol; ISD.Symbol = Symbol;
ISD.Section = getCurrentSectionData(); ISD.Section = getCurrentSectionOnly();
getAssembler().getIndirectSymbols().push_back(ISD); getAssembler().getIndirectSymbols().push_back(ISD);
return true; return true;
} }
@ -509,7 +509,7 @@ void MCELFStreamer::EmitInstToData(const MCInst &Inst,
MCDataFragment *DF; MCDataFragment *DF;
if (Assembler.isBundlingEnabled()) { if (Assembler.isBundlingEnabled()) {
MCSection &Sec = *getCurrentSectionData(); MCSection &Sec = *getCurrentSectionOnly();
if (Assembler.getRelaxAll() && isBundleLocked()) if (Assembler.getRelaxAll() && isBundleLocked())
// If the -mc-relax-all flag is used and we are bundle-locked, we re-use // If the -mc-relax-all flag is used and we are bundle-locked, we re-use
// the current bundle group. // the current bundle group.
@ -577,7 +577,7 @@ void MCELFStreamer::EmitBundleAlignMode(unsigned AlignPow2) {
} }
void MCELFStreamer::EmitBundleLock(bool AlignToEnd) { void MCELFStreamer::EmitBundleLock(bool AlignToEnd) {
MCSection &Sec = *getCurrentSectionData(); MCSection &Sec = *getCurrentSectionOnly();
// Sanity checks // Sanity checks
// //
@ -598,7 +598,7 @@ void MCELFStreamer::EmitBundleLock(bool AlignToEnd) {
} }
void MCELFStreamer::EmitBundleUnlock() { void MCELFStreamer::EmitBundleUnlock() {
MCSection &Sec = *getCurrentSectionData(); MCSection &Sec = *getCurrentSectionOnly();
// Sanity checks // Sanity checks
if (!getAssembler().isBundlingEnabled()) if (!getAssembler().isBundlingEnabled())
@ -656,7 +656,7 @@ void MCELFStreamer::Flush() {
void MCELFStreamer::FinishImpl() { void MCELFStreamer::FinishImpl() {
// Ensure the last section gets aligned if necessary. // Ensure the last section gets aligned if necessary.
MCSection *CurSection = getCurrentSectionData(); MCSection *CurSection = getCurrentSectionOnly();
setSectionAlignmentForBundling(getAssembler(), CurSection); setSectionAlignmentForBundling(getAssembler(), CurSection);
EmitFrames(nullptr); EmitFrames(nullptr);

View File

@ -288,7 +288,7 @@ bool MCMachOStreamer::EmitSymbolAttribute(MCSymbol *Symbol,
// important for matching the string table that 'as' generates. // important for matching the string table that 'as' generates.
IndirectSymbolData ISD; IndirectSymbolData ISD;
ISD.Symbol = Symbol; ISD.Symbol = Symbol;
ISD.Section = getCurrentSectionData(); ISD.Section = getCurrentSectionOnly();
getAssembler().getIndirectSymbols().push_back(ISD); getAssembler().getIndirectSymbols().push_back(ISD);
return true; return true;
} }

View File

@ -42,7 +42,7 @@ void MCObjectStreamer::flushPendingLabels(MCFragment *F, uint64_t FOffset) {
if (PendingLabels.size()) { if (PendingLabels.size()) {
if (!F) { if (!F) {
F = new MCDataFragment(); F = new MCDataFragment();
MCSection *CurSection = getCurrentSectionData(); MCSection *CurSection = getCurrentSectionOnly();
CurSection->getFragmentList().insert(CurInsertionPoint, F); CurSection->getFragmentList().insert(CurInsertionPoint, F);
F->setParent(CurSection); F->setParent(CurSection);
} }
@ -99,9 +99,9 @@ void MCObjectStreamer::EmitFrames(MCAsmBackend *MAB) {
} }
MCFragment *MCObjectStreamer::getCurrentFragment() const { 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 std::prev(CurInsertionPoint);
return nullptr; return nullptr;
@ -237,7 +237,7 @@ void MCObjectStreamer::EmitInstruction(const MCInst &Inst,
const MCSubtargetInfo &STI) { const MCSubtargetInfo &STI) {
MCStreamer::EmitInstruction(Inst, STI); MCStreamer::EmitInstruction(Inst, STI);
MCSection *Sec = getCurrentSectionData(); MCSection *Sec = getCurrentSectionOnly();
Sec->setHasInstructions(true); Sec->setHasInstructions(true);
// Now that a machine instruction has been assembled into this section, make // Now that a machine instruction has been assembled into this section, make