1 //===------------------- AMDGPUCustomBehaviour.h ----------------*-C++ -* -===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
10 /// This file defines the AMDGPUCustomBehaviour class which inherits from
11 /// CustomBehaviour. This class is used by the tool llvm-mca to enforce
12 /// target specific behaviour that is not expressed well enough in the
13 /// scheduling model for mca to enforce it automatically.
15 //===----------------------------------------------------------------------===//
17 #ifndef LLVM_LIB_TARGET_AMDGPU_MCA_AMDGPUCUSTOMBEHAVIOUR_H
18 #define LLVM_LIB_TARGET_AMDGPU_MCA_AMDGPUCUSTOMBEHAVIOUR_H
20 #include "llvm/ADT/SmallVector.h"
21 #include "llvm/MCA/CustomBehaviour.h"
22 #include "llvm/Support/TargetParser.h"
27 class AMDGPUInstrPostProcess
: public InstrPostProcess
{
29 AMDGPUInstrPostProcess(const MCSubtargetInfo
&STI
, const MCInstrInfo
&MCII
)
30 : InstrPostProcess(STI
, MCII
) {}
32 ~AMDGPUInstrPostProcess() {}
34 void postProcessInstruction(std::unique_ptr
<mca::Instruction
> &Inst
,
35 const MCInst
&MCI
) override
{}
38 class AMDGPUCustomBehaviour
: public CustomBehaviour
{
40 AMDGPUCustomBehaviour(const MCSubtargetInfo
&STI
,
41 const mca::SourceMgr
&SrcMgr
, const MCInstrInfo
&MCII
);
43 ~AMDGPUCustomBehaviour() {}
45 /// This method is used to determine if an instruction
46 /// should be allowed to be dispatched. The return value is
47 /// how many cycles until the instruction can be dispatched.
48 /// This method is called after MCA has already checked for
49 /// register and hardware dependencies so this method should only
50 /// implement custom behaviour and dependencies that are not picked up
52 unsigned checkCustomHazard(ArrayRef
<mca::InstRef
> IssuedInst
,
53 const mca::InstRef
&IR
) override
;