LLVM  16.0.0git
CustomBehaviour.cpp
Go to the documentation of this file.
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 
15 
16 namespace llvm {
17 namespace mca {
18 
20 
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>>
30  return std::vector<std::unique_ptr<View>>();
31 }
32 
33 std::vector<std::unique_ptr<View>>
36  return std::vector<std::unique_ptr<View>>();
37 }
38 
39 std::vector<std::unique_ptr<View>>
42  return std::vector<std::unique_ptr<View>>();
43 }
44 
46  llvm::StringRef Data) {
47  return std::make_shared<Instrument>(Desc, Data);
48 }
49 
51  const MCInstrInfo &MCII, const MCInst &MCI,
52  const llvm::SmallVector<SharedInstrument> &IVec) const {
53  return MCII.get(MCI.getOpcode()).getSchedClass();
54 }
55 
56 } // namespace mca
57 } // namespace llvm
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1199
llvm::MCInstrDesc::getSchedClass
unsigned getSchedClass() const
Return the scheduling class for this instruction.
Definition: MCInstrDesc.h:618
llvm::mca::InstrumentManager::MCII
const MCInstrInfo & MCII
Definition: CustomBehaviour.h:144
llvm::MCInst
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:184
llvm::mca::CustomBehaviour::~CustomBehaviour
virtual ~CustomBehaviour()
llvm::Data
@ Data
Definition: SIMachineScheduler.h:55
IP
Definition: NVPTXLowerArgs.cpp:168
llvm::mca::SharedInstrument
std::shared_ptr< Instrument > SharedInstrument
Definition: CustomBehaviour.h:136
IR
Statically lint checks LLVM IR
Definition: Lint.cpp:746
CustomBehaviour.h
llvm::mca::InstrumentManager::createInstrument
virtual SharedInstrument createInstrument(StringRef Desc, StringRef Data)
Allocate an Instrument, and return a shared pointer to it.
Definition: CustomBehaviour.cpp:45
llvm::MCInstPrinter
This is an instance of a target assembly language printer that converts an MCInst to valid target ass...
Definition: MCInstPrinter.h:43
llvm::mca::InstRef
An InstRef contains both a SourceMgr index and Instruction pair.
Definition: Instruction.h:720
llvm::mca::CustomBehaviour::getStartViews
virtual std::vector< std::unique_ptr< View > > getStartViews(llvm::MCInstPrinter &IP, llvm::ArrayRef< llvm::MCInst > Insts)
Return a vector of Views that will be added before all other Views.
Definition: CustomBehaviour.cpp:28
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: APInt.h:32
llvm::mca::CustomBehaviour::checkCustomHazard
virtual unsigned checkCustomHazard(ArrayRef< InstRef > IssuedInst, const InstRef &IR)
Before the llvm-mca pipeline dispatches an instruction, it first checks for any register or resource ...
Definition: CustomBehaviour.cpp:21
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
llvm::MCInstrInfo
Interface to description of machine instruction set.
Definition: MCInstrInfo.h:26
llvm::MCInst::getOpcode
unsigned getOpcode() const
Definition: MCInst.h:198
llvm::mca::CustomBehaviour::getEndViews
virtual std::vector< std::unique_ptr< View > > getEndViews(llvm::MCInstPrinter &IP, llvm::ArrayRef< llvm::MCInst > Insts)
Return a vector of Views that will be added after all other Views.
Definition: CustomBehaviour.cpp:40
llvm::MCInstrInfo::get
const MCInstrDesc & get(unsigned Opcode) const
Return the machine instruction descriptor that corresponds to the specified instruction opcode.
Definition: MCInstrInfo.h:63
llvm::mca::InstrumentManager::getSchedClassID
virtual unsigned getSchedClassID(const MCInstrInfo &MCII, const MCInst &MCI, const SmallVector< SharedInstrument > &IVec) const
Given an MCInst and a vector of Instrument, a target can return a SchedClassID.
Definition: CustomBehaviour.cpp:50
llvm::mca::CustomBehaviour::getPostInstrInfoViews
virtual std::vector< std::unique_ptr< View > > getPostInstrInfoViews(llvm::MCInstPrinter &IP, llvm::ArrayRef< llvm::MCInst > Insts)
Return a vector of Views that will be added after the InstructionInfoView.
Definition: CustomBehaviour.cpp:34