/// 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:
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();
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;
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
/// @{
bool empty() const { return Fragments.empty(); }
void dump();
+
+ /// @}
};
// FIXME: Same concerns as with SectionData.
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))
//
// 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));