summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2010-12-15 08:45:53 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2010-12-15 08:45:53 +0000
commit2bf6afc277edb32b1d940def5b3eb0e0d32a22b9 (patch)
treecccbb7a607e07c1166a377006aa31956f5d5797d /include
parentf9a447617329186976fe5ab8b48fe3c9c0698bc7 (diff)
downloadllvm-2bf6afc277edb32b1d940def5b3eb0e0d32a22b9.tar.gz
llvm-2bf6afc277edb32b1d940def5b3eb0e0d32a22b9.tar.bz2
llvm-2bf6afc277edb32b1d940def5b3eb0e0d32a22b9.tar.xz
Relax alignment fragments.
With this we don't need the EffectiveSize field anymore. Without that field LayoutFragment only updates offsets and we don't need to invalidate the current fragment when it is relaxed (only the ones following it). This is also a very small improvement in the accuracy of the layout info as we now use the after relaxation size immediately. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121857 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/MC/MCAsmLayout.h4
-rw-r--r--include/llvm/MC/MCAssembler.h25
2 files changed, 15 insertions, 14 deletions
diff --git a/include/llvm/MC/MCAsmLayout.h b/include/llvm/MC/MCAsmLayout.h
index 64b0b4e026..7ea0bac0f7 100644
--- a/include/llvm/MC/MCAsmLayout.h
+++ b/include/llvm/MC/MCAsmLayout.h
@@ -76,10 +76,6 @@ public:
/// @name Fragment Layout Data
/// @{
- /// \brief Get the effective size of the given fragment, as computed in the
- /// current layout.
- uint64_t getFragmentEffectiveSize(const MCFragment *F) const;
-
/// \brief Get the offset of the given fragment inside its containing section.
uint64_t getFragmentOffset(const MCFragment *F) const;
diff --git a/include/llvm/MC/MCAssembler.h b/include/llvm/MC/MCAssembler.h
index ea250045ad..19d8ea5d09 100644
--- a/include/llvm/MC/MCAssembler.h
+++ b/include/llvm/MC/MCAssembler.h
@@ -75,10 +75,6 @@ private:
/// initialized.
uint64_t Offset;
- /// EffectiveSize - The compute size of this section. This is ~0 until
- /// initialized.
- uint64_t EffectiveSize;
-
/// LayoutOrder - The layout order of this fragment.
unsigned LayoutOrder;
@@ -231,6 +227,9 @@ class MCAlignFragment : public MCFragment {
/// cannot be satisfied in this width then this fragment is ignored.
unsigned MaxBytesToEmit;
+ /// Size - The current estimate of the size.
+ unsigned Size;
+
/// EmitNops - Flag to indicate that (optimal) NOPs should be emitted instead
/// of using the provided value. The exact interpretation of this flag is
/// target dependent.
@@ -241,7 +240,7 @@ public:
unsigned _MaxBytesToEmit, MCSectionData *SD = 0)
: MCFragment(FT_Align, SD), Alignment(_Alignment),
Value(_Value),ValueSize(_ValueSize),
- MaxBytesToEmit(_MaxBytesToEmit), EmitNops(false) {}
+ MaxBytesToEmit(_MaxBytesToEmit), Size(0), EmitNops(false) {}
/// @name Accessors
/// @{
@@ -252,6 +251,10 @@ public:
unsigned getValueSize() const { return ValueSize; }
+ unsigned getSize() const { return Size; }
+
+ void setSize(unsigned Size_) { Size = Size_; }
+
unsigned getMaxBytesToEmit() const { return MaxBytesToEmit; }
bool hasEmitNops() const { return EmitNops; }
@@ -704,11 +707,6 @@ private:
const MCInstFragment *IF,
const MCAsmLayout &Layout) const;
- /// Compute the effective fragment size assuming it is layed out at the given
- /// \arg SectionAddress and \arg FragmentOffset.
- uint64_t ComputeFragmentSize(const MCFragment &F,
- uint64_t FragmentOffset) const;
-
/// LayoutOnce - Perform one layout iteration and return true if any offsets
/// were adjusted.
bool LayoutOnce(const MCObjectWriter &Writer, MCAsmLayout &Layout);
@@ -725,6 +723,9 @@ private:
bool RelaxDwarfLineAddr(const MCObjectWriter &Writer, MCAsmLayout &Layout,
MCDwarfLineAddrFragment &DF);
+ bool RelaxAlignment(const MCObjectWriter &Writer, MCAsmLayout &Layout,
+ MCAlignFragment &DF);
+
/// FinishLayout - Finalize a layout, including fragment lowering.
void FinishLayout(MCAsmLayout &Layout);
@@ -732,6 +733,10 @@ private:
MCFragment &F, const MCFixup &Fixup);
public:
+ /// Compute the effective fragment size assuming it is layed out at the given
+ /// \arg SectionAddress and \arg FragmentOffset.
+ uint64_t ComputeFragmentSize(const MCFragment &F) const;
+
/// Find the symbol which defines the atom containing the given symbol, or
/// null if there is no such symbol.
const MCSymbolData *getAtom(const MCSymbolData *Symbol) const;