summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-03-25 07:10:11 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-03-25 07:10:11 +0000
commit4108802628a0676f40092b93b4b71cf534fbd257 (patch)
tree56fb14ccdab3e65d99cbbdb4aeb7b8d7041b2afb /llvm/lib/MC
parenteaa792f0d96fdc65e113a4ece68c6689fc6fa57a (diff)
downloadbcm5719-llvm-4108802628a0676f40092b93b4b71cf534fbd257.tar.gz
bcm5719-llvm-4108802628a0676f40092b93b4b71cf534fbd257.zip
MC: Explicity track section and fragment ordinals.
llvm-svn: 99500
Diffstat (limited to 'llvm/lib/MC')
-rw-r--r--llvm/lib/MC/MCAssembler.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/lib/MC/MCAssembler.cpp b/llvm/lib/MC/MCAssembler.cpp
index 8efc78c1f9a..5190239f5a3 100644
--- a/llvm/lib/MC/MCAssembler.cpp
+++ b/llvm/lib/MC/MCAssembler.cpp
@@ -568,6 +568,18 @@ 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) {
+ it->setOrdinal(SectionIndex++);
+
+ for (MCSectionData::iterator it2 = it->begin(),
+ ie2 = it->end(); it2 != ie2; ++it2)
+ it2->setOrdinal(FragmentIndex++);
+ }
+
// Layout until everything fits.
MCAsmLayout Layout(*this);
while (LayoutOnce(Layout))
@@ -781,6 +793,7 @@ void MCAssembler::FinishLayout(MCAsmLayout &Layout) {
//
// FIXME: Add MCAsmLayout utility for this.
DF->setParent(IF->getParent());
+ DF->setOrdinal(IF->getOrdinal());
Layout.setFragmentOffset(DF, Layout.getFragmentOffset(IF));
Layout.setFragmentEffectiveSize(DF, Layout.getFragmentEffectiveSize(IF));
OpenPOWER on IntegriCloud