[llvm-commits] [llvm] r103711 - /llvm/trunk/lib/MC/MCAssembler.cpp
Daniel Dunbar
daniel at zuster.org
Thu May 13 01:43:37 PDT 2010
Author: ddunbar
Date: Thu May 13 03:43:37 2010
New Revision: 103711
URL: http://llvm.org/viewvc/llvm-project?rev=103711&view=rev
Log:
MC: Move ordinal calculation, to make sure fragments synthesized for layout get assigned ordinals properly.
Modified:
llvm/trunk/lib/MC/MCAssembler.cpp
Modified: llvm/trunk/lib/MC/MCAssembler.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAssembler.cpp?rev=103711&r1=103710&r2=103711&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCAssembler.cpp (original)
+++ llvm/trunk/lib/MC/MCAssembler.cpp Thu May 13 03:43:37 2010
@@ -598,27 +598,6 @@
llvm::errs() << "assembler backend - pre-layout\n--\n";
dump(); });
- // Assign section and fragment ordinals, all subsequent backend code is
- // responsible for updating these in place.
- 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.
- if (it->getFragmentList().empty()) {
- unsigned ValueSize = 1;
- if (getBackend().isVirtualSection(it->getSection()))
- ValueSize = 1;
- new MCFillFragment(0, 1, 0, it);
- }
-
- it->setOrdinal(SectionIndex++);
-
- for (MCSectionData::iterator it2 = it->begin(),
- ie2 = it->end(); it2 != ie2; ++it2)
- it2->setOrdinal(FragmentIndex++);
- }
-
// Create the layout object.
MCAsmLayout Layout(*this);
@@ -646,6 +625,27 @@
AF->setOnlyAlignAddress(true);
}
+ // Assign section and fragment ordinals, all subsequent backend code is
+ // responsible for updating these in place.
+ 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.
+ if (it->getFragmentList().empty()) {
+ unsigned ValueSize = 1;
+ if (getBackend().isVirtualSection(it->getSection()))
+ ValueSize = 1;
+ new MCFillFragment(0, 1, 0, it);
+ }
+
+ it->setOrdinal(SectionIndex++);
+
+ for (MCSectionData::iterator it2 = it->begin(),
+ ie2 = it->end(); it2 != ie2; ++it2)
+ it2->setOrdinal(FragmentIndex++);
+ }
+
// Layout until everything fits.
while (LayoutOnce(Layout))
continue;
More information about the llvm-commits
mailing list