LLVM 22.0.0git
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
uint32_t getOffset () const
void setOffset (uint32_t Value)
const MCExprgetValue () const
bool isPCRel () const
void setPCRel ()
bool isLinkerRelaxable () const
void setLinkerRelaxable ()
LLVM_ABI SMLoc getLoc () const

Static Public Member Functions

static MCFixup create (uint32_t Offset, const MCExpr *Value, MCFixupKind Kind, bool PCRel=false)
 Consider bit fields if we need more flags.
static MCFixupKind getDataKindForSize (unsigned Size)
 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 61 of file MCFixup.h.

Member Function Documentation

◆ create()

◆ getDataKindForSize()

MCFixupKind llvm::MCFixup::getDataKindForSize ( unsigned Size)
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 110 of file MCFixup.h.

References llvm::FK_Data_1, llvm::FK_Data_2, llvm::FK_Data_4, llvm::FK_Data_8, llvm_unreachable, and Size.

Referenced by llvm::MCObjectStreamer::emitValueImpl(), llvm::LoongArchAsmBackend::relaxDwarfLineAddr(), and llvm::RISCVAsmBackend::relaxDwarfLineAddr().

◆ getKind()

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

Definition at line 96 of file MCFixup.h.

Referenced by llvm::RISCVAsmBackend::evaluateFixup().

◆ getLoc()

SMLoc MCFixup::getLoc ( ) const

Definition at line 1077 of file MCAssembler.cpp.

References getValue().

◆ getOffset()

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

Definition at line 98 of file MCFixup.h.

Referenced by llvm::RISCVAsmBackend::evaluateFixup().

◆ getValue()

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

Definition at line 101 of file MCFixup.h.

Referenced by llvm::RISCVAsmBackend::evaluateFixup(), and getLoc().

◆ isLinkerRelaxable()

bool llvm::MCFixup::isLinkerRelaxable ( ) const
inline

Definition at line 105 of file MCFixup.h.

◆ isPCRel()

bool llvm::MCFixup::isPCRel ( ) const
inline

Definition at line 103 of file MCFixup.h.

◆ setLinkerRelaxable()

void llvm::MCFixup::setLinkerRelaxable ( )
inline

Definition at line 106 of file MCFixup.h.

◆ setOffset()

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

Definition at line 99 of file MCFixup.h.

◆ setPCRel()

void llvm::MCFixup::setPCRel ( )
inline

Definition at line 104 of file MCFixup.h.


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