1 //===--------------------- CustomBehaviour.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 CustomBehaviour interface.
11 ///
12 //===----------------------------------------------------------------------===//
13
14 #include "llvm/MCA/CustomBehaviour.h"
15
16 namespace llvm {
17 namespace mca {
18
19 CustomBehaviour::~CustomBehaviour() = default;
20
checkCustomHazard(ArrayRef<InstRef> IssuedInst,const InstRef & IR)21 unsigned CustomBehaviour::checkCustomHazard(ArrayRef<InstRef> IssuedInst,
22 const InstRef &IR) {
23 // 0 signifies that there are no hazards that need to be waited on
24 return 0;
25 }
26
27 std::vector<std::unique_ptr<View>>
getStartViews(llvm::MCInstPrinter & IP,llvm::ArrayRef<llvm::MCInst> Insts)28 CustomBehaviour::getStartViews(llvm::MCInstPrinter &IP,
29 llvm::ArrayRef<llvm::MCInst> Insts) {
30 return std::vector<std::unique_ptr<View>>();
31 }
32
33 std::vector<std::unique_ptr<View>>
getPostInstrInfoViews(llvm::MCInstPrinter & IP,llvm::ArrayRef<llvm::MCInst> Insts)34 CustomBehaviour::getPostInstrInfoViews(llvm::MCInstPrinter &IP,
35 llvm::ArrayRef<llvm::MCInst> Insts) {
36 return std::vector<std::unique_ptr<View>>();
37 }
38
39 std::vector<std::unique_ptr<View>>
getEndViews(llvm::MCInstPrinter & IP,llvm::ArrayRef<llvm::MCInst> Insts)40 CustomBehaviour::getEndViews(llvm::MCInstPrinter &IP,
41 llvm::ArrayRef<llvm::MCInst> Insts) {
42 return std::vector<std::unique_ptr<View>>();
43 }
44
createInstrument(llvm::StringRef Desc,llvm::StringRef Data)45 UniqueInstrument InstrumentManager::createInstrument(llvm::StringRef Desc,
46 llvm::StringRef Data) {
47 return std::make_unique<Instrument>(Desc, Data);
48 }
49
50 SmallVector<UniqueInstrument>
createInstruments(const MCInst & Inst)51 InstrumentManager::createInstruments(const MCInst &Inst) {
52 return SmallVector<UniqueInstrument>();
53 }
54
getSchedClassID(const MCInstrInfo & MCII,const MCInst & MCI,const llvm::SmallVector<Instrument * > & IVec) const55 unsigned InstrumentManager::getSchedClassID(
56 const MCInstrInfo &MCII, const MCInst &MCI,
57 const llvm::SmallVector<Instrument *> &IVec) const {
58 return MCII.get(MCI.getOpcode()).getSchedClass();
59 }
60
61 } // namespace mca
62 } // namespace llvm
63