LLVM  4.0.0
Public Member Functions | Protected Member Functions | List of all members
llvm::MCAsmBackend Class Referenceabstract

Generic interface to target specific assembler backends. More...

#include <MCAsmBackend.h>

Inheritance diagram for llvm::MCAsmBackend:
[legend]

Public Member Functions

virtual ~MCAsmBackend ()
 
virtual void reset ()
 lifetime management More...
 
virtual MCObjectWritercreateObjectWriter (raw_pwrite_stream &OS) const =0
 Create a new MCObjectWriter instance for use by the assembler backend to emit the final object file. More...
 
virtual unsigned getMinimumNopSize () const
 Returns the minimum size of a nop in bytes on this target. More...
 
virtual bool writeNopData (uint64_t Count, MCObjectWriter *OW) const =0
 Write an (optimal) nop sequence of Count bytes to the given output. More...
 
virtual void finishLayout (MCAssembler const &Asm, MCAsmLayout &Layout) const
 Give backend an opportunity to finish layout after relaxation. More...
 
virtual void handleAssemblerFlag (MCAssemblerFlag Flag)
 Handle any target-specific assembler flags. By default, do nothing. More...
 
virtual uint32_t generateCompactUnwindEncoding (ArrayRef< MCCFIInstruction >) const
 Generate the compact unwind encoding for the CFI instructions. More...
 
Target Fixup Interfaces
virtual unsigned getNumFixupKinds () const =0
 Get the number of target specific fixup kinds. More...
 
virtual Optional< MCFixupKindgetFixupKind (StringRef Name) const
 Map a relocation name used in .reloc to a fixup kind. More...
 
virtual const MCFixupKindInfogetFixupKindInfo (MCFixupKind Kind) const
 Get information on a fixup kind. More...
 
virtual void processFixupValue (const MCAssembler &Asm, const MCAsmLayout &Layout, const MCFixup &Fixup, const MCFragment *DF, const MCValue &Target, uint64_t &Value, bool &IsResolved)
 Target hook to adjust the literal value of a fixup if necessary. More...
 
virtual void applyFixup (const MCFixup &Fixup, char *Data, unsigned DataSize, uint64_t Value, bool IsPCRel) const =0
 Apply the Value for given Fixup into the provided data fragment, at the offset specified by the fixup and following the fixup kind as appropriate. More...
 
Target Relaxation Interfaces
virtual bool mayNeedRelaxation (const MCInst &Inst) const =0
 Check whether the given instruction may need relaxation. More...
 
virtual bool fixupNeedsRelaxationAdvanced (const MCFixup &Fixup, bool Resolved, uint64_t Value, const MCRelaxableFragment *DF, const MCAsmLayout &Layout) const
 Target specific predicate for whether a given fixup requires the associated instruction to be relaxed. More...
 
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. More...
 
virtual void relaxInstruction (const MCInst &Inst, const MCSubtargetInfo &STI, MCInst &Res) const =0
 Relax the instruction in the given fragment to the next wider instruction. More...
 

Protected Member Functions

 MCAsmBackend ()
 

Detailed Description

Generic interface to target specific assembler backends.

Definition at line 36 of file MCAsmBackend.h.

Constructor & Destructor Documentation

MCAsmBackend::MCAsmBackend ( )
protected

Definition at line 15 of file MCAsmBackend.cpp.

MCAsmBackend::~MCAsmBackend ( )
virtual

Definition at line 17 of file MCAsmBackend.cpp.

Member Function Documentation

virtual void llvm::MCAsmBackend::applyFixup ( const MCFixup Fixup,
char *  Data,
unsigned  DataSize,
uint64_t  Value,
bool  IsPCRel 
) const
pure virtual

Apply the Value for given Fixup into the provided data fragment, at the offset specified by the fixup and following the fixup kind as appropriate.

Implemented in llvm::ARMAsmBackend, llvm::AVRAsmBackend, and llvm::MipsAsmBackend.

Referenced by llvm::MCAssembler::layout().

virtual MCObjectWriter* llvm::MCAsmBackend::createObjectWriter ( raw_pwrite_stream OS) const
pure virtual

Create a new MCObjectWriter instance for use by the assembler backend to emit the final object file.

Implemented in llvm::AVRAsmBackend, llvm::MipsAsmBackend, and llvm::ARMAsmBackendDarwin.

virtual void llvm::MCAsmBackend::finishLayout ( MCAssembler const Asm,
MCAsmLayout Layout 
) const
inlinevirtual

Give backend an opportunity to finish layout after relaxation.

Definition at line 126 of file MCAsmBackend.h.

virtual bool llvm::MCAsmBackend::fixupNeedsRelaxation ( const MCFixup Fixup,
uint64_t  Value,
const MCRelaxableFragment DF,
const MCAsmLayout Layout 
) const
pure virtual

Simple predicate for targets where !Resolved implies requiring relaxation.

