LLVM  8.0.1
Public Types | Static Public Member Functions | List of all members
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:
Inheritance graph
[legend]
Collaboration diagram for llvm::MCSymbolRefExpr:
Collaboration graph
[legend]

Public Types

enum  VariantKind : uint16_t {
  VK_None, VK_Invalid, VK_GOT, VK_GOTOFF,
  VK_GOTREL, VK_GOTPCREL, VK_GOTTPOFF, VK_INDNTPOFF,
  VK_NTPOFF, VK_GOTNTPOFF, VK_PLT, VK_TLSGD,
  VK_TLSLD, VK_TLSLDM, VK_TPOFF, VK_DTPOFF,
  VK_TLSCALL, VK_TLSDESC, VK_TLVP, VK_TLVPPAGE,
  VK_TLVPPAGEOFF, VK_PAGE, VK_PAGEOFF, VK_GOTPAGE,
  VK_GOTPAGEOFF, VK_SECREL, VK_SIZE, VK_WEAKREF,
  VK_X86_ABS8, VK_ARM_NONE, VK_ARM_GOT_PREL, VK_ARM_TARGET1,
  VK_ARM_TARGET2, VK_ARM_PREL31, VK_ARM_SBREL, VK_ARM_TLSLDO,
  VK_ARM_TLSDESCSEQ, VK_AVR_NONE, VK_AVR_LO8, VK_AVR_HI8,
  VK_AVR_HLO8, VK_AVR_DIFF8, VK_AVR_DIFF16, VK_AVR_DIFF32,
  VK_PPC_LO, VK_PPC_HI, VK_PPC_HA, VK_PPC_HIGH,
  VK_PPC_HIGHA, VK_PPC_HIGHER, VK_PPC_HIGHERA, VK_PPC_HIGHEST,
  VK_PPC_HIGHESTA, VK_PPC_GOT_LO, VK_PPC_GOT_HI, VK_PPC_GOT_HA,
  VK_PPC_TOCBASE, VK_PPC_TOC, VK_PPC_TOC_LO, VK_PPC_TOC_HI,
  VK_PPC_TOC_HA, VK_PPC_DTPMOD, VK_PPC_TPREL_LO, VK_PPC_TPREL_HI,
  VK_PPC_TPREL_HA, VK_PPC_TPREL_HIGH, VK_PPC_TPREL_HIGHA, VK_PPC_TPREL_HIGHER,
  VK_PPC_TPREL_HIGHERA, VK_PPC_TPREL_HIGHEST, VK_PPC_TPREL_HIGHESTA, VK_PPC_DTPREL_LO,
  VK_PPC_DTPREL_HI, VK_PPC_DTPREL_HA, VK_PPC_DTPREL_HIGH, VK_PPC_DTPREL_HIGHA,
  VK_PPC_DTPREL_HIGHER, VK_PPC_DTPREL_HIGHERA, VK_PPC_DTPREL_HIGHEST, VK_PPC_DTPREL_HIGHESTA,
  VK_PPC_GOT_TPREL, VK_PPC_GOT_TPREL_LO, VK_PPC_GOT_TPREL_HI, VK_PPC_GOT_TPREL_HA,
  VK_PPC_GOT_DTPREL, VK_PPC_GOT_DTPREL_LO, VK_PPC_GOT_DTPREL_HI, VK_PPC_GOT_DTPREL_HA,
  VK_PPC_TLS, VK_PPC_GOT_TLSGD, VK_PPC_GOT_TLSGD_LO, VK_PPC_GOT_TLSGD_HI,
  VK_PPC_GOT_TLSGD_HA, VK_PPC_TLSGD, VK_PPC_GOT_TLSLD, VK_PPC_GOT_TLSLD_LO,
  VK_PPC_GOT_TLSLD_HI, VK_PPC_GOT_TLSLD_HA, VK_PPC_TLSLD, VK_PPC_LOCAL,
  VK_COFF_IMGREL32, VK_Hexagon_PCREL, VK_Hexagon_LO16, VK_Hexagon_HI16,
  VK_Hexagon_GPREL, VK_Hexagon_GD_GOT, VK_Hexagon_LD_GOT, VK_Hexagon_GD_PLT,
  VK_Hexagon_LD_PLT, VK_Hexagon_IE, VK_Hexagon_IE_GOT, VK_WebAssembly_FUNCTION,
  VK_WebAssembly_GLOBAL, VK_WebAssembly_TYPEINDEX, VK_WebAssembly_EVENT, VK_AMDGPU_GOTPCREL32_LO,
  VK_AMDGPU_GOTPCREL32_HI, VK_AMDGPU_REL32_LO, VK_AMDGPU_REL32_HI, VK_AMDGPU_REL64,
  VK_TPREL, VK_DTPREL
}
 
