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

#include "Target/RISCV/MCTargetDesc/RISCVMCExpr.h"

Inheritance diagram for llvm::RISCVMCExpr:
Inheritance graph
[legend]

Public Types

enum  VariantKind {
  VK_RISCV_None , VK_RISCV_LO , VK_RISCV_HI , VK_RISCV_PCREL_LO ,
  VK_RISCV_PCREL_HI , VK_RISCV_GOT_HI , VK_RISCV_TPREL_LO , VK_RISCV_TPREL_HI ,
  VK_RISCV_TPREL_ADD , VK_RISCV_TLS_GOT_HI , VK_RISCV_TLS_GD_HI , VK_RISCV_CALL ,
  VK_RISCV_CALL_PLT , VK_RISCV_32_PCREL , VK_RISCV_TLSDESC_HI , VK_RISCV_TLSDESC_LOAD_LO ,
  VK_RISCV_TLSDESC_ADD_LO , VK_RISCV_TLSDESC_CALL , VK_RISCV_Invalid
}
 
- Public Types inherited from llvm::MCExpr
enum  ExprKind : uint8_t {
  Binary , Constant , SymbolRef , Unary ,
  Target
}
 

Public Member Functions

VariantKind getKind () const
 
const MCExprgetSubExpr () const
 
const MCFixupgetPCRelHiFixup (const MCFragment **DFOut) const
 Get the corresponding PC-relative HI fixup that a VK_RISCV_PCREL_LO points to, and optionally the fragment containing it.
 
void printImpl (raw_ostream &OS, const MCAsmInfo *MAI) const override
 
bool evaluateAsRelocatableImpl (MCValue &Res, const MCAssembler *Asm, const MCFixup *Fixup) const override
 
void visitUsedExpr (MCStreamer &Streamer) const override
 
MCFragmentfindAssociatedFragment () const override
 
void fixELFSymbolsInTLSFixups (MCAssembler &Asm) const override
 
bool evaluateAsConstant (int64_t &Res) const
 
- Public Member Functions inherited from llvm::MCTargetExpr
virtual void printImpl (raw_ostream &OS, const MCAsmInfo *MAI) const =0
 
virtual bool evaluateAsRelocatableImpl (MCValue &Res, const MCAssembler *Asm, const MCFixup *Fixup) const =0
 
virtual bool isEqualTo (const MCExpr *x) const
 
virtual bool inlineAssignedExpr () const
 
virtual void visitUsedExpr (MCStreamer &Streamer) const =0
 
virtual MCFragmentfindAssociatedFragment () const =0
 
virtual void fixELFSymbolsInTLSFixups (MCAssembler &) const =0
 