Implemented in llvm::MipsAsmBackend, llvm::ARMAsmBackend, and llvm::AVRAsmBackend.

Referenced by fixupNeedsRelaxationAdvanced().

bool MCAsmBackend::fixupNeedsRelaxationAdvanced ( const MCFixup Fixup,
bool  Resolved,
uint64_t  Value,
const MCRelaxableFragment DF,
const MCAsmLayout Layout 
) const
virtual

Target specific predicate for whether a given fixup requires the associated instruction to be relaxed.

Definition at line 50 of file MCAsmBackend.cpp.

References fixupNeedsRelaxation().

virtual uint32_t llvm::MCAsmBackend::generateCompactUnwindEncoding ( ArrayRef< MCCFIInstruction ) const
inlinevirtual

Generate the compact unwind encoding for the CFI instructions.

Reimplemented in llvm::ARMAsmBackendDarwin.

Definition at line 134 of file MCAsmBackend.h.

Referenced by llvm::MCStreamer::generateCompactUnwindEncodings().

Optional< MCFixupKind > MCAsmBackend::getFixupKind ( StringRef  Name) const
virtual

Map a relocation name used in .reloc to a fixup kind.

Reimplemented in llvm::MipsAsmBackend.

Definition at line 19 of file MCAsmBackend.cpp.

References llvm::None.

Referenced by llvm::MCObjectStreamer::EmitRelocDirective(), and llvm::MipsAsmBackend::getFixupKind().

const MCFixupKindInfo & MCAsmBackend::getFixupKindInfo ( MCFixupKind  Kind) const
virtual
virtual unsigned llvm::MCAsmBackend::getMinimumNopSize ( ) const
inlinevirtual

Returns the minimum size of a nop in bytes on this target.

The assembler will use this to emit excess padding in situations where the padding required for simple alignment would be less than the minimum nop size.

Definition at line 117 of file MCAsmBackend.h.

Referenced by llvm::MCAssembler::computeFragmentSize().

virtual unsigned llvm::MCAsmBackend::getNumFixupKinds ( ) const
pure virtual

Get the number of target specific fixup kinds.

Implemented in llvm::AVRAsmBackend, llvm::MipsAsmBackend, and llvm::ARMAsmBackend.

virtual void llvm::MCAsmBackend::handleAssemblerFlag ( MCAssemblerFlag  Flag)
inlinevirtual

Handle any target-specific assembler flags. By default, do nothing.

Reimplemented in llvm::ARMAsmBackend.

Definition at line 130 of file MCAsmBackend.h.

Referenced by llvm::MCELFStreamer::EmitAssemblerFlag().

virtual bool llvm::MCAsmBackend::mayNeedRelaxation ( const MCInst Inst) const
pure virtual

Check whether the given instruction may need relaxation.

Parameters
Inst- The instruction to test.

Implemented in llvm::MipsAsmBackend, llvm::ARMAsmBackend, and llvm::AVRAsmBackend.

Referenced by llvm::MCObjectStreamer::EmitInstruction().

virtual void llvm::MCAsmBackend::processFixupValue ( const MCAssembler Asm,
const MCAsmLayout Layout,
const MCFixup Fixup,
const MCFragment DF,
const MCValue Target,
uint64_t &  Value,
bool IsResolved 
)
inlinevirtual

Target hook to adjust the literal value of a fixup if necessary.

IsResolved signals whether the caller believes a relocation is needed; the target can modify the value. The default does nothing.

Reimplemented in llvm::MipsAsmBackend, llvm::AVRAsmBackend, and llvm::ARMAsmBackend.

Definition at line 68 of file MCAsmBackend.h.

virtual void llvm::MCAsmBackend::relaxInstruction ( const MCInst Inst,
const MCSubtargetInfo STI,
MCInst Res 
) const
pure virtual

Relax the instruction in the given fragment to the next wider instruction.

Parameters
InstThe instruction to relax, which may be the same as the output.
STIthe subtarget information for the associated instruction.
[out]ResOn return, the relaxed instruction.

Implemented in llvm::MipsAsmBackend, llvm::ARMAsmBackend, and llvm::AVRAsmBackend.

Referenced by llvm::MCObjectStreamer::EmitInstruction().

virtual void llvm::MCAsmBackend::reset ( )
inlinevirtual

lifetime management

Definition at line 47 of file MCAsmBackend.h.

Referenced by llvm::MCAssembler::reset().

virtual bool llvm::MCAsmBackend::writeNopData ( uint64_t  Count,
MCObjectWriter OW 
) const
pure virtual

Write an (optimal) nop sequence of Count bytes to the given output.

If the target cannot generate such a sequence, it should return an error.

Returns
- True on success.

Implemented in llvm::MipsAsmBackend, llvm::ARMAsmBackend, and llvm::AVRAsmBackend.

Referenced by writeFragment().


The documentation for this class was generated from the following files: