xref: /llvm-project/llvm/lib/MCA/CustomBehaviour.cpp (revision ecf372f993fa0f1ae417a3159e5c397f36c2d48c)
1ef16c8eaSPatrick Holland //===--------------------- CustomBehaviour.cpp ------------------*- C++ -*-===//
2ef16c8eaSPatrick Holland //
3ef16c8eaSPatrick Holland // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4ef16c8eaSPatrick Holland // See https://llvm.org/LICENSE.txt for license information.
5ef16c8eaSPatrick Holland // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6ef16c8eaSPatrick Holland //
7ef16c8eaSPatrick Holland //===----------------------------------------------------------------------===//
8ef16c8eaSPatrick Holland /// \file
9ef16c8eaSPatrick Holland ///
10ef16c8eaSPatrick Holland /// This file implements methods from the CustomBehaviour interface.
11ef16c8eaSPatrick Holland ///
12ef16c8eaSPatrick Holland //===----------------------------------------------------------------------===//
13ef16c8eaSPatrick Holland 
14ef16c8eaSPatrick Holland #include "llvm/MCA/CustomBehaviour.h"
15ef16c8eaSPatrick Holland 
16ef16c8eaSPatrick Holland namespace llvm {
17ef16c8eaSPatrick Holland namespace mca {
18ef16c8eaSPatrick Holland 
193a3cb929SKazu Hirata CustomBehaviour::~CustomBehaviour() = default;
20c2955534SMin-Yih Hsu 
checkCustomHazard(ArrayRef<InstRef> IssuedInst,const InstRef & IR)21ef16c8eaSPatrick Holland unsigned CustomBehaviour::checkCustomHazard(ArrayRef<InstRef> IssuedInst,
22ef16c8eaSPatrick Holland                                             const InstRef &IR) {
23ef16c8eaSPatrick Holland   // 0 signifies that there are no hazards that need to be waited on
24ef16c8eaSPatrick Holland   return 0;
25ef16c8eaSPatrick Holland }
26ef16c8eaSPatrick Holland 
27fe01014fSPatrick Holland std::vector<std::unique_ptr<View>>
getStartViews(llvm::MCInstPrinter & IP,llvm::ArrayRef<llvm::MCInst> Insts)28fe01014fSPatrick Holland CustomBehaviour::getStartViews(llvm::MCInstPrinter &IP,
29fe01014fSPatrick Holland                                llvm::ArrayRef<llvm::MCInst> Insts) {
30fe01014fSPatrick Holland   return std::vector<std::unique_ptr<View>>();
31fe01014fSPatrick Holland }
32fe01014fSPatrick Holland 
33fe01014fSPatrick Holland std::vector<std::unique_ptr<View>>
getPostInstrInfoViews(llvm::MCInstPrinter & IP,llvm::ArrayRef<llvm::MCInst> Insts)34fe01014fSPatrick Holland CustomBehaviour::getPostInstrInfoViews(llvm::MCInstPrinter &IP,
35fe01014fSPatrick Holland                                        llvm::ArrayRef<llvm::MCInst> Insts) {
36fe01014fSPatrick Holland   return std::vector<std::unique_ptr<View>>();
37fe01014fSPatrick Holland }
38fe01014fSPatrick Holland 
39fe01014fSPatrick Holland std::vector<std::unique_ptr<View>>
getEndViews(llvm::MCInstPrinter & IP,llvm::ArrayRef<llvm::MCInst> Insts)40fe01014fSPatrick Holland CustomBehaviour::getEndViews(llvm::MCInstPrinter &IP,
41fe01014fSPatrick Holland                              llvm::ArrayRef<llvm::MCInst> Insts) {
42fe01014fSPatrick Holland   return std::vector<std::unique_ptr<View>>();
43fe01014fSPatrick Holland }
44fe01014fSPatrick Holland 
createInstrument(llvm::StringRef Desc,llvm::StringRef Data)4556674e8eSMichael Maitland UniqueInstrument InstrumentManager::createInstrument(llvm::StringRef Desc,
4698e342dcSMichael Maitland                                                      llvm::StringRef Data) {
4756674e8eSMichael Maitland   return std::make_unique<Instrument>(Desc, Data);
4898e342dcSMichael Maitland }
4998e342dcSMichael Maitland 
50*ecf372f9SMichael Maitland SmallVector<UniqueInstrument>
createInstruments(const MCInst & Inst)51*ecf372f9SMichael Maitland InstrumentManager::createInstruments(const MCInst &Inst) {
52*ecf372f9SMichael Maitland   return SmallVector<UniqueInstrument>();
53*ecf372f9SMichael Maitland }
54*ecf372f9SMichael Maitland 
getSchedClassID(const MCInstrInfo & MCII,const MCInst & MCI,const llvm::SmallVector<Instrument * > & IVec) const5598e342dcSMichael Maitland unsigned InstrumentManager::getSchedClassID(
5698e342dcSMichael Maitland     const MCInstrInfo &MCII, const MCInst &MCI,
5756674e8eSMichael Maitland     const llvm::SmallVector<Instrument *> &IVec) const {
5898e342dcSMichael Maitland   return MCII.get(MCI.getOpcode()).getSchedClass();
5998e342dcSMichael Maitland }
6098e342dcSMichael Maitland 
61ef16c8eaSPatrick Holland } // namespace mca
62ef16c8eaSPatrick Holland } // namespace llvm
63