LLVM 22.0.0git
llvm::mca::CustomBehaviour Class Reference

Class which can be overriden by targets to enforce instruction dependencies and behaviours that aren't expressed well enough within the scheduling model for mca to automatically simulate them properly. More...

#include "llvm/MCA/CustomBehaviour.h"

Inheritance diagram for llvm::mca::CustomBehaviour:
[legend]

Public Member Functions

 CustomBehaviour (const MCSubtargetInfo &STI, const mca::SourceMgr &SrcMgr, const MCInstrInfo &MCII)
virtual ~CustomBehaviour ()
virtual unsigned checkCustomHazard (ArrayRef< InstRef > IssuedInst, const InstRef &IR)
 Before the llvm-mca pipeline dispatches an instruction, it first checks for any register or resource dependencies / hazards.
virtual std::vector< std::unique_ptr< View > > getStartViews (llvm::MCInstPrinter &IP, llvm::ArrayRef< llvm::MCInst > Insts)
 Return a vector of Views that will be added before all other Views.
virtual std::vector< std::unique_ptr< View > > getPostInstrInfoViews (llvm::MCInstPrinter &IP, llvm::ArrayRef< llvm::MCInst > Insts)
 Return a vector of Views that will be added after the InstructionInfoView.
virtual std::vector< std::unique_ptr< View > > getEndViews (llvm::MCInstPrinter &IP, llvm::ArrayRef< llvm::MCInst > Insts)
 Return a vector of Views that will be added after all other Views.

Protected Attributes

const MCSubtargetInfoSTI
const mca::SourceMgrSrcMgr
const MCInstrInfoMCII

Detailed Description

Class which can be overriden by targets to enforce instruction dependencies and behaviours that aren't expressed well enough within the scheduling model for mca to automatically simulate them properly.

If you implement this class for your target, make sure to also implement a target specific InstrPostProcess class as well.

Definition at line 66 of file CustomBehaviour.h.

Constructor & Destructor Documentation

◆ CustomBehaviour()

llvm::mca::CustomBehaviour::CustomBehaviour ( const MCSubtargetInfo & STI,
const mca::SourceMgr & SrcMgr,
const MCInstrInfo & MCII )
inline

Definition at line 73 of file CustomBehaviour.h.

References MCII, SrcMgr, and STI.

Referenced by llvm::mca::AMDGPUCustomBehaviour::AMDGPUCustomBehaviour().

◆ ~CustomBehaviour()

llvm::mca::CustomBehaviour::~CustomBehaviour ( )
virtualdefault

Member Function Documentation

◆ checkCustomHazard()

unsigned llvm::mca::CustomBehaviour::checkCustomHazard ( ArrayRef< InstRef > IssuedInst,
const InstRef & IR )
virtual

Before the llvm-mca pipeline dispatches an instruction, it first checks for any register or resource dependencies / hazards.

If it doesn't find any, this method will be invoked to determine if there are any custom hazards that the instruction needs to wait for. The return value of this method is the number of cycles that the instruction needs to wait for. It's safe to underestimate the number of cycles to wait for since these checks will be invoked again before the intruction gets dispatched. However, it's not safe (accurate) to overestimate the number of cycles to wait for since the instruction will wait for AT LEAST that number of cycles before attempting to be dispatched again.

Reimplemented in llvm::mca::AMDGPUCustomBehaviour.

Definition at line 22 of file CustomBehaviour.cpp.

References IR.

Referenced by ~CustomBehaviour().

◆ getEndViews()

std::vector< std::unique_ptr< View > > llvm::mca::CustomBehaviour::getEndViews ( llvm::MCInstPrinter & IP,
llvm::ArrayRef< llvm::MCInst > Insts )
virtual

Return a vector of Views that will be added after all other Views.

Definition at line 41 of file CustomBehaviour.cpp.

Referenced by ~CustomBehaviour().

◆ getPostInstrInfoViews()

std::vector< std::unique_ptr< View > > llvm::mca::CustomBehaviour::getPostInstrInfoViews ( llvm::MCInstPrinter & IP,
llvm::ArrayRef< llvm::MCInst > Insts )
virtual

Return a vector of Views that will be added after the InstructionInfoView.

Definition at line 35 of file CustomBehaviour.cpp.

Referenced by ~CustomBehaviour().

◆ getStartViews()

std::vector< std::unique_ptr< View > > llvm::mca::CustomBehaviour::getStartViews ( llvm::MCInstPrinter & IP,
llvm::ArrayRef< llvm::MCInst > Insts )
virtual

Return a vector of Views that will be added before all other Views.

Definition at line 29 of file CustomBehaviour.cpp.

Referenced by ~CustomBehaviour().

Member Data Documentation

◆ MCII

const MCInstrInfo& llvm::mca::CustomBehaviour::MCII
protected

◆ SrcMgr

const mca::SourceMgr& llvm::mca::CustomBehaviour::SrcMgr
protected

◆ STI

const MCSubtargetInfo& llvm::mca::CustomBehaviour::STI
protected

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