[llvm] r238320 - Move getSubsectionInsertionPoint to MCSection.
Rafael Espindola
rafael.espindola at gmail.com
Wed May 27 06:37:28 PDT 2015
Author: rafael
Date: Wed May 27 08:37:28 2015
New Revision: 238320
URL: http://llvm.org/viewvc/llvm-project?rev=238320&view=rev
Log:
Move getSubsectionInsertionPoint to MCSection.
Modified:
llvm/trunk/include/llvm/MC/MCSection.h
llvm/trunk/lib/MC/MCAssembler.cpp
llvm/trunk/lib/MC/MCObjectStreamer.cpp
llvm/trunk/lib/MC/MCSection.cpp
Modified: llvm/trunk/include/llvm/MC/MCSection.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCSection.h?rev=238320&r1=238319&r2=238320&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCSection.h (original)
+++ llvm/trunk/include/llvm/MC/MCSection.h Wed May 27 08:37:28 2015
@@ -33,6 +33,7 @@ class raw_ostream;
class MCSectionData {
friend class MCAsmLayout;
+ friend class MCSection;
MCSectionData(const MCSectionData &) = delete;
void operator=(const MCSectionData &) = delete;
@@ -96,8 +97,6 @@ public:
bool empty() const;
- iterator getSubsectionInsertionPoint(unsigned Subsection);
-
void dump();
/// @}
@@ -220,6 +219,8 @@ public:
return const_cast<MCSection *>(this)->rend();
}
+ MCSectionData::iterator getSubsectionInsertionPoint(unsigned Subsection);
+
virtual void PrintSwitchToSection(const MCAsmInfo &MAI, raw_ostream &OS,
const MCExpr *Subsection) const = 0;
Modified: llvm/trunk/lib/MC/MCAssembler.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAssembler.cpp?rev=238320&r1=238319&r2=238320&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCAssembler.cpp (original)
+++ llvm/trunk/lib/MC/MCAssembler.cpp Wed May 27 08:37:28 2015
@@ -290,37 +290,6 @@ MCEncodedFragmentWithFixups::~MCEncodedF
MCSectionData::MCSectionData(MCSection &Section) : Section(&Section) {}
-MCSectionData::iterator
-MCSectionData::getSubsectionInsertionPoint(unsigned Subsection) {
- if (Subsection == 0 && SubsectionFragmentMap.empty())
- return end();
-
- SmallVectorImpl<std::pair<unsigned, MCFragment *> >::iterator MI =
- std::lower_bound(SubsectionFragmentMap.begin(), SubsectionFragmentMap.end(),
- std::make_pair(Subsection, (MCFragment *)nullptr));
- bool ExactMatch = false;
- if (MI != SubsectionFragmentMap.end()) {
- ExactMatch = MI->first == Subsection;
- if (ExactMatch)
- ++MI;
- }
- iterator IP;
- if (MI == SubsectionFragmentMap.end())
- IP = end();
- else
- IP = MI->second;
- if (!ExactMatch && Subsection != 0) {
- // The GNU as documentation claims that subsections have an alignment of 4,
- // although this appears not to be the case.
- MCFragment *F = new MCDataFragment();
- SubsectionFragmentMap.insert(MI, std::make_pair(Subsection, F));
- getFragmentList().insert(IP, F);
- F->setParent(&getSection());
- }
-
- return IP;
-}
-
/* *** */
MCAssembler::MCAssembler(MCContext &Context_, MCAsmBackend &Backend_,
Modified: llvm/trunk/lib/MC/MCObjectStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCObjectStreamer.cpp?rev=238320&r1=238319&r2=238320&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCObjectStreamer.cpp (original)
+++ llvm/trunk/lib/MC/MCObjectStreamer.cpp Wed May 27 08:37:28 2015
@@ -221,8 +221,7 @@ bool MCObjectStreamer::changeSectionImpl
if (IntSubsection < 0 || IntSubsection > 8192)
report_fatal_error("Subsection number out of range");
CurInsertionPoint =
- CurSectionData->getSectionData().getSubsectionInsertionPoint(
- unsigned(IntSubsection));
+ CurSectionData->getSubsectionInsertionPoint(unsigned(IntSubsection));
return Created;
}
Modified: llvm/trunk/lib/MC/MCSection.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCSection.cpp?rev=238320&r1=238319&r2=238320&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCSection.cpp (original)
+++ llvm/trunk/lib/MC/MCSection.cpp Wed May 27 08:37:28 2015
@@ -52,6 +52,38 @@ void MCSection::setBundleLockState(Bundl
++BundleLockNestingDepth;
}
+MCSectionData::iterator
+MCSection::getSubsectionInsertionPoint(unsigned Subsection) {
+ if (Subsection == 0 && Data.SubsectionFragmentMap.empty())
+ return end();
+
+ SmallVectorImpl<std::pair<unsigned, MCFragment *>>::iterator MI =
+ std::lower_bound(Data.SubsectionFragmentMap.begin(),
+ Data.SubsectionFragmentMap.end(),
+ std::make_pair(Subsection, (MCFragment *)nullptr));
+ bool ExactMatch = false;
+ if (MI != Data.SubsectionFragmentMap.end()) {
+ ExactMatch = MI->first == Subsection;
+ if (ExactMatch)
+ ++MI;
+ }
+ MCSectionData::iterator IP;
+ if (MI == Data.SubsectionFragmentMap.end())
+ IP = end();
+ else
+ IP = MI->second;
+ if (!ExactMatch && Subsection != 0) {
+ // The GNU as documentation claims that subsections have an alignment of 4,
+ // although this appears not to be the case.
+ MCFragment *F = new MCDataFragment();
+ Data.SubsectionFragmentMap.insert(MI, std::make_pair(Subsection, F));
+ getFragmentList().insert(IP, F);
+ F->setParent(this);
+ }
+
+ return IP;
+}
+
MCSectionData::iterator MCSection::begin() { return Data.begin(); }
MCSectionData::iterator MCSection::end() { return Data.end(); }
More information about the llvm-commits
mailing list