[llvm-commits] [llvm] r99500 - in /llvm/trunk: include/llvm/MC/MCAssembler.h lib/MC/MCAssembler.cpp
Daniel Dunbar
daniel at zuster.org
Thu Mar 25 00:10:12 PDT 2010
Author: ddunbar
Date: Thu Mar 25 02:10:11 2010
New Revision: 99500
URL: http://llvm.org/viewvc/llvm-project?rev=99500&view=rev
Log:
MC: Explicity track section and fragment ordinals.
Modified:
llvm/trunk/include/llvm/MC/MCAssembler.h
llvm/trunk/lib/MC/MCAssembler.cpp
Modified: llvm/trunk/include/llvm/MC/MCAssembler.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCAssembler.h?rev=99500&r1=99499&r2=99500&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCAssembler.h (original)
+++ llvm/trunk/include/llvm/MC/MCAssembler.h Thu Mar 25 02:10:11 2010
@@ -91,6 +91,10 @@
/// initialized.
uint64_t EffectiveSize;
+ /// Ordinal - The global index of this fragment. This is the index across all
+ /// sections, not just the parent section.
+ unsigned Ordinal;
+
/// @}
protected:
@@ -106,6 +110,9 @@
MCSectionData *getParent() const { return Parent; }
void setParent(MCSectionData *Value) { Parent = Value; }
+ unsigned getOrdinal() const { return Ordinal; }
+ void setOrdinal(unsigned Value) { Ordinal = Value; }
+
static bool classof(const MCFragment *O) { return true; }
virtual void dump();
@@ -390,6 +397,9 @@
iplist<MCFragment> Fragments;
const MCSection *Section;
+ /// Ordinal - The section index in the assemblers section list.
+ unsigned Ordinal;
+
/// Alignment - The maximum alignment seen in this section.
unsigned Alignment;
@@ -428,6 +438,9 @@
bool hasInstructions() const { return HasInstructions; }
void setHasInstructions(bool Value) { HasInstructions = Value; }
+ unsigned getOrdinal() const { return Ordinal; }
+ void setOrdinal(unsigned Value) { Ordinal = Value; }
+
/// @name Fragment Access
/// @{
@@ -451,6 +464,8 @@
bool empty() const { return Fragments.empty(); }
void dump();
+
+ /// @}
};
// FIXME: Same concerns as with SectionData.
Modified: llvm/trunk/lib/MC/MCAssembler.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAssembler.cpp?rev=99500&r1=99499&r2=99500&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCAssembler.cpp (original)
+++ llvm/trunk/lib/MC/MCAssembler.cpp Thu Mar 25 02:10:11 2010
@@ -568,6 +568,18 @@
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 @@
//
// 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));
More information about the llvm-commits
mailing list