diff options
Diffstat (limited to 'include/llvm/MC/MCAsmBackend.h')
-rw-r--r-- | include/llvm/MC/MCAsmBackend.h | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/include/llvm/MC/MCAsmBackend.h b/include/llvm/MC/MCAsmBackend.h index 51312ff80447e..ce17a2a067589 100644 --- a/include/llvm/MC/MCAsmBackend.h +++ b/include/llvm/MC/MCAsmBackend.h @@ -11,6 +11,7 @@ #define LLVM_MC_MCASMBACKEND_H #include "llvm/ADT/ArrayRef.h" +#include "llvm/ADT/Optional.h" #include "llvm/MC/MCDirectives.h" #include "llvm/MC/MCDwarf.h" #include "llvm/MC/MCFixup.h" @@ -28,7 +29,7 @@ class MCRelaxableFragment; class MCObjectWriter; class MCSection; class MCValue; -class raw_ostream; +class raw_pwrite_stream; /// Generic interface to target specific assembler backends. class MCAsmBackend { @@ -38,8 +39,6 @@ class MCAsmBackend { protected: // Can only create subclasses. MCAsmBackend(); - unsigned HasDataInCodeSupport : 1; - public: virtual ~MCAsmBackend(); @@ -50,17 +49,6 @@ public: /// emit the final object file. virtual MCObjectWriter *createObjectWriter(raw_pwrite_stream &OS) const = 0; - /// Create a new ELFObjectTargetWriter to enable non-standard - /// ELFObjectWriters. - virtual MCELFObjectTargetWriter *createELFObjectTargetWriter() const { - llvm_unreachable("createELFObjectTargetWriter is not supported by asm " - "backend"); - } - - /// Check whether this target implements data-in-code markers. If not, data - /// region directives will be ignored. - bool hasDataInCodeSupport() const { return HasDataInCodeSupport; } - /// \name Target Fixup Interfaces /// @{ @@ -68,9 +56,7 @@ public: virtual unsigned getNumFixupKinds() const = 0; /// Map a relocation name used in .reloc to a fixup kind. - /// Returns true and sets MappedKind if Name is successfully mapped. - /// Otherwise returns false and leaves MappedKind unchanged. - virtual bool getFixupKind(StringRef Name, MCFixupKind &MappedKind) const; + virtual Optional<MCFixupKind> getFixupKind(StringRef Name) const; /// Get information on a fixup kind. virtual const MCFixupKindInfo &getFixupKindInfo(MCFixupKind Kind) const; @@ -116,8 +102,10 @@ public: /// /// \param Inst The instruction to relax, which may be the same as the /// output. + /// \param STI the subtarget information for the associated instruction. /// \param [out] Res On return, the relaxed instruction. - virtual void relaxInstruction(const MCInst &Inst, MCInst &Res) const = 0; + virtual void relaxInstruction(const MCInst &Inst, const MCSubtargetInfo &STI, + MCInst &Res) const = 0; /// @} @@ -133,6 +121,10 @@ public: /// \return - True on success. virtual bool writeNopData(uint64_t Count, MCObjectWriter *OW) const = 0; + /// Give backend an opportunity to finish layout after relaxation + virtual void finishLayout(MCAssembler const &Asm, + MCAsmLayout &Layout) const {} + /// Handle any target-specific assembler flags. By default, do nothing. virtual void handleAssemblerFlag(MCAssemblerFlag Flag) {} |