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

AMDGPU target specific MCExpr operations. More...

#include "Target/AMDGPU/MCTargetDesc/AMDGPUMCExpr.h"

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

Public Types

enum  VariantKind {
  AGVK_None , AGVK_Or , AGVK_Max , AGVK_ExtraSGPRs ,
  AGVK_TotalNumVGPRs , AGVK_AlignTo , AGVK_Occupancy
}
 
- Public Types inherited from llvm::MCExpr
enum  ExprKind : uint8_t {
  Binary , Constant , SymbolRef , Unary ,
  Target
}
 

Public Member Functions

ArrayRef< const MCExpr * > getArgs () const
 
VariantKind getKind () const
 
const MCExprgetSubExpr (size_t Index) const
 
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 &) const override
 
- 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 AMDGPUMCExprcreate (VariantKind Kind, ArrayRef< const MCExpr * > Args, MCContext &Ctx)
 
static const AMDGPUMCExprcreateOr (ArrayRef< const MCExpr * > Args, MCContext &Ctx)
 
static const AMDGPUMCExprcreateMax (ArrayRef< const MCExpr * > Args, MCContext &Ctx)
 
static const AMDGPUMCExprcreateExtraSGPRs (const MCExpr *VCCUsed, const MCExpr *FlatScrUsed, bool XNACKUsed, MCContext &Ctx)
 Allow delayed MCExpr resolve of ExtraSGPRs (in case VCCUsed or FlatScrUsed are unresolvable but needed for further MCExprs).
 
static const AMDGPUMCExprcreateTotalNumVGPR (const MCExpr *NumAGPR, const MCExpr *NumVGPR, MCContext &Ctx)
 
static const AMDGPUMCExprcreateAlignTo (const MCExpr *Value, const MCExpr *Align, MCContext &Ctx)
 
static const AMDGPUMCExprcreateOccupancy (unsigned InitOcc, const MCExpr *NumSGPRs, const MCExpr *NumVGPRs, const GCNSubtarget &STM, MCContext &Ctx)
 Mimics GCNSubtarget::computeOccupancy for MCExpr.
 
static bool classof (const MCExpr *E)
 
- 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

AMDGPU target specific MCExpr operations.

Takes in a minimum of 1 argument to be used with an operation. The supported operations are:

Note
If the 'or'/'max' operations are provided only a single argument, the operation will act as a no-op and simply resolve as the provided argument.

Definition at line 30 of file AMDGPUMCExpr.h.

Member Enumeration Documentation

◆ VariantKind

Enumerator
AGVK_None 
AGVK_Or 
AGVK_Max 
AGVK_ExtraSGPRs 
AGVK_TotalNumVGPRs 
AGVK_AlignTo 
AGVK_Occupancy 

Definition at line 32 of file AMDGPUMCExpr.h.

Member Function Documentation

◆ classof()

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

Definition at line 104 of file AMDGPUMCExpr.h.

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

◆ create()

const AMDGPUMCExpr * AMDGPUMCExpr::create ( VariantKind  Kind,
ArrayRef< const MCExpr * >  Args,
MCContext Ctx 
)
static

◆ createAlignTo()

static const AMDGPUMCExpr * llvm::AMDGPUMCExpr::createAlignTo ( const MCExpr Value,
const MCExpr Align,
MCContext Ctx 
)
inlinestatic

Definition at line 83 of file AMDGPUMCExpr.h.

References AGVK_AlignTo, and create().

◆ createExtraSGPRs()

const AMDGPUMCExpr * AMDGPUMCExpr::createExtraSGPRs ( const MCExpr VCCUsed,
const MCExpr FlatScrUsed,
bool  XNACKUsed,
MCContext Ctx 
)
static

Allow delayed MCExpr resolve of ExtraSGPRs (in case VCCUsed or FlatScrUsed are unresolvable but needed for further MCExprs).

Derived from implementation of IsaInfo::getNumExtraSGPRs in AMDGPUBaseInfo.cpp.

Definition at line 267 of file AMDGPUMCExpr.cpp.

References AGVK_ExtraSGPRs, llvm::MCConstantExpr::create(), and create().

Referenced by llvm::AMDGPUAsmPrinter::emitFunctionBodyEnd().

◆ createMax()

static const AMDGPUMCExpr * llvm::AMDGPUMCExpr::createMax ( ArrayRef< const MCExpr * >  Args,
MCContext Ctx 
)
inlinestatic

Definition at line 69 of file AMDGPUMCExpr.h.

References AGVK_Max, and create().

◆ createOccupancy()

const AMDGPUMCExpr * AMDGPUMCExpr::createOccupancy ( unsigned  InitOcc,
const MCExpr NumSGPRs,
const MCExpr NumVGPRs,
const GCNSubtarget STM,
MCContext Ctx 
)
static

Mimics GCNSubtarget::computeOccupancy for MCExpr.

Remove dependency on GCNSubtarget and depend only only the necessary values for said occupancy computation. Should match computeOccupancy implementation without passing STM on.

Definition at line 288 of file AMDGPUMCExpr.cpp.

References AGVK_Occupancy, llvm::MCConstantExpr::create(), create(), llvm::GCNSubtarget::getGeneration(), llvm::AMDGPU::IsaInfo::getMaxWavesPerEU(), llvm::AMDGPU::IsaInfo::getTotalNumVGPRs(), and llvm::AMDGPU::IsaInfo::getVGPRAllocGranule().

◆ createOr()

static const AMDGPUMCExpr * llvm::AMDGPUMCExpr::createOr ( ArrayRef< const MCExpr * >  Args,
MCContext Ctx 
)
inlinestatic

Definition at line 64 of file AMDGPUMCExpr.h.

References AGVK_Or, and create().

◆ createTotalNumVGPR()

const AMDGPUMCExpr * AMDGPUMCExpr::createTotalNumVGPR ( const MCExpr NumAGPR,
const MCExpr NumVGPR,
MCContext Ctx 
)
static

Definition at line 277 of file AMDGPUMCExpr.cpp.

References AGVK_TotalNumVGPRs, and create().

◆ evaluateAsRelocatableImpl()

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

◆ findAssociatedFragment()

MCFragment * AMDGPUMCExpr::findAssociatedFragment ( ) const
overridevirtual

Implements llvm::MCTargetExpr.

Definition at line 255 of file AMDGPUMCExpr.cpp.

References llvm::MCExpr::findAssociatedFragment().

◆ fixELFSymbolsInTLSFixups()

void llvm::AMDGPUMCExpr::fixELFSymbolsInTLSFixups ( MCAssembler ) const
inlineoverridevirtual

Implements llvm::MCTargetExpr.

Definition at line 102 of file AMDGPUMCExpr.h.

◆ getArgs()

ArrayRef< const MCExpr * > llvm::AMDGPUMCExpr::getArgs ( ) const
inline

Definition at line 93 of file AMDGPUMCExpr.h.

Referenced by targetOpKnownBitsMapHelper(), and tryFoldHelper().

◆ getKind()

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

Definition at line 94 of file AMDGPUMCExpr.h.

Referenced by targetOpKnownBitsMapHelper(), and tryFoldHelper().

◆ getSubExpr()

const MCExpr * AMDGPUMCExpr::getSubExpr ( size_t  Index) const

Definition at line 52 of file AMDGPUMCExpr.cpp.

References assert().

Referenced by targetOpKnownBitsMapHelper().

◆ printImpl()

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

◆ visitUsedExpr()

void AMDGPUMCExpr::visitUsedExpr ( MCStreamer Streamer) const
overridevirtual

Implements llvm::MCTargetExpr.

Definition at line 250 of file AMDGPUMCExpr.cpp.

References llvm::MCStreamer::visitUsedExpr().


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