diff options
author | Daniel Dunbar <daniel@zuster.org> | 2010-05-14 00:37:14 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2010-05-14 00:37:14 +0000 |
commit | 8f9d2266e66ab9464a63a0d239135d139cd705a3 (patch) | |
tree | 348b2f3f5b636e2e7098c121447834dbfaba8626 /llvm/lib/MC/MCAssembler.cpp | |
parent | a99a23b061815f48c1bb145aeda85663debc7d68 (diff) | |
download | bcm5719-llvm-8f9d2266e66ab9464a63a0d239135d139cd705a3.tar.gz bcm5719-llvm-8f9d2266e66ab9464a63a0d239135d139cd705a3.zip |
MC: Switch MCFragment to storing the layout order index, not its index in the file.
llvm-svn: 103751
Diffstat (limited to 'llvm/lib/MC/MCAssembler.cpp')
-rw-r--r-- | llvm/lib/MC/MCAssembler.cpp | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/llvm/lib/MC/MCAssembler.cpp b/llvm/lib/MC/MCAssembler.cpp index 57214af2966..47c891534f5 100644 --- a/llvm/lib/MC/MCAssembler.cpp +++ b/llvm/lib/MC/MCAssembler.cpp @@ -599,10 +599,6 @@ void MCAssembler::Finish() { // Create the layout object. MCAsmLayout Layout(*this); - // Assign layout order indices. - for (unsigned i = 0, e = Layout.getSectionOrder().size(); i != e; ++i) - Layout.getSectionOrder()[i]->setLayoutOrder(i); - // Insert additional align fragments for concrete sections to explicitly pad // the previous section to match their alignment requirements. This is for // 'gas' compatibility, it shouldn't strictly be necessary. @@ -627,10 +623,8 @@ void MCAssembler::Finish() { AF->setOnlyAlignAddress(true); } - // Assign section and fragment ordinals, all subsequent backend code is - // responsible for updating these in place. + // Create dummy fragments and assign section ordinals. unsigned SectionIndex = 0; - unsigned FragmentIndex = 0; for (MCAssembler::iterator it = begin(), ie = end(); it != ie; ++it) { // Create dummy fragments to eliminate any empty sections, this simplifies // layout. @@ -642,10 +636,17 @@ void MCAssembler::Finish() { } it->setOrdinal(SectionIndex++); + } - for (MCSectionData::iterator it2 = it->begin(), - ie2 = it->end(); it2 != ie2; ++it2) - it2->setOrdinal(FragmentIndex++); + // Assign layout order indices to sections and fragments. + unsigned FragmentIndex = 0; + for (unsigned i = 0, e = Layout.getSectionOrder().size(); i != e; ++i) { + MCSectionData *SD = Layout.getSectionOrder()[i]; + SD->setLayoutOrder(i); + + for (MCSectionData::iterator it2 = SD->begin(), + ie2 = SD->end(); it2 != ie2; ++it2) + it2->setLayoutOrder(FragmentIndex++); } // Layout until everything fits. @@ -827,7 +828,7 @@ void MCAssembler::FinishLayout(MCAsmLayout &Layout) { // Update the data fragments layout data. DF->setParent(IF->getParent()); DF->setAtom(IF->getAtom()); - DF->setOrdinal(IF->getOrdinal()); + DF->setLayoutOrder(IF->getLayoutOrder()); Layout.FragmentReplaced(IF, DF); // Copy in the data and the fixups. @@ -857,8 +858,8 @@ raw_ostream &operator<<(raw_ostream &OS, const MCAsmFixup &AF) { void MCFragment::dump() { raw_ostream &OS = llvm::errs(); - OS << "<MCFragment " << (void*) this << " Offset:" << Offset - << " EffectiveSize:" << EffectiveSize << ">"; + OS << "<MCFragment " << (void*) this << " LayoutOrder:" << LayoutOrder + << " Offset:" << Offset << " EffectiveSize:" << EffectiveSize << ">"; } void MCAlignFragment::dump() { |