- Public Types inherited from llvm::MCExpr
enum  ExprKind {
  Binary, Constant, SymbolRef, Unary,
  Target
}
 

Public Member Functions

Accessors
const MCSymbolgetSymbol () const
 
VariantKind getKind () const
 
void printVariantKind (raw_ostream &OS) const
 
bool hasSubsectionsViaSymbols () const
 
- Public Member Functions inherited from llvm::MCExpr
 MCExpr (const MCExpr &)=delete
 
MCExproperator= (const MCExpr &)=delete
 
ExprKind getKind () const
 
SMLoc getLoc () const
 
void print (raw_ostream &OS, const MCAsmInfo *MAI, bool InParens=false) const
 
void dump () const
 
bool evaluateAsAbsolute (int64_t &Res, const MCAsmLayout &Layout, const SectionAddrMap &Addrs) const
 Try to evaluate the expression to an absolute value. More...
 
bool evaluateAsAbsolute (int64_t &Res) const
 
bool evaluateAsAbsolute (int64_t &Res, const MCAssembler &Asm) const
 
bool evaluateAsAbsolute (int64_t &Res, const MCAssembler *Asm) const
 
bool evaluateAsAbsolute (int64_t &Res, const MCAsmLayout &Layout) const
 
bool evaluateKnownAbsolute (int64_t &Res, const MCAsmLayout &Layout) const
 
bool evaluateAsRelocatable (MCValue &Res, const MCAsmLayout *Layout, const MCFixup *Fixup) const
 Try to evaluate the expression to a relocatable value, i.e. More...
 
bool evaluateAsValue (MCValue &Res, const MCAsmLayout &Layout) const
 Try to evaluate the expression to the form (a - b + constant) where neither a nor b are variables. More...
 
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. More...
 

Static Public Member Functions

static bool classof (const MCExpr *E)
 
Construction
static const MCSymbolRefExprcreate (const MCSymbol *Symbol, MCContext &Ctx)
 
static const MCSymbolRefExprcreate (const MCSymbol *Symbol, VariantKind Kind, MCContext &Ctx, SMLoc Loc=SMLoc())
 
static const MCSymbolRefExprcreate (StringRef Name, VariantKind Kind, MCContext &Ctx)
 
Static Utility Functions
static StringRef getVariantKindName (VariantKind Kind)
 
static VariantKind getVariantKindForName (StringRef Name)
 

Additional Inherited Members

- Protected Member Functions inherited from llvm::MCExpr
 MCExpr (ExprKind Kind, SMLoc Loc)
 
bool evaluateAsRelocatableImpl (MCValue &Res, const MCAssembler *Asm, const MCAsmLayout *Layout, const MCFixup *Fixup, const SectionAddrMap *Addrs, bool InSet) 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 166 of file MCExpr.h.

Member Enumeration Documentation

◆ VariantKind

