LLVM 19.0.0git
Public Member Functions | Static Public Member Functions | List of all members
llvm::MCValue Class Reference

This represents an "assembler immediate". More...

#include "llvm/MC/MCValue.h"

Public Member Functions

 MCValue ()=default
 
int64_t getConstant () const
 
const MCSymbolRefExprgetSymA () const
 
const MCSymbolRefExprgetSymB () const
 
uint32_t getRefKind () const
 
bool isAbsolute () const
 Is this an absolute (as opposed to relocatable) value.
 
void print (raw_ostream &OS) const
 Print the value to the stream OS.
 
void dump () const
 Print the value to stderr.
 
MCSymbolRefExpr::VariantKind getAccessVariant () const
 

Static Public Member Functions

static MCValue get (const MCSymbolRefExpr *SymA, const MCSymbolRefExpr *SymB=nullptr, int64_t Val=0, uint32_t RefKind=0)
 
static MCValue get (int64_t Val)
 

Detailed Description

This represents an "assembler immediate".

In its most general form, this can hold ":Kind:(SymbolA - SymbolB + imm64)". Not all targets supports relocations of this general form, but we need to represent this anyway.

In general both SymbolA and SymbolB will also have a modifier analogous to the top-level Kind. Current targets are not expected to make use of both though. The choice comes down to whether relocation modifiers apply to the closest symbol or the whole expression.

Note that this class must remain a simple POD value class, because we need it to live in unions etc.

Definition at line 36 of file MCValue.h.

Constructor & Destructor Documentation

◆ MCValue()

llvm::MCValue::MCValue ( )
default

Member Function Documentation

◆ dump()

LLVM_DUMP_METHOD void MCValue::dump ( ) const

Print the value to stderr.

Definition at line 41 of file MCValue.cpp.

References llvm::dbgs(), and print().

◆ get() [1/2]

static MCValue llvm::MCValue::get ( const MCSymbolRefExpr SymA,
const MCSymbolRefExpr SymB = nullptr,
int64_t  Val = 0,
uint32_t  RefKind = 0 
)
inlinestatic

◆ get() [2/2]

static MCValue llvm::MCValue::get ( int64_t  Val)
inlinestatic

Definition at line 70 of file MCValue.h.

◆ getAccessVariant()

MCSymbolRefExpr::VariantKind MCValue::getAccessVariant ( ) const

Definition at line 46 of file MCValue.cpp.

References A, B, getSymA(), getSymB(), llvm_unreachable, and llvm::MCSymbolRefExpr::VK_None.

◆ getConstant()

int64_t llvm::MCValue::getConstant ( ) const
inline

◆ getRefKind()

uint32_t llvm::MCValue::getRefKind ( ) const
inline

◆ getSymA()

const MCSymbolRefExpr * llvm::MCValue::getSymA ( ) const
inline

◆ getSymB()

const MCSymbolRefExpr * llvm::MCValue::getSymB ( ) const
inline

◆ isAbsolute()

bool llvm::MCValue::isAbsolute ( ) const
inline

◆ print()

void MCValue::print ( raw_ostream OS) const

Print the value to the stream OS.

Definition at line 18 of file MCValue.cpp.

References getConstant(), getRefKind(), getSymA(), getSymB(), isAbsolute(), and OS.

Referenced by dump().


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