diff options
author | Eli Bendersky <eliben@google.com> | 2013-01-07 21:51:08 +0000 |
---|---|---|
committer | Eli Bendersky <eliben@google.com> | 2013-01-07 21:51:08 +0000 |
commit | 6c1d4972cf1cd6b6072e31c05f97abb1ed7a8497 (patch) | |
tree | 01a1fc8d4730a3b75657fafa9a5428bd7e4f0057 /include/llvm/MC | |
parent | d3ae2866d105f6da6375544eb41aea0dad75a9f2 (diff) | |
download | external_llvm-6c1d4972cf1cd6b6072e31c05f97abb1ed7a8497.zip external_llvm-6c1d4972cf1cd6b6072e31c05f97abb1ed7a8497.tar.gz external_llvm-6c1d4972cf1cd6b6072e31c05f97abb1ed7a8497.tar.bz2 |
Add the align_to_end option to .bundle_lock in the MC implementation of aligned
bundling. The document describing this feature and the implementation has also
been updated:
https://sites.google.com/a/chromium.org/dev/nativeclient/pnacl/aligned-bundling-support-in-llvm
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171797 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/MC')
-rw-r--r-- | include/llvm/MC/MCAssembler.h | 33 | ||||
-rw-r--r-- | include/llvm/MC/MCELFStreamer.h | 2 | ||||
-rw-r--r-- | include/llvm/MC/MCObjectStreamer.h | 2 | ||||
-rw-r--r-- | include/llvm/MC/MCStreamer.h | 5 |
4 files changed, 32 insertions, 10 deletions
diff --git a/include/llvm/MC/MCAssembler.h b/include/llvm/MC/MCAssembler.h index 6c2fdc5..1e953c9 100644 --- a/include/llvm/MC/MCAssembler.h +++ b/include/llvm/MC/MCAssembler.h @@ -100,9 +100,12 @@ public: void setLayoutOrder(unsigned Value) { LayoutOrder = Value; } /// \brief Does this fragment have instructions emitted into it? By default - /// this is false, but specific fragment types may set it to true. + /// this is false, but specific fragment types may set it to true. virtual bool hasInstructions() const { return false; } + /// \brief Should this fragment be placed at the end of an aligned bundle? + virtual bool alignToBundleEnd() const { return false; } + /// \brief Get the padding size that must be inserted before this fragment. /// Used for bundling. By default, no padding is inserted. /// Note that padding size is restricted to 8 bits. This is an optimization @@ -165,6 +168,9 @@ class MCDataFragment : public MCEncodedFragment { /// \brief Does this fragment contain encoded instructions anywhere in it? bool HasInstructions; + /// \brief Should this fragment be aligned to the end of a bundle? + bool AlignToBundleEnd; + SmallVector<char, 32> Contents; /// Fixups - The list of fixups in this fragment. @@ -172,7 +178,7 @@ class MCDataFragment : public MCEncodedFragment { public: MCDataFragment(MCSectionData *SD = 0) : MCEncodedFragment(FT_Data, SD), - HasInstructions(false) + HasInstructions(false), AlignToBundleEnd(false) { } @@ -190,6 +196,9 @@ public: virtual bool hasInstructions() const { return HasInstructions; } virtual void setHasInstructions(bool V) { HasInstructions = V; } + virtual bool alignToBundleEnd() const { return AlignToBundleEnd; } + virtual void setAlignToBundleEnd(bool V) { AlignToBundleEnd = V; } + fixup_iterator fixup_begin() { return Fixups.begin(); } const_fixup_iterator fixup_begin() const { return Fixups.begin(); } @@ -476,6 +485,12 @@ public: typedef FragmentListType::const_reverse_iterator const_reverse_iterator; typedef FragmentListType::reverse_iterator reverse_iterator; + /// \brief Express the state of bundle locked groups while emitting code. + enum BundleLockStateType { + NotBundleLocked, + BundleLocked, + BundleLockedAlignToEnd + }; private: FragmentListType Fragments; const MCSection *Section; @@ -489,8 +504,8 @@ private: /// Alignment - The maximum alignment seen in this section. unsigned Alignment; - /// \brief We're currently inside a bundle-locked group. - bool BundleLocked; + /// \brief Keeping track of bundle-locked state. + BundleLockStateType BundleLockState; /// \brief We've seen a bundle_lock directive but not its first instruction /// yet. @@ -549,11 +564,15 @@ public: bool empty() const { return Fragments.empty(); } bool isBundleLocked() const { - return BundleLocked; + return BundleLockState != NotBundleLocked; + } + + BundleLockStateType getBundleLockState() const { + return BundleLockState; } - void setBundleLocked(bool IsLocked) { - BundleLocked = IsLocked; + void setBundleLockState(BundleLockStateType NewState) { + BundleLockState = NewState; } bool isBundleGroupBeforeFirstInst() const { diff --git a/include/llvm/MC/MCELFStreamer.h b/include/llvm/MC/MCELFStreamer.h index 5e148c3..ab20ee8 100644 --- a/include/llvm/MC/MCELFStreamer.h +++ b/include/llvm/MC/MCELFStreamer.h @@ -85,7 +85,7 @@ private: virtual void EmitInstToData(const MCInst &Inst); virtual void EmitBundleAlignMode(unsigned AlignPow2); - virtual void EmitBundleLock(); + virtual void EmitBundleLock(bool AlignToEnd); virtual void EmitBundleUnlock(); void fixSymbolsInTLSFixups(const MCExpr *expr); diff --git a/include/llvm/MC/MCObjectStreamer.h b/include/llvm/MC/MCObjectStreamer.h index 4bc24d4..0ece092 100644 --- a/include/llvm/MC/MCObjectStreamer.h +++ b/include/llvm/MC/MCObjectStreamer.h @@ -84,7 +84,7 @@ public: virtual void EmitInstToFragment(const MCInst &Inst); virtual void EmitBundleAlignMode(unsigned AlignPow2); - virtual void EmitBundleLock(); + virtual void EmitBundleLock(bool AlignToEnd); virtual void EmitBundleUnlock(); virtual void EmitBytes(StringRef Data, unsigned AddrSpace); virtual void EmitValueToAlignment(unsigned ByteAlignment, diff --git a/include/llvm/MC/MCStreamer.h b/include/llvm/MC/MCStreamer.h index 8be46b5..05a33c5 100644 --- a/include/llvm/MC/MCStreamer.h +++ b/include/llvm/MC/MCStreamer.h @@ -562,7 +562,10 @@ namespace llvm { virtual void EmitBundleAlignMode(unsigned AlignPow2) = 0; /// \brief The following instructions are a bundle-locked group. - virtual void EmitBundleLock() = 0; + /// + /// \param AlignToEnd - If true, the bundle-locked group will be aligned to + /// the end of a bundle. + virtual void EmitBundleLock(bool AlignToEnd) = 0; /// \brief Ends a bundle-locked group. virtual void EmitBundleUnlock() = 0; |