Enumerator
VK_None 
VK_Invalid 
VK_GOT 
VK_GOTOFF 
VK_GOTREL 
VK_GOTPCREL 
VK_GOTTPOFF 
VK_INDNTPOFF 
VK_NTPOFF 
VK_GOTNTPOFF 
VK_PLT 
VK_TLSGD 
VK_TLSLD 
VK_TLSLDM 
VK_TPOFF 
VK_DTPOFF 
VK_TLSCALL 
VK_TLSDESC 
VK_TLVP 
VK_TLVPPAGE 
VK_TLVPPAGEOFF 
VK_PAGE 
VK_PAGEOFF 
VK_GOTPAGE 
VK_GOTPAGEOFF 
VK_SECREL 
VK_SIZE 
VK_WEAKREF 
VK_X86_ABS8 
VK_ARM_NONE 
VK_ARM_GOT_PREL 
VK_ARM_TARGET1 
VK_ARM_TARGET2 
VK_ARM_PREL31 
VK_ARM_SBREL 
VK_ARM_TLSLDO 
VK_ARM_TLSDESCSEQ 
VK_AVR_NONE 
VK_AVR_LO8 
VK_AVR_HI8 
VK_AVR_HLO8 
VK_AVR_DIFF8 
VK_AVR_DIFF16 
VK_AVR_DIFF32 
VK_PPC_LO 
VK_PPC_HI 
VK_PPC_HA 
VK_PPC_HIGH 
VK_PPC_HIGHA 
VK_PPC_HIGHER 
VK_PPC_HIGHERA 
VK_PPC_HIGHEST 
VK_PPC_HIGHESTA 
VK_PPC_GOT_LO 
VK_PPC_GOT_HI 
VK_PPC_GOT_HA 
VK_PPC_TOCBASE 
VK_PPC_TOC 
VK_PPC_TOC_LO 
VK_PPC_TOC_HI 
VK_PPC_TOC_HA 
VK_PPC_DTPMOD 
VK_PPC_TPREL_LO 
VK_PPC_TPREL_HI 
VK_PPC_TPREL_HA 
VK_PPC_TPREL_HIGH 
VK_PPC_TPREL_HIGHA 
VK_PPC_TPREL_HIGHER 
VK_PPC_TPREL_HIGHERA 
VK_PPC_TPREL_HIGHEST 
VK_PPC_TPREL_HIGHESTA 
VK_PPC_DTPREL_LO 
VK_PPC_DTPREL_HI 
VK_PPC_DTPREL_HA 
VK_PPC_DTPREL_HIGH 
VK_PPC_DTPREL_HIGHA 
VK_PPC_DTPREL_HIGHER 
VK_PPC_DTPREL_HIGHERA 
VK_PPC_DTPREL_HIGHEST 
VK_PPC_DTPREL_HIGHESTA 
VK_PPC_GOT_TPREL 
VK_PPC_GOT_TPREL_LO 
VK_PPC_GOT_TPREL_HI 
VK_PPC_GOT_TPREL_HA 
VK_PPC_GOT_DTPREL 
VK_PPC_GOT_DTPREL_LO 
VK_PPC_GOT_DTPREL_HI 
VK_PPC_GOT_DTPREL_HA 
VK_PPC_TLS 
VK_PPC_GOT_TLSGD 
VK_PPC_GOT_TLSGD_LO 
VK_PPC_GOT_TLSGD_HI 
VK_PPC_GOT_TLSGD_HA 
VK_PPC_TLSGD 
VK_PPC_GOT_TLSLD 
VK_PPC_GOT_TLSLD_LO 
VK_PPC_GOT_TLSLD_HI 
VK_PPC_GOT_TLSLD_HA 
VK_PPC_TLSLD 
VK_PPC_LOCAL 
VK_COFF_IMGREL32 
VK_Hexagon_PCREL 
VK_Hexagon_LO16 
VK_Hexagon_HI16 
VK_Hexagon_GPREL 
VK_Hexagon_GD_GOT 
VK_Hexagon_LD_GOT 
VK_Hexagon_GD_PLT 
VK_Hexagon_LD_PLT 
VK_Hexagon_IE 
VK_Hexagon_IE_GOT 
VK_WebAssembly_FUNCTION 
VK_WebAssembly_GLOBAL 
VK_WebAssembly_TYPEINDEX 
VK_WebAssembly_EVENT 
VK_AMDGPU_GOTPCREL32_LO 
VK_AMDGPU_GOTPCREL32_HI 
VK_AMDGPU_REL32_LO 
VK_AMDGPU_REL32_HI 
VK_AMDGPU_REL64 
VK_TPREL 
VK_DTPREL 

Definition at line 168 of file MCExpr.h.

Member Function Documentation

◆ classof()

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

Definition at line 354 of file MCExpr.h.

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

◆ create() [1/3]

static const MCSymbolRefExpr* llvm::MCSymbolRefExpr::create ( const MCSymbol Symbol,
MCContext Ctx 
)
inlinestatic

Definition at line 323 of file MCExpr.h.

References Name.

