9#ifndef LLVM_MC_MCASMBACKEND_H
10#define LLVM_MC_MCASMBACKEND_H
25struct MCDwarfFrameInfo;
27class MCObjectStreamer;
28class MCObjectTargetWriter;
33class raw_pwrite_stream;
61 bool AllowAutoPadding =
false;
62 bool AllowEnhancedRelaxation =
false;
88 std::unique_ptr<MCObjectWriter>
94 std::unique_ptr<MCObjectWriter>
97 virtual std::unique_ptr<MCObjectTargetWriter>
104 virtual std::optional<MCFixupKind> getFixupKind(
StringRef Name)
const;
126 bool IsResolved) = 0;
144 bool Resolved)
const;
160 "Needed if fixupNeedsRelaxation/fixupNeedsRelaxationAdvanced may "
175 int64_t &
Value)
const {
176 return std::make_pair(
false,
false);
210 bool isDarwinCanonicalPersonality(
const MCSymbol *
Sym)
const;
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
mir Rename Register Operands
PowerPC TLS Dynamic Call Fixup
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Generic interface to target specific assembler backends.
virtual unsigned getMinimumNopSize() const
Returns the minimum size of a nop in bytes on this target.
MCAsmBackend(const MCAsmBackend &)=delete
const llvm::endianness Endian
bool allowEnhancedRelaxation() const
Return true if this target allows an unrelaxable instruction to be emitted into RelaxableFragment and...
bool allowAutoPadding() const
Return true if this target might automatically pad instructions and thus need to emit padding enable/...
virtual unsigned getMaximumNopSize(const MCSubtargetInfo &STI) const
Returns the maximum size of a nop in bytes on this target.
virtual bool finishLayout(const MCAssembler &Asm) const
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.
virtual void relaxInstruction(MCInst &Inst, const MCSubtargetInfo &STI) const
Relax the instruction in the given fragment to the next wider instruction.
MCAsmBackend(llvm::endianness Endian)
virtual bool relaxAlign(MCFragment &F, unsigned &Size)
virtual bool mayNeedRelaxation(unsigned Opcode, ArrayRef< MCOperand > Operands, const MCSubtargetInfo &STI) const
Check whether the given instruction (encoded as Opcode+Operands) may need relaxation.
virtual std::pair< bool, bool > relaxLEB128(MCFragment &, int64_t &Value) const
virtual bool fixupNeedsRelaxation(const MCFixup &Fixup, uint64_t Value) const
Simple predicate for targets where !Resolved implies requiring relaxation.
MCAsmBackend & operator=(const MCAsmBackend &)=delete
virtual bool relaxDwarfCFA(MCFragment &) const
virtual std::unique_ptr< MCObjectTargetWriter > createObjectTargetWriter() const =0
virtual void reset()
lifetime management
void setAssembler(MCAssembler *A)
virtual void applyFixup(const MCFragment &, const MCFixup &, const MCValue &Target, uint8_t *Data, uint64_t Value, bool IsResolved)=0
virtual std::optional< bool > evaluateFixup(const MCFragment &, MCFixup &, MCValue &, uint64_t &)
virtual uint64_t generateCompactUnwindEncoding(const MCDwarfFrameInfo *FI, const MCContext *Ctxt) const
Generate the compact unwind encoding for the CFI instructions.
virtual bool relaxDwarfLineAddr(MCFragment &) const
Context object for machine code objects.
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
Instances of this class represent a single low-level machine instruction.
Generic base class for all target subtargets.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
StringRef - Represent a constant reference to a string, i.e.
Target - Wrapper for Target specific information.
LLVM Value Representation.
This class implements an extremely fast bulk output stream that can only output to a stream.
An abstract base class for streams implementations that also support a pwrite operation.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This is an optimization pass for GlobalISel generic memory operations.
Target independent information on a fixup kind.
const char * Name
A target specific name for the fixup kind.
uint8_t TargetOffset
The bit offset to write the relocation into.
uint8_t TargetSize
The number of bits written by this fixup.
unsigned Flags
Flags describing additional information on this fixup kind.