summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-05-13 08:43:37 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-05-13 08:43:37 +0000
commit49ed9211905ec586f1d23a7f337d335ae63b4635 (patch)
tree8a9d6681f1e7cab4a0d99a4c8c8491a5eafa06a9
parent09d3465f0e4e5bb1bb858e0e4dececf4f7ab6741 (diff)
downloadllvm-49ed9211905ec586f1d23a7f337d335ae63b4635.tar.gz
llvm-49ed9211905ec586f1d23a7f337d335ae63b4635.tar.bz2
llvm-49ed9211905ec586f1d23a7f337d335ae63b4635.tar.xz
MC: Move ordinal calculation, to make sure fragments synthesized for layout get assigned ordinals properly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103711 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/MC/MCAssembler.cpp42
1 files changed, 21 insertions, 21 deletions
diff --git a/lib/MC/MCAssembler.cpp b/lib/MC/MCAssembler.cpp
index 291ae85895..ac91bad8ac 100644
--- a/lib/MC/MCAssembler.cpp
+++ b/lib/MC/MCAssembler.cpp
@@ -598,27 +598,6 @@ void MCAssembler::Finish() {
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 @@ void MCAssembler::Finish() {
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;