LLVM 20.0.0git
Public Member Functions | Static Public Member Functions | List of all members
llvm::MCFixup Class Reference

Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction) which requires assemble- or run- time patching. More...

#include "llvm/MC/MCFixup.h"

Public Member Functions

MCFixupKind getKind () const
 
unsigned getTargetKind () const
 
uint32_t getOffset () const
 
void setOffset (uint32_t Value)
 
const MCExprgetValue () const
 
SMLoc getLoc () const
 

Static Public Member Functions

static MCFixup create (uint32_t Offset, const MCExpr *Value, MCFixupKind Kind, SMLoc Loc=SMLoc())
 
static MCFixupKind getKindForSize (unsigned Size, bool IsPCRel)
 Return the generic fixup kind for a value with the given size.
 

Detailed Description

Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction) which requires assemble- or run- time patching.

Fixups are used any time the target instruction encoder needs to represent some value in an instruction which is not yet concrete. The encoder will encode the instruction assuming the value is 0, and emit a fixup which communicates to the assembler backend how it should rewrite the encoded value.

During the process of relaxation, the assembler will apply fixups as symbolic values become concrete. When relaxation is complete, any remaining fixups become relocations in the object file (or errors, if the fixup cannot be encoded on the target).

Definition at line 71 of file MCFixup.h.

Member Function Documentation

◆ create()

static MCFixup llvm::MCFixup::create ( uint32_t  Offset,
const MCExpr Value,
MCFixupKind  Kind,
SMLoc  Loc = SMLoc() 
)
inlinestatic

Definition at line 87 of file MCFixup.h.

References assert(), and llvm::MaxFixupKind.

Referenced by llvm::MCWinCOFFStreamer::emitCOFFImgRel32(), llvm::MCWinCOFFStreamer::emitCOFFSecRel32(), llvm::MCWinCOFFStreamer::emitCOFFSectionIndex(), llvm::MCObjectStreamer::emitDTPRel32Value(), llvm::MCObjectStreamer::emitDTPRel64Value(), llvm::MCObjectStreamer::emitGPRel32Value(), llvm::MCObjectStreamer::emitGPRel64Value(), llvm::MCObjectStreamer::emitRelocDirective(), llvm::MCObjectStreamer::emitTPRel32Value(), llvm::MCObjectStreamer::emitTPRel64Value(), llvm::MCObjectStreamer::emitValueImpl(), llvm::MCXCOFFStreamer::emitXCOFFRefDirective(), llvm::CodeViewContext::encodeDefRange(), llvm::PPCMCCodeEmitter::getAbsCondBrEncoding(), llvm::PPCMCCodeEmitter::getAbsDirectBrEncoding(), llvm::CSKYMCCodeEmitter::getBareSymbolOpValue(), llvm::CSKYMCCodeEmitter::getBranchSymbolOpValue(), llvm::MipsMCCodeEmitter::getBranchTarget21OpValue(), llvm::MipsMCCodeEmitter::getBranchTarget21OpValueMM(), llvm::MipsMCCodeEmitter::getBranchTarget26OpValue(), llvm::MipsMCCodeEmitter::getBranchTarget26OpValueMM(), llvm::MipsMCCodeEmitter::getBranchTarget7OpValueMM(), getBranchTargetOpValue(), llvm::MipsMCCodeEmitter::getBranchTargetOpValue(), llvm::MipsMCCodeEmitter::getBranchTargetOpValue1SImm16(), llvm::MipsMCCodeEmitter::getBranchTargetOpValueLsl2MMR6(), llvm::MipsMCCodeEmitter::getBranchTargetOpValueMM(), llvm::MipsMCCodeEmitter::getBranchTargetOpValueMMPC10(), llvm::MipsMCCodeEmitter::getBranchTargetOpValueMMR6(), llvm::CSKYMCCodeEmitter::getCallSymbolOpValue(), llvm::PPCMCCodeEmitter::getCondBrEncoding(), llvm::CSKYMCCodeEmitter::getConstpoolSymbolOpValue(), llvm::CSKYMCCodeEmitter::getDataSymbolOpValue(), llvm::PPCMCCodeEmitter::getDirectBrEncoding(), llvm::PPCMCCodeEmitter::getDispRI34PCRelEncoding(), llvm::PPCMCCodeEmitter::getDispRIEncoding(), llvm::PPCMCCodeEmitter::getDispRIX16Encoding(), llvm::PPCMCCodeEmitter::getDispRIXEncoding(), llvm::MipsMCCodeEmitter::getExprOpValue(), llvm::PPCMCCodeEmitter::getImm16Encoding(), llvm::PPCMCCodeEmitter::getImm34Encoding(), llvm::CSKYMCCodeEmitter::getImmOpValue(), llvm::MipsMCCodeEmitter::getJumpOffset16OpValue(), llvm::MipsMCCodeEmitter::getJumpTargetOpValue(), llvm::MipsMCCodeEmitter::getJumpTargetOpValueMM(), llvm::MipsMCCodeEmitter::getSimm18Lsl3Encoding(), llvm::MipsMCCodeEmitter::getSimm19Lsl2Encoding(), llvm::PPCMCCodeEmitter::getTLSCallEncoding(), llvm::PPCMCCodeEmitter::getTLSRegEncoding(), llvm::LoongArchAsmBackend::handleAddSubRelocations(), llvm::RISCVAsmBackend::handleAddSubRelocations(), llvm::LoongArchAsmBackend::relaxDwarfCFA(), llvm::RISCVAsmBackend::relaxDwarfCFA(), llvm::LoongArchAsmBackend::relaxDwarfLineAddr(), llvm::RISCVAsmBackend::relaxDwarfLineAddr(), llvm::LoongArchAsmBackend::relaxLEB128(), llvm::RISCVAsmBackend::relaxLEB128(), llvm::LoongArchAsmBackend::shouldInsertFixupForCodeAlign(), and llvm::RISCVAsmBackend::shouldInsertFixupForCodeAlign().

