class CustomBehaviour

Declaration

class CustomBehaviour { /* full declaration omitted */ };

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.

Declared at: llvm/include/llvm/MCA/CustomBehaviour.h:65

Member Variables

protected const llvm::MCSubtargetInfo& STI
protected const mca::SourceMgr& SrcMgr
protected const llvm::MCInstrInfo& MCII

Method Overview

  • public CustomBehaviour(const llvm::MCSubtargetInfo & STI, const mca::SourceMgr & SrcMgr, const llvm::MCInstrInfo & MCII)
  • public virtual unsigned int checkCustomHazard(ArrayRef<llvm::mca::InstRef> IssuedInst, const llvm::mca::InstRef & IR)
  • public virtual std::vector<std::unique_ptr<View>> getEndViews(llvm::MCInstPrinter & IP, llvm::ArrayRef<llvm::MCInst> Insts)
  • public virtual std::vector<std::unique_ptr<View>> getPostInstrInfoViews(llvm::MCInstPrinter & IP, llvm::ArrayRef<llvm::MCInst> Insts)
  • public virtual std::vector<std::unique_ptr<View>> getStartViews(llvm::MCInstPrinter & IP, llvm::ArrayRef<llvm::MCInst> Insts)
  • public virtual ~CustomBehaviour()

Methods

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

Declared at: llvm/include/llvm/MCA/CustomBehaviour.h:72

Parameters

const llvm::MCSubtargetInfo& STI
const mca::SourceMgr& SrcMgr
const llvm::MCInstrInfo& MCII

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

Description

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.

Declared at: llvm/include/llvm/MCA/CustomBehaviour.h:89

Parameters

ArrayRef<llvm::mca::InstRef> IssuedInst
const llvm::mca::InstRef& IR

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

Description

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

Declared at: llvm/include/llvm/MCA/CustomBehaviour.h:114

Parameters

llvm::MCInstPrinter& IP
llvm::ArrayRef<llvm::MCInst> Insts

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

Description

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

Declared at: llvm/include/llvm/MCA/CustomBehaviour.h:110

Parameters

llvm::MCInstPrinter& IP
llvm::ArrayRef<llvm::MCInst> Insts

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

Description

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

Declared at: llvm/include/llvm/MCA/CustomBehaviour.h:107

Parameters

llvm::MCInstPrinter& IP
llvm::ArrayRef<llvm::MCInst> Insts

virtual ~CustomBehaviour()

Declared at: llvm/include/llvm/MCA/CustomBehaviour.h:76