LLVM  6.0.0svn
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_PPC_LO, VK_PPC_HI, VK_PPC_HA,
  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_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_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_TYPEINDEX,
  VK_AMDGPU_GOTPCREL32_LO, VK_AMDGPU_GOTPCREL32_HI, VK_AMDGPU_REL32_LO, VK_AMDGPU_REL32_HI,
  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 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 165 of file MCExpr.h.

Member Enumeration Documentation

◆ VariantKind

Enumerator
VK_None 
VK_Invalid 
VK_GOT 
VK_GOTOFF 
VK_GOTREL 
VK_GOTPCREL 
VK_GOTTPOFF 
VK_INDN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T_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_TYPEINDEX 
VK_AMDGPU_GOTPCREL32_LO 
VK_AMDGPU_GOTPCREL32_HI 
VK_AMDGPU_REL32_LO 
VK_AMDGPU_REL32_HI 
VK_TPREL 
VK_DTPREL 

Definition at line 167 of file MCExpr.h.

Member Function Documentation

◆ classof()

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

Definition at line 336 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 305 of file MCExpr.h.

References Name.

Referenced by llvm::ConstantPool::addEntry(), addNegOperand(), buildSymbolDiff(), computeLabelDiff(), createPCXRelExprOp(), createSparcMCOperand(), llvm::AddressPool::emit(), EmitAbsDifference(), llvm::MCStreamer::emitAbsoluteSymbolDiff(), llvm::AMDGPUTargetELFStreamer::EmitCodeObjectMetadata(), llvm::MCWinCOFFStreamer::EmitCOFFSecRel32(), llvm::MCWinCOFFStreamer::EmitCOFFSectionIndex(), llvm::AsmPrinter::EmitDebugThreadLocal(), llvm::MipsTargetELFStreamer::emitDirectiveCpLoad(), llvm::MipsTargetELFStreamer::emitDirectiveCpsetup(), llvm::MipsTargetELFStreamer::emitDirectiveEnd(), llvm::MipsAsmPrinter::EmitEndOfAsmFile(), llvm::AsmPrinter::EmitFunctionBody(), EmitGenDwarfAranges(), EmitGenDwarfInfo(), EmitGenDwarfRanges(), llvm::SystemZAsmPrinter::EmitInstruction(), llvm::ARMAsmPrinter::EmitInstruction(), llvm::X86AsmPrinter::EmitInstruction(), llvm::AMDGPUAsmPrinter::EmitInstruction(), llvm::ARMAsmPrinter::EmitJumpTableAddrs(), llvm::AsmPrinter::EmitJumpTableInfo(), llvm::ARMAsmPrinter::EmitJumpTableInsts(), llvm::ARMAsmPrinter::EmitJumpTableTBInst(), llvm::AsmPrinter::EmitLabelPlusOffset(), llvm::NVPTXAsmPrinter::emitLineNumberAsDotLoc(), llvm::SystemZAsmPrinter::EmitMachineConstantPoolValue(), llvm::ARMAsmPrinter::EmitMachineConstantPoolValue(), emitNonLazySymbolPointer(), EmitNops(), llvm::MCObjectStreamer::EmitRelocDirective(), EmitRuntimeFunction(), llvm::MipsAsmPrinter::EmitStartOfAsmFile(), EmitSymbolRefWithOfs(), llvm::MCStreamer::EmitSymbolValue(), EmitUnwindInfo(), llvm::MCWasmStreamer::EmitWeakReference(), llvm::MCELFStreamer::EmitWeakReference(), llvm::ARMAsmPrinter::EmitXXStructor(), encodeBitmaskPerm(), llvm::CodeViewContext::encodeDefRange(), llvm::WinException::endFunclet(), llvm::AVRMCExpr::evaluateAsRelocatableImpl(), llvm::PPCMCExpr::evaluateAsRelocatableImpl(), llvm::DwarfAccelTable::FinalizeTable(), forceExpAbs(), 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::SparcELFTargetObjectFile::getTTypeGlobalReference(), llvm::AArch64_MachoTargetObjectFile::getTTypeGlobalReference(), llvm::ARMElfTargetObjectFile::getTTypeGlobalReference(), llvm::TargetLoweringObjectFileELF::getTTypeGlobalReference(), llvm::TargetLoweringObjectFileMachO::getTTypeGlobalReference(), llvm::TargetLoweringObjectFile::getTTypeGlobalReference(), llvm::TargetLoweringObjectFile::getTTypeReference(), getVariantKind(), llvm::HexagonLowerToMC(), llvm::HexagonAsmPrinter::HexagonProcessInstruction(), llvm::NVPTXAsmPrinter::ignoreLoc(), incrementLoc(), llvm::XCoreMCInstLower::Initialize(), llvm::MipsMCInstLower::Initialize(), llvm::IsCPSRDead< MCInst >(), IsSmallMemAccess(), 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::MipsMCInstLower::LowerOperand(), llvm::AMDGPUMCInstLower::lowerOperand(), llvm::AArch64MCInstLower::lowerOperand(), llvm::ARMAsmPrinter::lowerOperand(), llvm::LowerPPCMachineInstrToMCInst(), llvm::TargetLoweringObjectFileELF::lowerRelativeReference(), llvm::TargetLoweringObjectFileWasm::lowerRelativeReference(), LowerSymbolOperand(), llvm::AVRMCInstLower::lowerSymbolOperand(), llvm::MSP430MCInstLower::LowerSymbolOperand(), llvm::BPFMCInstLower::LowerSymbolOperand(), llvm::LanaiMCInstLower::LowerSymbolOperand(), llvm::AArch64MCInstLower::lowerSymbolOperandCOFF(), llvm::AArch64MCInstLower::lowerSymbolOperandDarwin(), llvm::AArch64MCInstLower::lowerSymbolOperandELF(), makeCombineInst(), MakeStartMinusEndExpr(), MCAttrForString(), nextReg(), llvm::FaultMaps::recordFaultingOp(), RefineErrorLoc(), RewriteIntelBracExpression(), stripRegisterPrefix(), llvm::AArch64ExternalSymbolizer::tryAddingSymbolicOperand(), llvm::MCExternalSymbolizer::tryAddingSymbolicOperand(), and llvm::AMDGPUSymbolizer::tryAddingSymbolicOperand().

◆ create() [2/3]

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

Definition at line 174 of file MCExpr.cpp.

◆ create() [3/3]

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

Definition at line 180 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 299 of file MCExpr.cpp.

◆ getVariantKindName()

StringRef MCSymbolRefExpr::getVariantKindName ( VariantKind  Kind)
static

Definition at line 185 of file MCExpr.cpp.

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

◆ hasSubsectionsViaSymbols()

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

Definition at line 324 of file MCExpr.h.

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

◆ printVariantKind()

void MCSymbolRefExpr::printVariantKind ( raw_ostream OS) const

Definition at line 399 of file MCExpr.cpp.

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


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