mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-01 15:17:25 +00:00
[MC] Write padding into fragments when -mc-relax-all flag is used
Summary: When instruction bundling is enabled and the -mc-relax-all flag is set, we can write bundle padding directly into fragments and avoid creating large number of fragments significantly reducing LLVM MC memory usage. Test Plan: Regression test attached Reviewers: eliben Subscribers: jfb, mseaborn Differential Revision: http://reviews.llvm.org/D8072 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234714 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -50,11 +50,6 @@ private:
|
||||
/// \brief Is the layout for this fragment valid?
|
||||
bool isFragmentValid(const MCFragment *F) const;
|
||||
|
||||
/// \brief Compute the amount of padding required before this fragment to
|
||||
/// obey bundling restrictions.
|
||||
uint64_t computeBundlePadding(const MCFragment *F,
|
||||
uint64_t FOffset, uint64_t FSize);
|
||||
|
||||
public:
|
||||
MCAsmLayout(MCAssembler &Assembler);
|
||||
|
||||
|
||||
@@ -1245,11 +1245,23 @@ public:
|
||||
FileNames.push_back(FileName);
|
||||
}
|
||||
|
||||
/// \brief Write the necessary bundle padding to the given object writer.
|
||||
/// Expects a fragment \p F containing instructions and its size \p FSize.
|
||||
void writeFragmentPadding(const MCFragment &F, uint64_t FSize,
|
||||
MCObjectWriter *OW) const;
|
||||
|
||||
/// @}
|
||||
|
||||
void dump();
|
||||
};
|
||||
|
||||
/// \brief Compute the amount of padding required before the fragment \p F to
|
||||
/// obey bundling restrictions, where \p FOffset is the fragment's offset in
|
||||
/// its section and \p FSize is the fragment's size.
|
||||
uint64_t computeBundlePadding(const MCAssembler &Assembler,
|
||||
const MCFragment *F,
|
||||
uint64_t FOffset, uint64_t FSize);
|
||||
|
||||
} // end namespace llvm
|
||||
|
||||
#endif
|
||||
|
||||
@@ -95,6 +95,9 @@ private:
|
||||
|
||||
void fixSymbolsInTLSFixups(const MCExpr *expr);
|
||||
|
||||
/// \brief Merge the content of the fragment \p EF into the fragment \p DF.
|
||||
void mergeFragment(MCDataFragment *, MCEncodedFragmentWithFixups *);
|
||||
|
||||
bool SeenIdent;
|
||||
|
||||
struct LocalCommon {
|
||||
@@ -106,6 +109,10 @@ private:
|
||||
std::vector<LocalCommon> LocalCommons;
|
||||
|
||||
SmallPtrSet<MCSymbol *, 16> BindingExplicitlySet;
|
||||
|
||||
/// BundleGroups - The stack of fragments holding the bundle-locked
|
||||
/// instructions.
|
||||
llvm::SmallVector<MCDataFragment *, 4> BundleGroups;
|
||||
};
|
||||
|
||||
MCELFStreamer *createARMELFStreamer(MCContext &Context, MCAsmBackend &TAB,
|
||||
|
||||
@@ -44,10 +44,6 @@ class MCObjectStreamer : public MCStreamer {
|
||||
void EmitCFIStartProcImpl(MCDwarfFrameInfo &Frame) override;
|
||||
void EmitCFIEndProcImpl(MCDwarfFrameInfo &Frame) override;
|
||||
|
||||
// If any labels have been emitted but not assigned fragments, ensure that
|
||||
// they get assigned, either to F if possible or to a new data fragment.
|
||||
void flushPendingLabels(MCFragment *F);
|
||||
|
||||
protected:
|
||||
MCObjectStreamer(MCContext &Context, MCAsmBackend &TAB, raw_ostream &OS,
|
||||
MCCodeEmitter *Emitter);
|
||||
@@ -85,6 +81,12 @@ protected:
|
||||
|
||||
bool changeSectionImpl(const MCSection *Section, const MCExpr *Subsection);
|
||||
|
||||
/// If any labels have been emitted but not assigned fragments, ensure that
|
||||
/// they get assigned, either to F if possible or to a new data fragment.
|
||||
/// Optionally, it is also possible to provide an offset \p FOffset, which
|
||||
/// will be used as a symbol offset within the fragment.
|
||||
void flushPendingLabels(MCFragment *F, uint64_t FOffset = 0);
|
||||
|
||||
public:
|
||||
void visitUsedSymbol(const MCSymbol &Sym) override;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user