- 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 MCAssembler &Asm, const SectionAddrMap &Addrs) const
 Try to evaluate the expression to an absolute value.
 
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 evaluateKnownAbsolute (int64_t &Res, const MCAssembler &Asm) const
 Aggressive variant of evaluateAsRelocatable when relocations are unavailable (e.g.
 
bool evaluateAsRelocatable (MCValue &Res, const MCAssembler *Asm, const MCFixup *Fixup) const
 Try to evaluate the expression to a relocatable value, i.e.
 
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.
 
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 const RISCVMCExprcreate (const MCExpr *Expr, VariantKind Kind, MCContext &Ctx)
 
static bool classof (const MCExpr *E)
 
static VariantKind getVariantKindForName (StringRef name)
 
static StringRef getVariantKindName (VariantKind Kind)
 
- Static Public Member Functions inherited from llvm::MCTargetExpr
static bool classof (const MCExpr *E)
 

Additional Inherited Members

- Protected Member Functions inherited from llvm::MCTargetExpr
 MCTargetExpr ()
 
virtual ~MCTargetExpr ()=default
 
- Protected Member Functions inherited from llvm::MCExpr
 MCExpr (ExprKind Kind, SMLoc Loc, unsigned SubclassData=0)
 
bool evaluateAsRelocatableImpl (MCValue &Res, const MCAssembler *Asm, const MCFixup *Fixup, const SectionAddrMap *Addrs, bool InSet) const
 
unsigned getSubclassData () const
 

Detailed Description

Definition at line 23 of file RISCVMCExpr.h.

Member Enumeration Documentation

◆ VariantKind

Enumerator
VK_RISCV_None 
VK_RISCV_LO 
VK_RISCV_HI 
VK_RISCV_PCREL_LO 
VK_RISCV_PCREL_HI 
VK_RISCV_GOT_HI 
VK_RISCV_TPREL_LO 
VK_RISCV_TPREL_HI 
VK_RISCV_TPREL_ADD 
VK_RISCV_TLS_GOT_HI 
VK_RISCV_TLS_GD_HI 
VK_RISCV_CALL 
VK_RISCV_CALL_PLT 
VK_RISCV_32_PCREL 
VK_RISCV_TLSDESC_HI 
VK_RISCV_TLSDESC_LOAD_LO 
VK_RISCV_TLSDESC_ADD_LO 
VK_RISCV_TLSDESC_CALL 
VK_RISCV_Invalid 

Definition at line 25 of file RISCVMCExpr.h.

Member Function Documentation

◆ classof()

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

Definition at line 83 of file RISCVMCExpr.h.

References E, and llvm::MCExpr::Target.

◆ create()

const RISCVMCExpr * RISCVMCExpr::create ( const MCExpr Expr,
VariantKind  Kind,
MCContext Ctx 
)
static

◆ evaluateAsConstant()

bool RISCVMCExpr::evaluateAsConstant ( int64_t &  Res) const

◆ evaluateAsRelocatableImpl()

bool RISCVMCExpr::evaluateAsRelocatableImpl ( MCValue Res,
const MCAssembler Asm,
const MCFixup Fixup 
) const
overridevirtual

◆ findAssociatedFragment()

MCFragment * llvm::RISCVMCExpr::findAssociatedFragment ( ) const
inlineoverridevirtual

Implements llvm::MCTargetExpr.

Definition at line 75 of file RISCVMCExpr.h.

References llvm::MCExpr::findAssociatedFragment(), and getSubExpr().

◆ fixELFSymbolsInTLSFixups()

void RISCVMCExpr::fixELFSymbolsInTLSFixups ( MCAssembler Asm) const
overridevirtual

◆ getKind()

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

Definition at line 60 of file RISCVMCExpr.h.

Referenced by evaluateAsRelocatableImpl(), fixELFSymbolsInTLSFixups(), and printImpl().

◆ getPCRelHiFixup()

const MCFixup * RISCVMCExpr::getPCRelHiFixup ( const MCFragment **  DFOut) const

Get the corresponding PC-relative HI fixup that a VK_RISCV_PCREL_LO points to, and optionally the fragment containing it.

Returns
nullptr if this isn't a VK_RISCV_PCREL_LO pointing to a known PC-relative HI fixup.

Definition at line 47 of file RISCVMCExpr.cpp.

References DF, llvm::MCExpr::evaluateAsRelocatable(), F, llvm::RISCV::fixup_riscv_got_hi20, llvm::RISCV::fixup_riscv_pcrel_hi20, llvm::RISCV::fixup_riscv_tls_gd_hi20, llvm::RISCV::fixup_riscv_tls_got_hi20, llvm::RISCV::fixup_riscv_tlsdesc_hi20, llvm::MCSymbol::getFragment(), llvm::MCSymbol::getOffset(), getSubExpr(), llvm::MCValue::getSymA(), llvm::MCSymbolRefExpr::getSymbol(), and llvm::Offset.

◆ getSubExpr()

const MCExpr * llvm::RISCVMCExpr::getSubExpr ( ) const
inline

◆ getVariantKindForName()

RISCVMCExpr::VariantKind RISCVMCExpr::getVariantKindForName ( StringRef  name)
static

◆ getVariantKindName()

StringRef RISCVMCExpr::getVariantKindName ( VariantKind  Kind)
static

◆ printImpl()

void RISCVMCExpr::printImpl ( raw_ostream OS,
const MCAsmInfo MAI 
) const
overridevirtual

◆ visitUsedExpr()

void RISCVMCExpr::visitUsedExpr ( MCStreamer Streamer) const
overridevirtual

Implements llvm::MCTargetExpr.

Definition at line 106 of file RISCVMCExpr.cpp.

References getSubExpr(), and llvm::MCStreamer::visitUsedExpr().


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