Go to the documentation of this file.
9 #ifndef LLVM_MC_MCASMBACKEND_H
10 #define LLVM_MC_MCASMBACKEND_H
21 class MCAlignFragment;
22 class MCDwarfCallFrameFragment;
23 class MCDwarfLineAddrFragment;
25 class MCRelaxableFragment;
29 class MCCFIInstruction;
30 struct MCFixupKindInfo;
32 class MCObjectStreamer;
33 class MCObjectTargetWriter;
35 class MCSubtargetInfo;
37 class raw_pwrite_stream;
73 std::unique_ptr<MCObjectWriter>
79 std::unique_ptr<MCObjectWriter>
82 virtual std::unique_ptr<MCObjectTargetWriter>
160 const bool WasForced)
const;
181 bool &WasRelaxed)
const {
227 #endif // LLVM_MC_MCASMBACKEND_H
virtual bool isMicroMips(const MCSymbol *Sym) const
Check whether a given symbol has been flagged with MICROMIPS flag.
This is an optimization pass for GlobalISel generic memory operations.
A relaxable fragment holds on to its MCInst, since it may need to be relaxed during the assembler lay...
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
virtual const MCFixupKindInfo & getFixupKindInfo(MCFixupKind Kind) const
Get information on a fixup kind.
virtual void emitInstructionEnd(MCObjectStreamer &OS, const MCInst &Inst)
Target - Wrapper for Target specific information.
virtual void handleAssemblerFlag(MCAssemblerFlag Flag)
Handle any target-specific assembler flags. By default, do nothing.
virtual void applyFixup(const MCAssembler &Asm, const MCFixup &Fixup, const MCValue &Target, MutableArrayRef< char > Data, uint64_t Value, bool IsResolved, const MCSubtargetInfo *STI) const =0
Apply the Value for given Fixup into the provided data fragment, at the offset specified by the fixup...
Instances of this class represent a single low-level machine instruction.
std::unique_ptr< MCObjectWriter > createDwoObjectWriter(raw_pwrite_stream &OS, raw_pwrite_stream &DwoOS) const
Create an MCObjectWriter that writes two object files: a .o file which is linked into the final progr...
const support::endianness Endian
virtual void finishLayout(MCAssembler const &Asm, MCAsmLayout &Layout) const
Give backend an opportunity to finish layout after relaxation.
virtual unsigned getMinimumNopSize() const
Returns the minimum size of a nop in bytes on this target.
Generic interface to target specific assembler backends.
Streaming object file generation interface.
Flag
These should be considered private to the implementation of the MCInstrDesc class.
This class implements an extremely fast bulk output stream that can only output to a stream.
virtual void reset()
lifetime management
virtual bool shouldForceRelocation(const MCAssembler &Asm, const MCFixup &Fixup, const MCValue &Target)
Hook to check if a relocation is needed for some target specific reason.
static RegisterPass< DebugifyFunctionPass > DF("debugify-function", "Attach debug info to a function")
virtual bool relaxDwarfLineAddr(MCDwarfLineAddrFragment &DF, MCAsmLayout &Layout, bool &WasRelaxed) const
virtual uint32_t generateCompactUnwindEncoding(ArrayRef< MCCFIInstruction >) const
Generate the compact unwind encoding for the CFI instructions.
An abstract base class for streams implementations that also support a pwrite operation.
virtual bool shouldInsertExtraNopBytesForCodeAlign(const MCAlignFragment &AF, unsigned &Size)
Hook to check if extra nop bytes must be inserted for alignment directive.
virtual bool allowEnhancedRelaxation() const
Return true if this target allows an unrelaxable instruction to be emitted into RelaxableFragment and...
virtual bool shouldInsertFixupForCodeAlign(MCAssembler &Asm, const MCAsmLayout &Layout, MCAlignFragment &AF)
Hook which indicates if the target requires a fixup to be generated when handling an align directive ...
virtual Optional< MCFixupKind > getFixupKind(StringRef Name) const
Map a relocation name used in .reloc to a fixup kind.
Target independent information on a fixup kind.
virtual bool fixupNeedsRelaxationAdvanced(const MCFixup &Fixup, bool Resolved, uint64_t Value, const MCRelaxableFragment *DF, const MCAsmLayout &Layout, const bool WasForced) const
Target specific predicate for whether a given fixup requires the associated instruction to be relaxed...
virtual bool writeNopData(raw_ostream &OS, uint64_t Count, const MCSubtargetInfo *STI) const =0
Write an (optimal) nop sequence of Count bytes to the given output.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
virtual bool allowAutoPadding() const
Return true if this target might automatically pad instructions and thus need to emit padding enable/...
StringRef - Represent a constant reference to a string, i.e.
virtual std::unique_ptr< MCObjectTargetWriter > createObjectTargetWriter() const =0
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
virtual void relaxInstruction(MCInst &Inst, const MCSubtargetInfo &STI) const
Relax the instruction in the given fragment to the next wider instruction.
virtual unsigned getMaximumNopSize(const MCSubtargetInfo &STI) const
Returns the maximum size of a nop in bytes on this target.
virtual bool evaluateTargetFixup(const MCAssembler &Asm, const MCAsmLayout &Layout, const MCFixup &Fixup, const MCFragment *DF, const MCValue &Target, uint64_t &Value, bool &WasForced)
Encapsulates the layout of an assembly file at a particular point in time.
virtual bool relaxDwarfCFA(MCDwarfCallFrameFragment &DF, MCAsmLayout &Layout, bool &WasRelaxed) const
virtual bool fixupNeedsRelaxation(const MCFixup &Fixup, uint64_t Value, const MCRelaxableFragment *DF, const MCAsmLayout &Layout) const =0
Simple predicate for targets where !Resolved implies requiring relaxation.
virtual void emitInstructionBegin(MCObjectStreamer &OS, const MCInst &Inst, const MCSubtargetInfo &STI)
Give the target a chance to manipulate state related to instruction alignment (e.g.
MCFixupKind
Extensible enumeration to represent the type of a fixup.
std::unique_ptr< MCObjectWriter > createObjectWriter(raw_pwrite_stream &OS) const
Create a new MCObjectWriter instance for use by the assembler backend to emit the final object file.
MCAsmBackend(support::endianness Endian)
MCAsmBackend & operator=(const MCAsmBackend &)=delete
This represents an "assembler immediate".
virtual unsigned getNumFixupKinds() const =0
Get the number of target specific fixup kinds.
Generic base class for all target subtargets.
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
LLVM Value Representation.
virtual bool mayNeedRelaxation(const MCInst &Inst, const MCSubtargetInfo &STI) const
Check whether the given instruction may need relaxation.