aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorKevin Enderby <enderby@apple.com>2010-02-23 18:26:34 +0000
committerKevin Enderby <enderby@apple.com>2010-02-23 18:26:34 +0000
commitd767d4e96e8d664f5e13414822c23b5a977c77fb (patch)
tree00c107b21ab078d0f18c75447a14577af7de4cb4 /include
parent4a9c23db9acaa1afd8d939b892d2a3decebacfeb (diff)
downloadexternal_llvm-d767d4e96e8d664f5e13414822c23b5a977c77fb.zip
external_llvm-d767d4e96e8d664f5e13414822c23b5a977c77fb.tar.gz
external_llvm-d767d4e96e8d664f5e13414822c23b5a977c77fb.tar.bz2
This is the first patch to put the needed bits in place to eventually allow code
to be aligned with optimal nops. This patch does not change any functionality and when the compiler is changed to use EmitCodeAlignment() it should also not change the resulting output. Once the compiler change is made and everything looks good the next patch with the table of optimal X86 nops will be added to WriteNopData() changing the output. There are many FIXMEs in this patch which will be removed when we have better target hooks (coming soon I hear). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96963 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/MC/MCAssembler.h10
-rw-r--r--include/llvm/MC/MCStreamer.h14
2 files changed, 22 insertions, 2 deletions
diff --git a/include/llvm/MC/MCAssembler.h b/include/llvm/MC/MCAssembler.h
index 4527f3c..882929f 100644
--- a/include/llvm/MC/MCAssembler.h
+++ b/include/llvm/MC/MCAssembler.h
@@ -195,12 +195,16 @@ class MCAlignFragment : public MCFragment {
/// cannot be satisfied in this width then this fragment is ignored.
unsigned MaxBytesToEmit;
+ /// EmitNops - true when aligning code and optimal nops to be used for filling
+ bool EmitNops;
+
public:
MCAlignFragment(unsigned _Alignment, int64_t _Value, unsigned _ValueSize,
- unsigned _MaxBytesToEmit, MCSectionData *SD = 0)
+ unsigned _MaxBytesToEmit, bool _EmitNops,
+ MCSectionData *SD = 0)
: MCFragment(FT_Align, SD), Alignment(_Alignment),
Value(_Value),ValueSize(_ValueSize),
- MaxBytesToEmit(_MaxBytesToEmit) {}
+ MaxBytesToEmit(_MaxBytesToEmit), EmitNops(_EmitNops) {}
/// @name Accessors
/// @{
@@ -217,6 +221,8 @@ public:
unsigned getMaxBytesToEmit() const { return MaxBytesToEmit; }
+ unsigned getEmitNops() const { return EmitNops; }
+
/// @}
static bool classof(const MCFragment *F) {
diff --git a/include/llvm/MC/MCStreamer.h b/include/llvm/MC/MCStreamer.h
index b104b9a..696d024 100644
--- a/include/llvm/MC/MCStreamer.h
+++ b/include/llvm/MC/MCStreamer.h
@@ -232,6 +232,20 @@ namespace llvm {
unsigned ValueSize = 1,
unsigned MaxBytesToEmit = 0) = 0;
+ /// EmitCodeAlignment - Emit nops until the byte alignment @p ByteAlignment
+ /// is reached.
+ ///
+ /// This used to align code where the alignment bytes may be executed. This
+ /// can emit different bytes for different sizes to optimize execution.
+ ///
+ /// @param ByteAlignment - The alignment to reach. This must be a power of
+ /// two on some targets.
+ /// @param MaxBytesToEmit - The maximum numbers of bytes to emit, or 0. If
+ /// the alignment cannot be reached in this many bytes, no bytes are
+ /// emitted.
+ virtual void EmitCodeAlignment(unsigned ByteAlignment,
+ unsigned MaxBytesToEmit = 0) = 0;
+
/// EmitValueToOffset - Emit some number of copies of @p Value until the
/// byte offset @p Offset is reached.
///