LLVM  14.0.0git
Public Member Functions | Protected Attributes | List of all members
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:
Inheritance graph
[legend]
Collaboration diagram for llvm::mca::CustomBehaviour:
Collaboration graph
[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. More...
 
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. More...
 
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. More...
 
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. More...
 

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 56 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 63 of file CustomBehaviour.h.

◆ ~CustomBehaviour()

llvm::mca::CustomBehaviour::~CustomBehaviour ( )
virtual

Definition at line 19 of file CustomBehaviour.cpp.

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 21 of file CustomBehaviour.cpp.

◆ 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 40 of file CustomBehaviour.cpp.

◆ 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 34 of file CustomBehaviour.cpp.

◆ 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 28 of file CustomBehaviour.cpp.

Member Data Documentation

◆ MCII

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

Definition at line 60 of file CustomBehaviour.h.

◆ SrcMgr

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

Definition at line 59 of file CustomBehaviour.h.

◆ STI

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

Definition at line 58 of file CustomBehaviour.h.


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