diff options
author | Daniel Dunbar <daniel@zuster.org> | 2010-05-13 08:43:37 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2010-05-13 08:43:37 +0000 |
commit | aa8bd69886f03d3b8ce4d45f1d9e80f908273d24 (patch) | |
tree | eb151a65c72eed1072b25dbac9aef09658e274dc /llvm/lib/MC/MCAssembler.cpp | |
parent | e73353c7201a3080851d99a16f5fe2c17f7697c6 (diff) | |
download | bcm5719-llvm-aa8bd69886f03d3b8ce4d45f1d9e80f908273d24.tar.gz bcm5719-llvm-aa8bd69886f03d3b8ce4d45f1d9e80f908273d24.zip |
MC: Move ordinal calculation, to make sure fragments synthesized for layout get assigned ordinals properly.
llvm-svn: 103711
Diffstat (limited to 'llvm/lib/MC/MCAssembler.cpp')
-rw-r--r-- | llvm/lib/MC/MCAssembler.cpp | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/llvm/lib/MC/MCAssembler.cpp b/llvm/lib/MC/MCAssembler.cpp index 291ae85895b..ac91bad8ac8 100644 --- a/llvm/lib/MC/MCAssembler.cpp +++ b/llvm/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; |