summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-03-22 23:16:48 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-03-22 23:16:48 +0000
commit3f4dcd92daef80f87919507b6baf2a97d4bfaa2e (patch)
tree3ddd6c5b3c16bbc749cbc16110c982d7db271207 /include
parent35b0657dea3f5dfee3b753a58c585edd22e3b45c (diff)
downloadllvm-3f4dcd92daef80f87919507b6baf2a97d4bfaa2e.tar.gz
llvm-3f4dcd92daef80f87919507b6baf2a97d4bfaa2e.tar.bz2
llvm-3f4dcd92daef80f87919507b6baf2a97d4bfaa2e.tar.xz
MC: Add MCInstFragment, not used yet.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99229 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/MC/MCAssembler.h43
1 files changed, 41 insertions, 2 deletions
diff --git a/include/llvm/MC/MCAssembler.h b/include/llvm/MC/MCAssembler.h
index 8a7a7853c6..ff32eb26fc 100644
--- a/include/llvm/MC/MCAssembler.h
+++ b/include/llvm/MC/MCAssembler.h
@@ -16,6 +16,7 @@
#include "llvm/ADT/ilist_node.h"
#include "llvm/Support/Casting.h"
#include "llvm/MC/MCFixup.h"
+#include "llvm/MC/MCInst.h"
#include "llvm/System/DataTypes.h"
#include <vector> // FIXME: Shouldn't be needed.
@@ -37,6 +38,8 @@ class TargetAsmBackend;
/// MCAsmFixup - Represent a fixed size region of bytes inside some fragment
/// which needs to be rewritten. This region will either be rewritten by the
/// assembler or cause a relocation entry to be generated.
+//
+// FIXME: This should probably just be merged with MCFixup.
class MCAsmFixup {
public:
/// Offset - The offset inside the fragment which needs to be rewritten.
@@ -59,9 +62,10 @@ class MCFragment : public ilist_node<MCFragment> {
public:
enum FragmentType {
- FT_Data,
FT_Align,
+ FT_Data,
FT_Fill,
+ FT_Inst,
FT_Org,
FT_ZeroFill
};
@@ -145,7 +149,6 @@ public:
const SmallString<32> &getContents() const { return Contents; }
/// @}
-
/// @name Fixup Access
/// @{
@@ -177,6 +180,39 @@ public:
virtual void dump();
};
+class MCInstFragment : public MCFragment {
+ /// Inst - The instruction this is a fragment for.
+ MCInst Inst;
+
+ /// InstSize - The size of the currently encoded instruction.
+ unsigned InstSize;
+
+public:
+ MCInstFragment(MCInst _Inst, unsigned _InstSize, MCSectionData *SD = 0)
+ : MCFragment(FT_Inst, SD), Inst(_Inst), InstSize(_InstSize) {}
+
+ /// @name Accessors
+ /// @{
+
+ unsigned getInstSize() const { return InstSize; }
+
+ const MCInst &getInst() const { return Inst; }
+
+ void setInst(MCInst Inst, unsigned InstSize) {
+ this->Inst = Inst;
+ this->InstSize = InstSize;
+ }
+
+ /// @}
+
+ static bool classof(const MCFragment *F) {
+ return F->getKind() == MCFragment::FT_Inst;
+ }
+ static bool classof(const MCInstFragment *) { return true; }
+
+ virtual void dump();
+};
+
class MCAlignFragment : public MCFragment {
/// Alignment - The alignment to ensure, in bytes.
unsigned Alignment;
@@ -623,6 +659,9 @@ private:
/// were adjusted.
bool LayoutOnce(MCAsmLayout &Layout);
+ /// FinishLayout - Finalize a layout, including fragment lowering.
+ void FinishLayout(MCAsmLayout &Layout);
+
public:
/// Find the symbol which defines the atom containing given address, inside
/// the given section, or null if there is no such symbol.