◆ getKind()

MCFixupKind llvm::MCFixup::getKind ( ) const
inline

Definition at line 98 of file MCFixup.h.

Referenced by llvm::operator<<().

◆ getKindForSize()

static MCFixupKind llvm::MCFixup::getKindForSize ( unsigned  Size,
bool  IsPCRel 
)
inlinestatic

Return the generic fixup kind for a value with the given size.

It is an error to pass an unsupported size.

Definition at line 109 of file MCFixup.h.

References llvm::FK_Data_1, llvm::FK_Data_2, llvm::FK_Data_4, llvm::FK_Data_8, llvm::FK_PCRel_1, llvm::FK_PCRel_2, llvm::FK_PCRel_4, llvm::FK_PCRel_8, llvm_unreachable, and Size.

Referenced by llvm::MCObjectStreamer::emitValueImpl(), and getImmFixupKind().

◆ getLoc()

SMLoc llvm::MCFixup::getLoc ( ) const
inline

Definition at line 123 of file MCFixup.h.

◆ getOffset()

uint32_t llvm::MCFixup::getOffset ( ) const
inline

Definition at line 102 of file MCFixup.h.

Referenced by llvm::RISCVAsmBackend::evaluateTargetFixup(), and llvm::operator<<().

◆ getTargetKind()

unsigned llvm::MCFixup::getTargetKind ( ) const
inline

Definition at line 100 of file MCFixup.h.

◆ getValue()

const MCExpr * llvm::MCFixup::getValue ( ) const
inline

Definition at line 105 of file MCFixup.h.

Referenced by llvm::RISCVAsmBackend::evaluateTargetFixup(), and llvm::operator<<().

◆ setOffset()

void llvm::MCFixup::setOffset ( uint32_t  Value)
inline

Definition at line 103 of file MCFixup.h.


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