diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2015-05-26 14:42:52 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2015-05-26 14:42:52 +0000 |
commit | e6e287df74fa39a2b32a8782fdd86a80350cfcaa (patch) | |
tree | 6b52da0c0cb67b7be5f0f02d4e9ab0c5aeb594ef /llvm/lib/MC/MCELFStreamer.cpp | |
parent | bf5bd94142ba254c32ac3549d203c101da0e6f10 (diff) | |
download | bcm5719-llvm-e6e287df74fa39a2b32a8782fdd86a80350cfcaa.tar.gz bcm5719-llvm-e6e287df74fa39a2b32a8782fdd86a80350cfcaa.zip |
Pass a MCSection to getCurrentSectionData.
A step towards merging MCSection and MCSectionData.
llvm-svn: 238203
Diffstat (limited to 'llvm/lib/MC/MCELFStreamer.cpp')
-rw-r--r-- | llvm/lib/MC/MCELFStreamer.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/llvm/lib/MC/MCELFStreamer.cpp b/llvm/lib/MC/MCELFStreamer.cpp index b6778c4ab83..110dd3338bd 100644 --- a/llvm/lib/MC/MCELFStreamer.cpp +++ b/llvm/lib/MC/MCELFStreamer.cpp @@ -138,18 +138,17 @@ void MCELFStreamer::EmitAssemblerFlag(MCAssemblerFlag Flag) { // If bundle aligment is used and there are any instructions in the section, it // needs to be aligned to at least the bundle size. static void setSectionAlignmentForBundling(const MCAssembler &Assembler, - MCSectionData *SD) { - if (!SD) - return; - MCSection &Section = SD->getSection(); - if (Assembler.isBundlingEnabled() && Section.hasInstructions() && - Section.getAlignment() < Assembler.getBundleAlignSize()) - Section.setAlignment(Assembler.getBundleAlignSize()); + MCSection *Section) { + if (Section && Assembler.isBundlingEnabled() && Section->hasInstructions() && + Section->getAlignment() < Assembler.getBundleAlignSize()) + Section->setAlignment(Assembler.getBundleAlignSize()); } void MCELFStreamer::ChangeSection(MCSection *Section, const MCExpr *Subsection) { - MCSectionData *CurSection = getCurrentSectionData(); + MCSectionData *CurSectionData = getCurrentSectionData(); + MCSection *CurSection = + CurSectionData ? &CurSectionData->getSection() : nullptr; if (CurSection && isBundleLocked()) report_fatal_error("Unterminated .bundle_lock when changing a section"); @@ -660,7 +659,10 @@ void MCELFStreamer::Flush() { void MCELFStreamer::FinishImpl() { // Ensure the last section gets aligned if necessary. - setSectionAlignmentForBundling(getAssembler(), getCurrentSectionData()); + MCSectionData *CurSectionData = getCurrentSectionData(); + MCSection *CurSection = + CurSectionData ? &CurSectionData->getSection() : nullptr; + setSectionAlignmentForBundling(getAssembler(), CurSection); EmitFrames(nullptr); |