Referenced by llvm::ConstantPool::addEntry(), addNegOperand(), llvm::ARCMCInstLower::ARCMCInstLower(), ARM64EmitRuntimeFunction(), ARM64EmitUnwindInfo(), buildSymbolDiff(), ConvertDoubleToBytes(), convertFPR32ToFPR64(), countMCSymbolRefExpr(), createPCXRelExprOp(), createSparcMCOperand(), llvm::AddressPool::emit(), EmitAbsDifference(), llvm::MCStreamer::emitAbsoluteSymbolDiff(), llvm::MCStreamer::emitAbsoluteSymbolDiffAsULEB128(), llvm::AMDGPUTargetELFStreamer::EmitAmdhsaKernelDescriptor(), llvm::MCWinCOFFStreamer::EmitCOFFImgRel32(), llvm::MCWinCOFFStreamer::EmitCOFFSecRel32(), llvm::MCWinCOFFStreamer::EmitCOFFSectionIndex(), llvm::AsmPrinter::EmitDebugValue(), llvm::MipsTargetELFStreamer::emitDirectiveCpLoad(), llvm::MipsTargetELFStreamer::emitDirectiveCpsetup(), llvm::MipsTargetELFStreamer::emitDirectiveEnd(), emitDirectiveRelocJalr(), llvm::MipsAsmPrinter::EmitEndOfAsmFile(), llvm::CodeViewContext::emitFileChecksumOffset(), llvm::AsmPrinter::EmitFunctionBody(), EmitGenDwarfAranges(), EmitGenDwarfRanges(), llvm::AMDGPUTargetELFStreamer::EmitHSAMetadata(), llvm::MCELFStreamer::EmitIdent(), llvm::SystemZAsmPrinter::EmitInstruction(), llvm::ARMAsmPrinter::EmitInstruction(), llvm::X86AsmPrinter::EmitInstruction(), llvm::AMDGPUTargetELFStreamer::EmitISAVersion(), llvm::ARMAsmPrinter::EmitJumpTableAddrs(), llvm::AsmPrinter::EmitJumpTableInfo(), llvm::ARMAsmPrinter::EmitJumpTableInsts(), llvm::ARMAsmPrinter::EmitJumpTableTBInst(), llvm::AsmPrinter::EmitLabelPlusOffset(), llvm::SystemZAsmPrinter::EmitMachineConstantPoolValue(), llvm::ARMAsmPrinter::EmitMachineConstantPoolValue(), llvm::TargetLoweringObjectFileELF::emitModuleMetadata(), emitNonLazySymbolPointer(), EmitNop(), EmitNops(), llvm::MCObjectStreamer::EmitRelocDirective(), EmitRuntimeFunction(), llvm::MipsAsmPrinter::EmitStartOfAsmFile(), EmitSymbolRefWithOfs(), llvm::MCStreamer::EmitSymbolValue(), EmitUnwindInfo(), llvm::AVRMCELFStreamer::EmitValueForModiferKind(), llvm::MCELFStreamer::EmitWeakReference(), llvm::MCWasmStreamer::EmitWeakReference(), llvm::ARMAsmPrinter::EmitXXStructor(), encodeBitmaskPerm(), llvm::CodeViewContext::encodeDefRange(), llvm::WinException::endFunclet(), llvm::WasmException::endFunction(), llvm::AVRMCExpr::evaluateAsRelocatableImpl(), llvm::PPCMCExpr::evaluateAsRelocatableImpl(), llvm::RecordStreamer::flushSymverDirectives(), forceExpAbs(), GetAbsDifference(), GetAEABIUnwindPersonalityName(), llvm::ARMElfTargetObjectFile::getDebugThreadLocalSymbol(), llvm::MipsTargetObjectFile::getDebugThreadLocalSymbol(), llvm::X86ELFTargetObjectFile::getDebugThreadLocalSymbol(), llvm::TargetLoweringObjectFile::getDebugThreadLocalSymbol(), getDwarfRegNum(), llvm::SystemZMCInstLower::getExpr(), llvm::SparcELFMCAsmInfo::getExprForFDESymbol(), llvm::MCAsmInfo::getExprForFDESymbol(), llvm::AArch64MCAsmInfoDarwin::getExprForPersonalitySymbol(), llvm::SparcELFMCAsmInfo::getExprForPersonalitySymbol(), llvm::X86_64MCAsmInfoDarwin::getExprForPersonalitySymbol(), getGlobalOffsetTable(), llvm::X86_64MachoTargetObjectFile::getIndirectSymViaGOTPCRel(), llvm::AArch64_MachoTargetObjectFile::getIndirectSymViaGOTPCRel(), llvm::TargetLoweringObjectFileMachO::getIndirectSymViaGOTPCRel(), llvm::X86TargetLowering::getPICJumpTableRelocBaseExpr(), llvm::PPCTargetLowering::getPICJumpTableRelocBaseExpr(), llvm::TargetLowering::getPICJumpTableRelocBaseExpr(), getRealVLDOpcode(), getRetOpcode(), GetSymbolRef(), getTLSGetOffset(), llvm::X86_64MachoTargetObjectFile::getTTypeGlobalReference(), llvm::ARMElfTargetObjectFile::getTTypeGlobalReference(), llvm::SparcELFTargetObjectFile::getTTypeGlobalReference(), llvm::AArch64_MachoTargetObjectFile::getTTypeGlobalReference(), llvm::TargetLoweringObjectFileELF::getTTypeGlobalReference(), llvm::TargetLoweringObjectFileMachO::getTTypeGlobalReference(), llvm::TargetLoweringObjectFile::getTTypeGlobalReference(), llvm::TargetLoweringObjectFile::getTTypeReference(), getVariantKind(), llvm::HexagonLowerToMC(), llvm::HexagonAsmPrinter::HexagonProcessInstruction(), incrementLoc(), llvm::XCoreMCInstLower::Initialize(), llvm::MipsMCInstLower::Initialize(), llvm::IsCPSRDead< MCInst >(), IsSmallMemAccess(), isWeak(), llvm::MSP430MCInstLower::Lower(), llvm::BPFMCInstLower::Lower(), llvm::LanaiMCInstLower::Lower(), llvm::WebAssemblyMCInstLower::Lower(), llvm::WebAssemblyAsmPrinter::lowerConstant(), llvm::AsmPrinter::lowerConstant(), llvm::X86TargetLowering::LowerCustomJumpTableEntry(), llvm::AVRMCInstLower::lowerInstruction(), llvm::AArch64MCInstLower::lowerOperand(), llvm::MipsMCInstLower::LowerOperand(), llvm::ARMAsmPrinter::lowerOperand(), llvm::LowerPPCMachineOperandToMCOperand(), llvm::TargetLoweringObjectFileELF::lowerRelativeReference(), llvm::TargetLoweringObjectFileCOFF::lowerRelativeReference(), llvm::TargetLoweringObjectFileWasm::lowerRelativeReference(), lowerSymbolOperand(), LowerSymbolOperand(), llvm::AVRMCInstLower::lowerSymbolOperand(), llvm::MSP430MCInstLower::LowerSymbolOperand(), llvm::BPFMCInstLower::LowerSymbolOperand(), llvm::LanaiMCInstLower::LowerSymbolOperand(), llvm::AArch64MCInstLower::lowerSymbolOperandCOFF(), llvm::AArch64MCInstLower::lowerSymbolOperandDarwin(), llvm::AArch64MCInstLower::lowerSymbolOperandELF(), makeCombineInst(), MCAttrForString(), nextReg(), printFPOReg(), printMCExpr(), llvm::FaultMaps::recordFaultingOp(), RefineErrorLoc(), llvm::AArch64ExternalSymbolizer::tryAddingSymbolicOperand(), llvm::MCExternalSymbolizer::tryAddingSymbolicOperand(), llvm::AMDGPUSymbolizer::tryAddingSymbolicOperand(), and VisitGlobalVariableForEmission().

