mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-19 02:25:01 +00:00
MC: Switch MCFragment to storing the layout order index, not its index in the file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103751 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -96,9 +96,9 @@ private:
|
|||||||
/// initialized.
|
/// initialized.
|
||||||
uint64_t EffectiveSize;
|
uint64_t EffectiveSize;
|
||||||
|
|
||||||
/// Ordinal - The global index of this fragment. This is the index across all
|
/// LayoutOrder - The global layout order of this fragment. This is the index
|
||||||
/// sections, not just the parent section.
|
/// across all fragments in the file, not just within the section.
|
||||||
unsigned Ordinal;
|
unsigned LayoutOrder;
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
@@ -118,8 +118,8 @@ public:
|
|||||||
MCSymbolData *getAtom() const { return Atom; }
|
MCSymbolData *getAtom() const { return Atom; }
|
||||||
void setAtom(MCSymbolData *Value) { Atom = Value; }
|
void setAtom(MCSymbolData *Value) { Atom = Value; }
|
||||||
|
|
||||||
unsigned getOrdinal() const { return Ordinal; }
|
unsigned getLayoutOrder() const { return LayoutOrder; }
|
||||||
void setOrdinal(unsigned Value) { Ordinal = Value; }
|
void setLayoutOrder(unsigned Value) { LayoutOrder = Value; }
|
||||||
|
|
||||||
static bool classof(const MCFragment *O) { return true; }
|
static bool classof(const MCFragment *O) { return true; }
|
||||||
|
|
||||||
|
@@ -599,10 +599,6 @@ void MCAssembler::Finish() {
|
|||||||
// Create the layout object.
|
// Create the layout object.
|
||||||
MCAsmLayout Layout(*this);
|
MCAsmLayout Layout(*this);
|
||||||
|
|
||||||
// Assign layout order indices.
|
|
||||||
for (unsigned i = 0, e = Layout.getSectionOrder().size(); i != e; ++i)
|
|
||||||
Layout.getSectionOrder()[i]->setLayoutOrder(i);
|
|
||||||
|
|
||||||
// Insert additional align fragments for concrete sections to explicitly pad
|
// Insert additional align fragments for concrete sections to explicitly pad
|
||||||
// the previous section to match their alignment requirements. This is for
|
// the previous section to match their alignment requirements. This is for
|
||||||
// 'gas' compatibility, it shouldn't strictly be necessary.
|
// 'gas' compatibility, it shouldn't strictly be necessary.
|
||||||
@@ -627,10 +623,8 @@ void MCAssembler::Finish() {
|
|||||||
AF->setOnlyAlignAddress(true);
|
AF->setOnlyAlignAddress(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Assign section and fragment ordinals, all subsequent backend code is
|
// Create dummy fragments and assign section ordinals.
|
||||||
// responsible for updating these in place.
|
|
||||||
unsigned SectionIndex = 0;
|
unsigned SectionIndex = 0;
|
||||||
unsigned FragmentIndex = 0;
|
|
||||||
for (MCAssembler::iterator it = begin(), ie = end(); it != ie; ++it) {
|
for (MCAssembler::iterator it = begin(), ie = end(); it != ie; ++it) {
|
||||||
// Create dummy fragments to eliminate any empty sections, this simplifies
|
// Create dummy fragments to eliminate any empty sections, this simplifies
|
||||||
// layout.
|
// layout.
|
||||||
@@ -642,10 +636,17 @@ void MCAssembler::Finish() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
it->setOrdinal(SectionIndex++);
|
it->setOrdinal(SectionIndex++);
|
||||||
|
}
|
||||||
|
|
||||||
for (MCSectionData::iterator it2 = it->begin(),
|
// Assign layout order indices to sections and fragments.
|
||||||
ie2 = it->end(); it2 != ie2; ++it2)
|
unsigned FragmentIndex = 0;
|
||||||
it2->setOrdinal(FragmentIndex++);
|
for (unsigned i = 0, e = Layout.getSectionOrder().size(); i != e; ++i) {
|
||||||
|
MCSectionData *SD = Layout.getSectionOrder()[i];
|
||||||
|
SD->setLayoutOrder(i);
|
||||||
|
|
||||||
|
for (MCSectionData::iterator it2 = SD->begin(),
|
||||||
|
ie2 = SD->end(); it2 != ie2; ++it2)
|
||||||
|
it2->setLayoutOrder(FragmentIndex++);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Layout until everything fits.
|
// Layout until everything fits.
|
||||||
@@ -827,7 +828,7 @@ void MCAssembler::FinishLayout(MCAsmLayout &Layout) {
|
|||||||
// Update the data fragments layout data.
|
// Update the data fragments layout data.
|
||||||
DF->setParent(IF->getParent());
|
DF->setParent(IF->getParent());
|
||||||
DF->setAtom(IF->getAtom());
|
DF->setAtom(IF->getAtom());
|
||||||
DF->setOrdinal(IF->getOrdinal());
|
DF->setLayoutOrder(IF->getLayoutOrder());
|
||||||
Layout.FragmentReplaced(IF, DF);
|
Layout.FragmentReplaced(IF, DF);
|
||||||
|
|
||||||
// Copy in the data and the fixups.
|
// Copy in the data and the fixups.
|
||||||
@@ -857,8 +858,8 @@ raw_ostream &operator<<(raw_ostream &OS, const MCAsmFixup &AF) {
|
|||||||
void MCFragment::dump() {
|
void MCFragment::dump() {
|
||||||
raw_ostream &OS = llvm::errs();
|
raw_ostream &OS = llvm::errs();
|
||||||
|
|
||||||
OS << "<MCFragment " << (void*) this << " Offset:" << Offset
|
OS << "<MCFragment " << (void*) this << " LayoutOrder:" << LayoutOrder
|
||||||
<< " EffectiveSize:" << EffectiveSize << ">";
|
<< " Offset:" << Offset << " EffectiveSize:" << EffectiveSize << ">";
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCAlignFragment::dump() {
|
void MCAlignFragment::dump() {
|
||||||
|
Reference in New Issue
Block a user