LLVM 20.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
16namespace llvm {
17namespace 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
27std::vector<std::unique_ptr<View>>
30 return std::vector<std::unique_ptr<View>>();
31}
32
33std::vector<std::unique_ptr<View>>
36 return std::vector<std::unique_ptr<View>>();
37}
38
39std::vector<std::unique_ptr<View>>
42 return std::vector<std::unique_ptr<View>>();
43}
44
47 return std::make_unique<Instrument>(Desc, Data);
48}
49
53}
54
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
This file defines the base class CustomBehaviour which can be inherited from by specific targets (ex.
Legalize the Machine IR a function s Machine IR
Definition: Legalizer.cpp:80
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: ArrayRef.h:41
This is an instance of a target assembly language printer that converts an MCInst to valid target ass...
Definition: MCInstPrinter.h:46
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:185
unsigned getOpcode() const
Definition: MCInst.h:199
unsigned getSchedClass() const
Return the scheduling class for this instruction.
Definition: MCInstrDesc.h:600
Interface to description of machine instruction set.
Definition: MCInstrInfo.h:26
const MCInstrDesc & get(unsigned Opcode) const
Return the machine instruction descriptor that corresponds to the specified instruction opcode.
Definition: MCInstrInfo.h:63
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1196
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:51
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.
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 ...
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.
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.
An InstRef contains both a SourceMgr index and Instruction pair.
Definition: Instruction.h:720
virtual unsigned getSchedClassID(const MCInstrInfo &MCII, const MCInst &MCI, const SmallVector< Instrument * > &IVec) const
Given an MCInst and a vector of Instrument, a target can return a SchedClassID.
virtual UniqueInstrument createInstrument(StringRef Desc, StringRef Data)
Allocate an Instrument, and return a unique pointer to it.
virtual SmallVector< UniqueInstrument > createInstruments(const MCInst &Inst)
Return a list of unique pointers to Instruments, where each Instrument is allocated by this function.
std::unique_ptr< Instrument > UniqueInstrument
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
Description of the encoding of one expression Op.