xref: /freebsd-src/contrib/llvm-project/llvm/lib/MCA/CustomBehaviour.cpp (revision bdd1243df58e60e85101c09001d9812a789b6bc4)
1fe6060f1SDimitry Andric //===--------------------- CustomBehaviour.cpp ------------------*- C++ -*-===//
2fe6060f1SDimitry Andric //
3fe6060f1SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4fe6060f1SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
5fe6060f1SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6fe6060f1SDimitry Andric //
7fe6060f1SDimitry Andric //===----------------------------------------------------------------------===//
8fe6060f1SDimitry Andric /// \file
9fe6060f1SDimitry Andric ///
10fe6060f1SDimitry Andric /// This file implements methods from the CustomBehaviour interface.
11fe6060f1SDimitry Andric ///
12fe6060f1SDimitry Andric //===----------------------------------------------------------------------===//
13fe6060f1SDimitry Andric 
14fe6060f1SDimitry Andric #include "llvm/MCA/CustomBehaviour.h"
15fe6060f1SDimitry Andric 
16fe6060f1SDimitry Andric namespace llvm {
17fe6060f1SDimitry Andric namespace mca {
18fe6060f1SDimitry Andric 
1981ad6265SDimitry Andric CustomBehaviour::~CustomBehaviour() = default;
20fe6060f1SDimitry Andric 
21fe6060f1SDimitry Andric unsigned CustomBehaviour::checkCustomHazard(ArrayRef<InstRef> IssuedInst,
22fe6060f1SDimitry Andric                                             const InstRef &IR) {
23fe6060f1SDimitry Andric   // 0 signifies that there are no hazards that need to be waited on
24fe6060f1SDimitry Andric   return 0;
25fe6060f1SDimitry Andric }
26fe6060f1SDimitry Andric 
27349cc55cSDimitry Andric std::vector<std::unique_ptr<View>>
28349cc55cSDimitry Andric CustomBehaviour::getStartViews(llvm::MCInstPrinter &IP,
29349cc55cSDimitry Andric                                llvm::ArrayRef<llvm::MCInst> Insts) {
30349cc55cSDimitry Andric   return std::vector<std::unique_ptr<View>>();
31349cc55cSDimitry Andric }
32349cc55cSDimitry Andric 
33349cc55cSDimitry Andric std::vector<std::unique_ptr<View>>
34349cc55cSDimitry Andric CustomBehaviour::getPostInstrInfoViews(llvm::MCInstPrinter &IP,
35349cc55cSDimitry Andric                                        llvm::ArrayRef<llvm::MCInst> Insts) {
36349cc55cSDimitry Andric   return std::vector<std::unique_ptr<View>>();
37349cc55cSDimitry Andric }
38349cc55cSDimitry Andric 
39349cc55cSDimitry Andric std::vector<std::unique_ptr<View>>
40349cc55cSDimitry Andric CustomBehaviour::getEndViews(llvm::MCInstPrinter &IP,
41349cc55cSDimitry Andric                              llvm::ArrayRef<llvm::MCInst> Insts) {
42349cc55cSDimitry Andric   return std::vector<std::unique_ptr<View>>();
43349cc55cSDimitry Andric }
44349cc55cSDimitry Andric 
45*bdd1243dSDimitry Andric SharedInstrument InstrumentManager::createInstrument(llvm::StringRef Desc,
46*bdd1243dSDimitry Andric                                                      llvm::StringRef Data) {
47*bdd1243dSDimitry Andric   return std::make_shared<Instrument>(Desc, Data);
48*bdd1243dSDimitry Andric }
49*bdd1243dSDimitry Andric 
50*bdd1243dSDimitry Andric unsigned InstrumentManager::getSchedClassID(
51*bdd1243dSDimitry Andric     const MCInstrInfo &MCII, const MCInst &MCI,
52*bdd1243dSDimitry Andric     const llvm::SmallVector<SharedInstrument> &IVec) const {
53*bdd1243dSDimitry Andric   return MCII.get(MCI.getOpcode()).getSchedClass();
54*bdd1243dSDimitry Andric }
55*bdd1243dSDimitry Andric 
56fe6060f1SDimitry Andric } // namespace mca
57fe6060f1SDimitry Andric } // namespace llvm
58