summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-03-23 03:13:05 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-03-23 03:13:05 +0000
commit337055e62f28f18a9a8c4a090633cae1c2256ae1 (patch)
tree18a00928afa5902aa07967f5e3f2492e6f59b97c /include
parent8f9b80e5df12779a56d763ebf20864dad2bc72da (diff)
downloadllvm-337055e62f28f18a9a8c4a090633cae1c2256ae1.tar.gz
llvm-337055e62f28f18a9a8c4a090633cae1c2256ae1.tar.bz2
llvm-337055e62f28f18a9a8c4a090633cae1c2256ae1.tar.xz
MC: Add TargetAsmBackend::MayNeedRelaxation, for checking whether a particular instruction + fixups might need relaxation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99249 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/MC/MCAssembler.h4
-rw-r--r--include/llvm/Target/TargetAsmBackend.h11
2 files changed, 15 insertions, 0 deletions
diff --git a/include/llvm/MC/MCAssembler.h b/include/llvm/MC/MCAssembler.h
index d7f1acea35..d14122bf74 100644
--- a/include/llvm/MC/MCAssembler.h
+++ b/include/llvm/MC/MCAssembler.h
@@ -679,6 +679,10 @@ private:
bool FixupNeedsRelaxation(const MCAsmFixup &Fixup, const MCFragment *DF,
const MCAsmLayout &Layout) const;
+ /// Check whether the given fragment needs relaxation.
+ bool FragmentNeedsRelaxation(const MCInstFragment *IF,
+ const MCAsmLayout &Layout) const;
+
/// LayoutSection - Assign offsets and sizes to the fragments in the section
/// \arg SD, and update the section size. The section file offset should
/// already have been computed.
diff --git a/include/llvm/Target/TargetAsmBackend.h b/include/llvm/Target/TargetAsmBackend.h
index 16f33c32f4..f350ecc410 100644
--- a/include/llvm/Target/TargetAsmBackend.h
+++ b/include/llvm/Target/TargetAsmBackend.h
@@ -19,6 +19,8 @@ class MCInst;
class MCInstFragment;
class MCObjectWriter;
class MCSection;
+template<typename T>
+class SmallVectorImpl;
class Target;
class raw_ostream;
@@ -98,6 +100,15 @@ public:
virtual void ApplyFixup(const MCAsmFixup &Fixup, MCDataFragment &Fragment,
uint64_t Value) const = 0;
+ /// MayNeedRelaxation - Check whether the given instruction may need
+ /// relaxation.
+ ///
+ /// \arg Inst - The instruction to test.
+ /// \arg Fixups - The actual fixups this instruction encoded to, for potential
+ /// use by the target backend.
+ virtual bool MayNeedRelaxation(const MCInst &Inst,
+ const SmallVectorImpl<MCAsmFixup> &Fixups) const = 0;
+
/// RelaxInstruction - Relax the instruction in the given fragment to the next
/// wider instruction.
virtual void RelaxInstruction(const MCInstFragment *IF,