1 //===------------------ AMDGPUCustomBehaviour.cpp ---------------*-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 implements methods from the AMDGPUCustomBehaviour class.
12 //===----------------------------------------------------------------------===//
14 #include "AMDGPUCustomBehaviour.h"
15 #include "MCTargetDesc/AMDGPUMCTargetDesc.h"
16 #include "SIInstrInfo.h"
17 #include "TargetInfo/AMDGPUTargetInfo.h"
18 #include "llvm/Support/TargetRegistry.h"
19 #include "llvm/Support/WithColor.h"
24 AMDGPUCustomBehaviour::AMDGPUCustomBehaviour(const MCSubtargetInfo
&STI
,
25 const mca::SourceMgr
&SrcMgr
,
26 const MCInstrInfo
&MCII
)
27 : CustomBehaviour(STI
, SrcMgr
, MCII
) {}
30 AMDGPUCustomBehaviour::checkCustomHazard(ArrayRef
<mca::InstRef
> IssuedInst
,
31 const mca::InstRef
&IR
) {
41 static CustomBehaviour
*
42 createAMDGPUCustomBehaviour(const MCSubtargetInfo
&STI
,
43 const mca::SourceMgr
&SrcMgr
,
44 const MCInstrInfo
&MCII
) {
45 return new AMDGPUCustomBehaviour(STI
, SrcMgr
, MCII
);
48 static InstrPostProcess
*
49 createAMDGPUInstrPostProcess(const MCSubtargetInfo
&STI
,
50 const MCInstrInfo
&MCII
) {
51 return new AMDGPUInstrPostProcess(STI
, MCII
);
54 /// Extern function to initialize the targets for the AMDGPU backend
56 extern "C" LLVM_EXTERNAL_VISIBILITY
void LLVMInitializeAMDGPUTargetMCA() {
57 TargetRegistry::RegisterCustomBehaviour(getTheAMDGPUTarget(),
58 createAMDGPUCustomBehaviour
);
59 TargetRegistry::RegisterInstrPostProcess(getTheAMDGPUTarget(),
60 createAMDGPUInstrPostProcess
);
62 TargetRegistry::RegisterCustomBehaviour(getTheGCNTarget(),
63 createAMDGPUCustomBehaviour
);
64 TargetRegistry::RegisterInstrPostProcess(getTheGCNTarget(),
65 createAMDGPUInstrPostProcess
);