mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-04 18:24:38 +00:00
Cleanup formatting, comments and naming.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169762 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -21,10 +21,10 @@ class MCSymbolData;
|
|||||||
|
|
||||||
/// Encapsulates the layout of an assembly file at a particular point in time.
|
/// Encapsulates the layout of an assembly file at a particular point in time.
|
||||||
///
|
///
|
||||||
/// Assembly may requiring compute multiple layouts for a particular assembly
|
/// Assembly may require computing multiple layouts for a particular assembly
|
||||||
/// file as part of the relaxation process. This class encapsulates the layout
|
/// file as part of the relaxation process. This class encapsulates the layout
|
||||||
/// at a single point in time in such a way that it is always possible to
|
/// at a single point in time in such a way that it is always possible to
|
||||||
/// efficiently compute the exact addresses of any symbol in the assembly file,
|
/// efficiently compute the exact address of any symbol in the assembly file,
|
||||||
/// even during the relaxation process.
|
/// even during the relaxation process.
|
||||||
class MCAsmLayout {
|
class MCAsmLayout {
|
||||||
public:
|
public:
|
||||||
@ -54,9 +54,9 @@ public:
|
|||||||
/// Get the assembler object this is a layout for.
|
/// Get the assembler object this is a layout for.
|
||||||
MCAssembler &getAssembler() const { return Assembler; }
|
MCAssembler &getAssembler() const { return Assembler; }
|
||||||
|
|
||||||
/// \brief Invalidate all following fragments because a fragment has been
|
/// \brief Invalidate the fragments after F because it has been resized.
|
||||||
/// resized. The fragments size should have already been updated.
|
/// The fragment's size should have already been updated.
|
||||||
void Invalidate(MCFragment *F);
|
void invalidateFragmentsAfter(MCFragment *F);
|
||||||
|
|
||||||
/// \brief Perform layout for a single fragment, assuming that the previous
|
/// \brief Perform layout for a single fragment, assuming that the previous
|
||||||
/// fragment has already been laid out correctly, and the parent section has
|
/// fragment has already been laid out correctly, and the parent section has
|
||||||
|
@ -738,10 +738,12 @@ private:
|
|||||||
bool fragmentNeedsRelaxation(const MCInstFragment *IF,
|
bool fragmentNeedsRelaxation(const MCInstFragment *IF,
|
||||||
const MCAsmLayout &Layout) const;
|
const MCAsmLayout &Layout) const;
|
||||||
|
|
||||||
/// layoutOnce - Perform one layout iteration and return true if any offsets
|
/// \brief Perform one layout iteration and return true if any offsets
|
||||||
/// were adjusted.
|
/// were adjusted.
|
||||||
bool layoutOnce(MCAsmLayout &Layout);
|
bool layoutOnce(MCAsmLayout &Layout);
|
||||||
|
|
||||||
|
/// \brief Perform one layout iteration of the given section and return true
|
||||||
|
/// if any offsets were adjusted.
|
||||||
bool layoutSectionOnce(MCAsmLayout &Layout, MCSectionData &SD);
|
bool layoutSectionOnce(MCAsmLayout &Layout, MCSectionData &SD);
|
||||||
|
|
||||||
bool relaxInstruction(MCAsmLayout &Layout, MCInstFragment &IF);
|
bool relaxInstruction(MCAsmLayout &Layout, MCInstFragment &IF);
|
||||||
|
@ -80,7 +80,7 @@ bool MCAsmLayout::isFragmentUpToDate(const MCFragment *F) const {
|
|||||||
return F->getLayoutOrder() <= LastValid->getLayoutOrder();
|
return F->getLayoutOrder() <= LastValid->getLayoutOrder();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCAsmLayout::Invalidate(MCFragment *F) {
|
void MCAsmLayout::invalidateFragmentsAfter(MCFragment *F) {
|
||||||
// If this fragment wasn't already up-to-date, we don't need to do anything.
|
// If this fragment wasn't already up-to-date, we don't need to do anything.
|
||||||
if (!isFragmentUpToDate(F))
|
if (!isFragmentUpToDate(F))
|
||||||
return;
|
return;
|
||||||
@ -678,7 +678,7 @@ bool MCAssembler::fragmentNeedsRelaxation(const MCInstFragment *IF,
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (MCInstFragment::const_fixup_iterator it = IF->fixup_begin(),
|
for (MCInstFragment::const_fixup_iterator it = IF->fixup_begin(),
|
||||||
ie = IF->fixup_end(); it != ie; ++it)
|
ie = IF->fixup_end(); it != ie; ++it)
|
||||||
if (fixupNeedsRelaxation(*it, IF, Layout))
|
if (fixupNeedsRelaxation(*it, IF, Layout))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@ -767,39 +767,39 @@ bool MCAssembler::relaxDwarfCallFrameFragment(MCAsmLayout &Layout,
|
|||||||
return OldSize != Data.size();
|
return OldSize != Data.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MCAssembler::layoutSectionOnce(MCAsmLayout &Layout,
|
bool MCAssembler::layoutSectionOnce(MCAsmLayout &Layout, MCSectionData &SD) {
|
||||||
MCSectionData &SD) {
|
// Holds the first fragment which needed relaxing during this layout. It will
|
||||||
|
// remain NULL if none were relaxed.
|
||||||
MCFragment *FirstInvalidFragment = NULL;
|
MCFragment *FirstInvalidFragment = NULL;
|
||||||
|
|
||||||
// Scan for fragments that need relaxation.
|
// Scan for fragments that need relaxation.
|
||||||
for (MCSectionData::iterator it2 = SD.begin(),
|
for (MCSectionData::iterator I = SD.begin(), IE = SD.end(); I != IE; ++I) {
|
||||||
ie2 = SD.end(); it2 != ie2; ++it2) {
|
// Check if this is a fragment that needs relaxation.
|
||||||
// Check if this is an fragment that needs relaxation.
|
bool RelaxedFrag = false;
|
||||||
bool relaxedFrag = false;
|
switch(I->getKind()) {
|
||||||
switch(it2->getKind()) {
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
case MCFragment::FT_Inst:
|
case MCFragment::FT_Inst:
|
||||||
relaxedFrag = relaxInstruction(Layout, *cast<MCInstFragment>(it2));
|
RelaxedFrag = relaxInstruction(Layout, *cast<MCInstFragment>(I));
|
||||||
break;
|
break;
|
||||||
case MCFragment::FT_Dwarf:
|
case MCFragment::FT_Dwarf:
|
||||||
relaxedFrag = relaxDwarfLineAddr(Layout,
|
RelaxedFrag = relaxDwarfLineAddr(Layout,
|
||||||
*cast<MCDwarfLineAddrFragment>(it2));
|
*cast<MCDwarfLineAddrFragment>(I));
|
||||||
break;
|
break;
|
||||||
case MCFragment::FT_DwarfFrame:
|
case MCFragment::FT_DwarfFrame:
|
||||||
relaxedFrag =
|
RelaxedFrag =
|
||||||
relaxDwarfCallFrameFragment(Layout,
|
relaxDwarfCallFrameFragment(Layout,
|
||||||
*cast<MCDwarfCallFrameFragment>(it2));
|
*cast<MCDwarfCallFrameFragment>(I));
|
||||||
break;
|
break;
|
||||||
case MCFragment::FT_LEB:
|
case MCFragment::FT_LEB:
|
||||||
relaxedFrag = relaxLEB(Layout, *cast<MCLEBFragment>(it2));
|
RelaxedFrag = relaxLEB(Layout, *cast<MCLEBFragment>(I));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// Update the layout, and remember that we relaxed.
|
if (RelaxedFrag && !FirstInvalidFragment)
|
||||||
if (relaxedFrag && !FirstInvalidFragment)
|
FirstInvalidFragment = I;
|
||||||
FirstInvalidFragment = it2;
|
|
||||||
}
|
}
|
||||||
if (FirstInvalidFragment) {
|
if (FirstInvalidFragment) {
|
||||||
Layout.Invalidate(FirstInvalidFragment);
|
Layout.invalidateFragmentsAfter(FirstInvalidFragment);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -811,7 +811,7 @@ bool MCAssembler::layoutOnce(MCAsmLayout &Layout) {
|
|||||||
bool WasRelaxed = false;
|
bool WasRelaxed = false;
|
||||||
for (iterator it = begin(), ie = end(); it != ie; ++it) {
|
for (iterator it = begin(), ie = end(); it != ie; ++it) {
|
||||||
MCSectionData &SD = *it;
|
MCSectionData &SD = *it;
|
||||||
while(layoutSectionOnce(Layout, SD))
|
while (layoutSectionOnce(Layout, SD))
|
||||||
WasRelaxed = true;
|
WasRelaxed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user