1 //===------------------ AMDGPUCustomBehaviour.cpp ---------------*-C++ -* -===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
8 /// \file
9 ///
10 /// This file implements methods from the AMDGPUCustomBehaviour class.
11 ///
12 //===----------------------------------------------------------------------===//
13 
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"
20 
21 namespace llvm {
22 namespace mca {
23 
24 AMDGPUCustomBehaviour::AMDGPUCustomBehaviour(const MCSubtargetInfo &STI,
25                                              const mca::SourceMgr &SrcMgr,
26                                              const MCInstrInfo &MCII)
27     : CustomBehaviour(STI, SrcMgr, MCII) {}
28 
29 unsigned
30 AMDGPUCustomBehaviour::checkCustomHazard(ArrayRef<mca::InstRef> IssuedInst,
31                                          const mca::InstRef &IR) {
32   return 0;
33 }
34 
35 } // namespace mca
36 } // namespace llvm
37 
38 using namespace llvm;
39 using namespace mca;
40 
41 static CustomBehaviour *
42 createAMDGPUCustomBehaviour(const MCSubtargetInfo &STI,
43                             const mca::SourceMgr &SrcMgr,
44                             const MCInstrInfo &MCII) {
45   return new AMDGPUCustomBehaviour(STI, SrcMgr, MCII);
46 }
47 
48 static InstrPostProcess *
49 createAMDGPUInstrPostProcess(const MCSubtargetInfo &STI,
50                              const MCInstrInfo &MCII) {
51   return new AMDGPUInstrPostProcess(STI, MCII);
52 }
53 
54 /// Extern function to initialize the targets for the AMDGPU backend
55 
56 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeAMDGPUTargetMCA() {
57   TargetRegistry::RegisterCustomBehaviour(getTheAMDGPUTarget(),
58                                           createAMDGPUCustomBehaviour);
59   TargetRegistry::RegisterInstrPostProcess(getTheAMDGPUTarget(),
60                                            createAMDGPUInstrPostProcess);
61 
62   TargetRegistry::RegisterCustomBehaviour(getTheGCNTarget(),
63                                           createAMDGPUCustomBehaviour);
64   TargetRegistry::RegisterInstrPostProcess(getTheGCNTarget(),
65                                            createAMDGPUInstrPostProcess);
66 }
67