◆ create() [2/3]

const MCSymbolRefExpr * MCSymbolRefExpr::create ( const MCSymbol Symbol,
VariantKind  Kind,
MCContext Ctx,
SMLoc  Loc = SMLoc() 
)
static

Definition at line 179 of file MCExpr.cpp.

◆ create() [3/3]

const MCSymbolRefExpr * MCSymbolRefExpr::create ( StringRef  Name,
VariantKind  Kind,
MCContext Ctx 
)
static

Definition at line 185 of file MCExpr.cpp.

◆ getKind()

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

◆ getSymbol()

const MCSymbol& llvm::MCSymbolRefExpr::getSymbol ( ) const
inline

◆ getVariantKindForName()

MCSymbolRefExpr::VariantKind MCSymbolRefExpr::getVariantKindForName ( StringRef  Name)
static

Definition at line 320 of file MCExpr.cpp.

Referenced by altMacroString().

◆ getVariantKindName()

StringRef MCSymbolRefExpr::getVariantKindName ( VariantKind  Kind)
static

Definition at line 190 of file MCExpr.cpp.

Referenced by llvm::PPCInstPrinter::printTLSCall().

◆ hasSubsectionsViaSymbols()

bool llvm::MCSymbolRefExpr::hasSubsectionsViaSymbols ( ) const
inline

Definition at line 342 of file MCExpr.h.

Referenced by llvm::MCExpr::evaluateAsRelocatableImpl().

◆ printVariantKind()

void MCSymbolRefExpr::printVariantKind ( raw_ostream OS) const

Definition at line 434 of file MCExpr.cpp.

Referenced by llvm::MCExpr::print().


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