LLVM 22.0.0git
llvm::MCSymbolRefExpr Class Reference

Represent a reference to a symbol from inside an expression. More...

#include "llvm/MC/MCExpr.h"

Inheritance diagram for llvm::MCSymbolRefExpr:
[legend]

Public Types

enum  VariantKind : uint16_t { VK_COFF_IMGREL32 = 3 , FirstTargetSpecifier }
Public Types inherited from llvm::MCExpr
enum  ExprKind : uint8_t {
  Binary , Constant , SymbolRef , Unary ,
  Specifier , Target
}

Public Member Functions

Accessors
const MCSymbolgetSymbol () const
VariantKind getKind () const
uint16_t getSpecifier () const
Public Member Functions inherited from llvm::MCExpr
 MCExpr (const MCExpr &)=delete
MCExproperator= (const MCExpr &)=delete
ExprKind getKind () const
SMLoc getLoc () const
LLVM_ABI void dump () const
LLVM_ABI bool evaluateAsAbsolute (int64_t &Res) const
 Try to evaluate the expression to an absolute value.
LLVM_ABI bool evaluateAsAbsolute (int64_t &Res, const MCAssembler &Asm) const
LLVM_ABI bool evaluateAsAbsolute (int64_t &Res, const MCAssembler *Asm) const
LLVM_ABI bool evaluateKnownAbsolute (int64_t &Res, const MCAssembler &Asm) const
 Aggressive variant of evaluateAsRelocatable when relocations are unavailable (e.g.
LLVM_ABI bool evaluateAsRelocatable (MCValue &Res, const MCAssembler *Asm) const
 Try to evaluate the expression to a relocatable value, i.e.
LLVM_ABI bool evaluateAsValue (MCValue &Res, const MCAssembler &Asm) const
 Try to evaluate the expression to the form (a - b + constant) where neither a nor b are variables.
LLVM_ABI MCFragmentfindAssociatedFragment () const
 Find the "associated section" for this expression, which is currently defined as the absolute section for constants, or otherwise the section associated with the first defined symbol in the expression.

Static Public Member Functions

static bool classof (const MCExpr *E)
Construction
static const MCSymbolRefExprcreate (const MCSymbol *Symbol, MCContext &Ctx, SMLoc Loc=SMLoc())
static LLVM_ABI const MCSymbolRefExprcreate (const MCSymbol *Symbol, Spec specifier, MCContext &Ctx, SMLoc Loc=SMLoc())
Static Public Member Functions inherited from llvm::MCExpr
static LLVM_ABI bool evaluateSymbolicAdd (const MCAssembler *, bool, const MCValue &, const MCValue &, MCValue &)

Additional Inherited Members

Protected Types inherited from llvm::MCExpr
using Spec = uint16_t
Protected Member Functions inherited from llvm::MCExpr
 MCExpr (ExprKind Kind, SMLoc Loc, unsigned SubclassData=0)
LLVM_ABI bool evaluateAsRelocatableImpl (MCValue &Res, const MCAssembler *Asm, bool InSet) const
unsigned getSubclassData () const

Detailed Description

Represent a reference to a symbol from inside an expression.

A symbol reference in an expression may be a use of a label, a use of an assembler variable (defined constant), or constitute an implicit definition of the symbol as external.

Definition at line 190 of file MCExpr.h.

Member Enumeration Documentation

◆ VariantKind

Enumerator
VK_COFF_IMGREL32 
FirstTargetSpecifier 

Definition at line 197 of file MCExpr.h.

Member Function Documentation

◆ classof()

bool llvm::MCSymbolRefExpr::classof ( const MCExpr * E)
inlinestatic

Definition at line 237 of file MCExpr.h.

References E(), llvm::MCExpr::MCExpr(), and llvm::MCExpr::SymbolRef.

◆ create() [1/2]

const MCSymbolRefExpr * llvm::MCSymbolRefExpr::create ( const MCSymbol * Symbol,
MCContext & Ctx,
SMLoc Loc = SMLoc() )
inlinestatic

Definition at line 214 of file MCExpr.h.

References create().

Referenced by llvm::ConstantPool::addEntry(), llvm::CSKYConstantPool::addEntry(), llvm::MCAsmParser::applySpecifier(), ARM64EmitRuntimeFunction(), ARM64EmitUnwindInfoForSegment(), ARMEmitRuntimeFunction(), ARMEmitUnwindInfo(), buildSymbolDiff(), buildSymbolDiff(), computeLabelDiff(), llvm::MCSpecifierExpr::create(), create(), createGOTRelExprOp(), createPCXCallOP(), createPCXRelExprOp(), createSparcMCOperand(), createVEMCOperand(), llvm::SystemZTargetGOFFStreamer::createWordDiffExpr(), llvm::SystemZTargetHLASMStreamer::createWordDiffExpr(), llvm::AMDGPUDisassembler::decodeVersionImm(), llvm::AsmPrinter::doFinalization(), llvm::AddressPool::emit(), EmitAbsDifference(), llvm::MCStreamer::emitAbsoluteSymbolDiff(), llvm::MCStreamer::emitAbsoluteSymbolDiffAsULEB128(), llvm::AMDGPUTargetELFStreamer::EmitAmdhsaKernelDescriptor(), llvm::TargetLoweringObjectFile::emitCGProfileMetadata(), llvm::MCWinCOFFStreamer::emitCOFFImgRel32(), llvm::MCWinCOFFStreamer::emitCOFFSecRel32(), llvm::MCWinCOFFStreamer::emitCOFFSectionIndex(), llvm::MipsTargetELFStreamer::emitDirectiveCpsetup(), llvm::MipsTargetELFStreamer::emitDirectiveEnd(), emitDirectiveRelocJalr(), llvm::EHStreamer::emitExceptionTable(), llvm::CodeViewContext::emitFileChecksumOffset(), llvm::WebAssemblyAsmPrinter::EmitFunctionAttributes(), llvm::AsmPrinter::emitFunctionBody(), EmitGenDwarfAranges(), EmitGenDwarfInfo(), emitGenDwarfRanges(), llvm::AMDGPUTargetELFStreamer::EmitHSAMetadata(), llvm::ARMAsmPrinter::emitInstruction(), llvm::SystemZAsmPrinter::emitInstruction(), llvm::X86AsmPrinter::emitInstruction(), llvm::AMDGPUTargetELFStreamer::EmitISAVersion(), llvm::ARMAsmPrinter::emitJumpTableAddrs(), llvm::AsmPrinter::emitJumpTableEntry(), llvm::BPFAsmPrinter::emitJumpTableInfo(), llvm::LoongArchAsmPrinter::emitJumpTableInfo(), llvm::ARMAsmPrinter::emitJumpTableInsts(), llvm::ARMAsmPrinter::emitJumpTableTBInst(), llvm::X86AsmPrinter::emitKCFITypeId(), llvm::AsmPrinter::emitLabelPlusOffset(), llvm::ARMAsmPrinter::emitMachineConstantPoolValue(), llvm::CSKYAsmPrinter::emitMachineConstantPoolValue(), llvm::SystemZAsmPrinter::emitMachineConstantPoolValue(), llvm::XtensaAsmPrinter::emitMachineConstantPoolValue(), emitNonLazySymbolPointer(), emitNonLazySymbolPointer(), EmitNop(), llvm::AArch64_ELFTargetObjectFile::emitPersonalityValueImpl(), llvm::MCObjectStreamer::emitRelocDirective(), EmitRuntimeFunction(), llvm::HexagonAsmPrinter::EmitSled(), llvm::LoongArchAsmPrinter::emitSled(), EmitSymbolRefWithOfs(), EmitSymbolRefWithOfs(), llvm::MCStreamer::emitSymbolValue(), EmitUnwindInfo(), llvm::AVRMCELFStreamer::emitValueForModiferKind(), llvm::MCELFStreamer::emitWeakReference(), llvm::MCWinCOFFStreamer::emitWeakReference(), llvm::MCXCOFFStreamer::emitXCOFFRefDirective(), llvm::AsmPrinter::emitXRayTable(), llvm::ARMAsmPrinter::emitXXStructor(), llvm::CodeViewContext::encodeDefRange(), llvm::WasmException::endFunction(), llvm::ELFObjectWriter::executePostLayoutBinding(), llvm::RecordStreamer::flushSymverDirectives(), forceExpAbs(), llvm::MCResourceInfo::gatherResourceInfo(), getAuthPtrSlotSymbolHelper(), llvm::ARMElfTargetObjectFile::getDebugThreadLocalSymbol(), llvm::MipsTargetObjectFile::getDebugThreadLocalSymbol(), llvm::SystemZELFTargetObjectFile::getDebugThreadLocalSymbol(), llvm::TargetLoweringObjectFile::getDebugThreadLocalSymbol(), llvm::X86ELFTargetObjectFile::getDebugThreadLocalSymbol(), llvm::SystemZMCInstLower::getExpr(), llvm::MCAsmInfo::getExprForFDESymbol(), llvm::RISCVMCAsmInfo::getExprForFDESymbol(), llvm::AArch64MCAsmInfoDarwin::getExprForPersonalitySymbol(), llvm::X86_64MCAsmInfoDarwin::getExprForPersonalitySymbol(), getGlobalOffsetTable(), llvm::AArch64MCInstLower::GetGlobalValueSymbol(), llvm::AArch64_ELFTargetObjectFile::getIndirectSymViaGOTPCRel(), llvm::AArch64_MachoTargetObjectFile::getIndirectSymViaGOTPCRel(), llvm::ARMElfTargetObjectFile::getIndirectSymViaGOTPCRel(), llvm::RISCVELFTargetObjectFile::getIndirectSymViaGOTPCRel(), llvm::TargetLoweringObjectFileMachO::getIndirectSymViaGOTPCRel(), llvm::X86_64ELFTargetObjectFile::getIndirectSymViaGOTPCRel(), llvm::X86_64MachoTargetObjectFile::getIndirectSymViaGOTPCRel(), llvm::ARMElfTargetObjectFile::getIndirectSymViaRWPI(), GetOptionalAbsDifference(), llvm::M68kTargetLowering::getPICJumpTableRelocBaseExpr(), llvm::PPCTargetLowering::getPICJumpTableRelocBaseExpr(), llvm::TargetLowering::getPICJumpTableRelocBaseExpr(), llvm::X86TargetLowering::getPICJumpTableRelocBaseExpr(), GetSubDivExpr(), GetSymbolRef(), GetSymbolRef(), llvm::MCResourceInfo::getSymRefExpr(), getTLSGetOffset(), llvm::AArch64_MachoTargetObjectFile::getTTypeGlobalReference(), llvm::ARMElfTargetObjectFile::getTTypeGlobalReference(), llvm::TargetLoweringObjectFile::getTTypeGlobalReference(), llvm::TargetLoweringObjectFileELF::getTTypeGlobalReference(), llvm::TargetLoweringObjectFileMachO::getTTypeGlobalReference(), llvm::X86_64MachoTargetObjectFile::getTTypeGlobalReference(), llvm::TargetLoweringObjectFile::getTTypeReference(), llvm::HexagonLowerToMC(), llvm::HexagonAsmPrinter::HexagonProcessInstruction(), llvm::SIInstrInfo::insertIndirectBranch(), llvm::BPFMCInstLower::Lower(), llvm::LanaiMCInstLower::Lower(), llvm::MSP430MCInstLower::Lower(), llvm::AsmPrinter::lowerBlockAddressConstant(), llvm::AsmPrinter::lowerConstant(), llvm::M68kTargetLowering::LowerCustomJumpTableEntry(), llvm::RISCVTargetLowering::LowerCustomJumpTableEntry(), llvm::VETargetLowering::LowerCustomJumpTableEntry(), llvm::X86TargetLowering::LowerCustomJumpTableEntry(), llvm::TargetLoweringObjectFileELF::lowerDSOLocalEquivalent(), llvm::AVRMCInstLower::lowerInstruction(), llvm::AArch64MCInstLower::lowerOperand(), llvm::AMDGPUMCInstLower::lowerOperand(), llvm::ARMAsmPrinter::lowerOperand(), llvm::CSKYMCInstLower::lowerOperand(), llvm::LowerPPCMachineOperandToMCOperand(), llvm::TargetLoweringObjectFileCOFF::lowerRelativeReference(), llvm::TargetLoweringObjectFileELF::lowerSymbolDifference(), llvm::BPFMCInstLower::LowerSymbolOperand(), llvm::LanaiMCInstLower::LowerSymbolOperand(), llvm::M68kMCInstLower::LowerSymbolOperand(), llvm::MSP430MCInstLower::LowerSymbolOperand(), llvm::XtensaAsmPrinter::LowerSymbolOperand(), LowerSymbolOperand(), llvm::AVRMCInstLower::lowerSymbolOperand(), llvm::CSKYMCInstLower::lowerSymbolOperand(), lowerSymbolOperand(), lowerSymbolOperand(), llvm::AArch64MCInstLower::lowerSymbolOperandCOFF(), llvm::AArch64MCInstLower::lowerSymbolOperandELF(), llvm::AArch64MCInstLower::lowerSymbolOperandMachO(), makeEndMinusStartExpr(), makeStartPlusIntExpr(), llvm::MCAsmParserExtension::parseDirectiveCGProfile(), llvm::FaultMaps::recordFaultingOp(), llvm::LoongArchAsmBackend::relaxAlign(), llvm::AArch64ExternalSymbolizer::tryAddingSymbolicOperand(), llvm::AMDGPUSymbolizer::tryAddingSymbolicOperand(), and llvm::MCExternalSymbolizer::tryAddingSymbolicOperand().

◆ create() [2/2]

const MCSymbolRefExpr * MCSymbolRefExpr::create ( const MCSymbol * Symbol,
Spec specifier,
MCContext & Ctx,
SMLoc Loc = SMLoc() )
static

Definition at line 226 of file MCExpr.cpp.

◆ getKind()

VariantKind llvm::MCSymbolRefExpr::getKind ( ) const
inline

◆ getSpecifier()

◆ getSymbol()


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