summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/MC/ELFObjectWriter.cpp4
-rw-r--r--llvm/lib/MC/MCAssembler.cpp34
-rw-r--r--llvm/lib/MC/MCMachOStreamer.cpp4
-rw-r--r--llvm/lib/MC/MCObjectStreamer.cpp2
-rw-r--r--llvm/lib/MC/MCSection.cpp47
5 files changed, 37 insertions, 54 deletions
diff --git a/llvm/lib/MC/ELFObjectWriter.cpp b/llvm/lib/MC/ELFObjectWriter.cpp
index b51ba758f4b..18746d1aa78 100644
--- a/llvm/lib/MC/ELFObjectWriter.cpp
+++ b/llvm/lib/MC/ELFObjectWriter.cpp
@@ -1096,7 +1096,7 @@ ELFObjectWriter::createRelocationSection(MCContext &Ctx,
static SmallVector<char, 128>
getUncompressedData(const MCAsmLayout &Layout,
- const MCSectionData::FragmentListType &Fragments) {
+ const MCSection::FragmentListType &Fragments) {
SmallVector<char, 128> UncompressedData;
for (const MCFragment &F : Fragments) {
const SmallVectorImpl<char> *Contents;
@@ -1154,7 +1154,7 @@ void ELFObjectWriter::writeSectionData(const MCAssembler &Asm, MCSection &Sec,
}
// Gather the uncompressed data from all the fragments.
- const MCSectionData::FragmentListType &Fragments = Section.getFragmentList();
+ const MCSection::FragmentListType &Fragments = Section.getFragmentList();
SmallVector<char, 128> UncompressedData =
getUncompressedData(Layout, Fragments);
diff --git a/llvm/lib/MC/MCAssembler.cpp b/llvm/lib/MC/MCAssembler.cpp
index ec2518c77dd..868b0f1228a 100644
--- a/llvm/lib/MC/MCAssembler.cpp
+++ b/llvm/lib/MC/MCAssembler.cpp
@@ -288,10 +288,6 @@ MCEncodedFragmentWithFixups::~MCEncodedFragmentWithFixups() {
/* *** */
-MCSectionData::MCSectionData(MCSection &Section) : Section(&Section) {}
-
-/* *** */
-
MCAssembler::MCAssembler(MCContext &Context_, MCAsmBackend &Backend_,
MCCodeEmitter &Emitter_, MCObjectWriter &Writer_,
raw_ostream &OS_)
@@ -744,8 +740,8 @@ void MCAssembler::writeSectionData(const MCSection *Sec,
assert(Layout.getSectionFileSize(Sec) == 0 && "Invalid size for section!");
// Check that contents are only things legal inside a virtual section.
- for (MCSectionData::const_iterator it = Sec->begin(), ie = Sec->end();
- it != ie; ++it) {
+ for (MCSection::const_iterator it = Sec->begin(), ie = Sec->end(); it != ie;
+ ++it) {
switch (it->getKind()) {
default: llvm_unreachable("Invalid fragment in virtual section!");
case MCFragment::FT_Data: {
@@ -786,8 +782,8 @@ void MCAssembler::writeSectionData(const MCSection *Sec,
uint64_t Start = getWriter().getStream().tell();
(void)Start;
- for (MCSectionData::const_iterator it = Sec->begin(), ie = Sec->end();
- it != ie; ++it)
+ for (MCSection::const_iterator it = Sec->begin(), ie = Sec->end(); it != ie;
+ ++it)
writeFragment(*this, Layout, *it);
assert(getWriter().getStream().tell() - Start ==
@@ -837,7 +833,7 @@ void MCAssembler::Finish() {
Sec->setLayoutOrder(i);
unsigned FragmentIndex = 0;
- for (MCSectionData::iterator iFrag = Sec->begin(), iFragEnd = Sec->end();
+ for (MCSection::iterator iFrag = Sec->begin(), iFragEnd = Sec->end();
iFrag != iFragEnd; ++iFrag)
iFrag->setLayoutOrder(FragmentIndex++);
}
@@ -865,8 +861,8 @@ void MCAssembler::Finish() {
// Evaluate and apply the fixups, generating relocation entries as necessary.
for (MCAssembler::iterator it = begin(), ie = end(); it != ie; ++it) {
- for (MCSectionData::iterator it2 = it->begin(),
- ie2 = it->end(); it2 != ie2; ++it2) {
+ for (MCSection::iterator it2 = it->begin(), ie2 = it->end(); it2 != ie2;
+ ++it2) {
MCEncodedFragmentWithFixups *F =
dyn_cast<MCEncodedFragmentWithFixups>(it2);
if (F) {
@@ -1009,7 +1005,7 @@ bool MCAssembler::layoutSectionOnce(MCAsmLayout &Layout, MCSection &Sec) {
MCFragment *FirstRelaxedFragment = nullptr;
// Attempt to relax all the fragments in the section.
- for (MCSectionData::iterator I = Sec.begin(), IE = Sec.end(); I != IE; ++I) {
+ for (MCSection::iterator I = Sec.begin(), IE = Sec.end(); I != IE; ++I) {
// Check if this is a fragment that needs relaxation.
bool RelaxedFrag = false;
switch(I->getKind()) {
@@ -1188,18 +1184,6 @@ void MCFragment::dump() {
OS << ">";
}
-void MCSectionData::dump() {
- raw_ostream &OS = llvm::errs();
-
- OS << "<MCSectionData";
- OS << " Fragments:[\n ";
- for (iterator it = begin(), ie = end(); it != ie; ++it) {
- if (it != begin()) OS << ",\n ";
- it->dump();
- }
- OS << "]>";
-}
-
void MCSymbolData::dump() const {
raw_ostream &OS = llvm::errs();
@@ -1225,7 +1209,7 @@ void MCAssembler::dump() {
OS << " Sections:[\n ";
for (iterator it = begin(), ie = end(); it != ie; ++it) {
if (it != begin()) OS << ",\n ";
- it->getSectionData().dump();
+ it->dump();
}
OS << "],\n";
OS << " Symbols:[";
diff --git a/llvm/lib/MC/MCMachOStreamer.cpp b/llvm/lib/MC/MCMachOStreamer.cpp
index 011db484751..629734036f5 100644
--- a/llvm/lib/MC/MCMachOStreamer.cpp
+++ b/llvm/lib/MC/MCMachOStreamer.cpp
@@ -479,8 +479,8 @@ void MCMachOStreamer::FinishImpl() {
for (MCAssembler::iterator it = getAssembler().begin(),
ie = getAssembler().end(); it != ie; ++it) {
const MCSymbol *CurrentAtom = nullptr;
- for (MCSectionData::iterator it2 = it->begin(),
- ie2 = it->end(); it2 != ie2; ++it2) {
+ for (MCSection::iterator it2 = it->begin(), ie2 = it->end(); it2 != ie2;
+ ++it2) {
if (const MCSymbol *Symbol = DefiningSymbolMap.lookup(it2))
CurrentAtom = Symbol;
it2->setAtom(CurrentAtom);
diff --git a/llvm/lib/MC/MCObjectStreamer.cpp b/llvm/lib/MC/MCObjectStreamer.cpp
index 18d2b66b2ae..176f5e723d0 100644
--- a/llvm/lib/MC/MCObjectStreamer.cpp
+++ b/llvm/lib/MC/MCObjectStreamer.cpp
@@ -80,7 +80,7 @@ void MCObjectStreamer::reset() {
if (Assembler)
Assembler->reset();
CurSectionData = nullptr;
- CurInsertionPoint = MCSectionData::iterator();
+ CurInsertionPoint = MCSection::iterator();
EmitEHFrame = true;
EmitDebugFrame = false;
PendingLabels.clear();
diff --git a/llvm/lib/MC/MCSection.cpp b/llvm/lib/MC/MCSection.cpp
index adfc6b35abb..26c6aad557f 100644
--- a/llvm/lib/MC/MCSection.cpp
+++ b/llvm/lib/MC/MCSection.cpp
@@ -20,7 +20,7 @@ using namespace llvm;
//===----------------------------------------------------------------------===//
MCSection::MCSection(SectionVariant V, SectionKind K, MCSymbol *Begin)
- : Begin(Begin), HasInstructions(false), Data(*this), Variant(V), Kind(K) {}
+ : Begin(Begin), HasInstructions(false), Variant(V), Kind(K) {}
MCSymbol *MCSection::getEndSymbol(MCContext &Ctx) {
if (!End)
@@ -52,23 +52,23 @@ void MCSection::setBundleLockState(BundleLockStateType NewState) {
++BundleLockNestingDepth;
}
-MCSectionData::iterator
+MCSection::iterator
MCSection::getSubsectionInsertionPoint(unsigned Subsection) {
- if (Subsection == 0 && Data.SubsectionFragmentMap.empty())
+ if (Subsection == 0 && SubsectionFragmentMap.empty())
return end();
SmallVectorImpl<std::pair<unsigned, MCFragment *>>::iterator MI =
- std::lower_bound(Data.SubsectionFragmentMap.begin(),
- Data.SubsectionFragmentMap.end(),
+ std::lower_bound(SubsectionFragmentMap.begin(),
+ SubsectionFragmentMap.end(),
std::make_pair(Subsection, (MCFragment *)nullptr));
bool ExactMatch = false;
- if (MI != Data.SubsectionFragmentMap.end()) {
+ if (MI != SubsectionFragmentMap.end()) {
ExactMatch = MI->first == Subsection;
if (ExactMatch)
++MI;
}
- MCSectionData::iterator IP;
- if (MI == Data.SubsectionFragmentMap.end())
+ iterator IP;
+ if (MI == SubsectionFragmentMap.end())
IP = end();
else
IP = MI->second;
@@ -76,7 +76,7 @@ MCSection::getSubsectionInsertionPoint(unsigned Subsection) {
// 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));
+ SubsectionFragmentMap.insert(MI, std::make_pair(Subsection, F));
getFragmentList().insert(IP, F);
F->setParent(this);
}
@@ -84,24 +84,23 @@ MCSection::getSubsectionInsertionPoint(unsigned Subsection) {
return IP;
}
-MCSectionData::iterator MCSection::begin() { return Data.begin(); }
+void MCSection::dump() {
+ raw_ostream &OS = llvm::errs();
-MCSectionData::iterator MCSection::end() { return Data.end(); }
-
-MCSectionData::reverse_iterator MCSection::rbegin() { return Data.rbegin(); }
-
-MCSectionData::FragmentListType &MCSection::getFragmentList() {
- return Data.getFragmentList();
+ OS << "<MCSection";
+ OS << " Fragments:[\n ";
+ for (auto it = begin(), ie = end(); it != ie; ++it) {
+ if (it != begin())
+ OS << ",\n ";
+ it->dump();
+ }
+ OS << "]>";
}
-MCSectionData::iterator MCSectionData::begin() { return Fragments.begin(); }
+MCSection::iterator MCSection::begin() { return Fragments.begin(); }
-MCSectionData::iterator MCSectionData::end() { return Fragments.end(); }
+MCSection::iterator MCSection::end() { return Fragments.end(); }
-MCSectionData::reverse_iterator MCSectionData::rbegin() {
- return Fragments.rbegin();
-}
+MCSection::reverse_iterator MCSection::rbegin() { return Fragments.rbegin(); }
-MCSectionData::reverse_iterator MCSectionData::rend() {
- return Fragments.rend();
-}
+MCSection::reverse_iterator MCSection::rend() { return Fragments.rend(); }
OpenPOWER on IntegriCloud