LLVM 17.0.0git
RISCVCustomBehaviour.h
Go to the documentation of this file.
1//===-------------------- RISCVCustomBehaviour.h -----------------*-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 defines the RISCVCustomBehaviour class which inherits from
11/// CustomBehaviour. This class is used by the tool llvm-mca to enforce
12/// target specific behaviour that is not expressed well enough in the
13/// scheduling model for mca to enforce it automatically.
14///
15//===----------------------------------------------------------------------===//
16
17#ifndef LLVM_LIB_TARGET_RISCV_MCA_RISCVCUSTOMBEHAVIOUR_H
18#define LLVM_LIB_TARGET_RISCV_MCA_RISCVCUSTOMBEHAVIOUR_H
19
21#include "llvm/MC/MCInst.h"
22#include "llvm/MC/MCInstrDesc.h"
23#include "llvm/MC/MCInstrInfo.h"
25
26namespace llvm {
27namespace mca {
28
30public:
31 static const StringRef DESC_NAME;
32 static bool isDataValid(StringRef Data);
33
35
37
38 uint8_t getLMUL() const;
39};
40
42public:
45
46 bool shouldIgnoreInstruments() const override { return false; }
47 bool supportsInstrumentType(StringRef Type) const override;
48
49 /// Create a Instrument for RISCV target
51
52 /// Using the Instrument, returns a SchedClassID to use instead of
53 /// the SchedClassID that belongs to the MCI or the original SchedClassID.
54 unsigned
55 getSchedClassID(const MCInstrInfo &MCII, const MCInst &MCI,
56 const SmallVector<SharedInstrument> &IVec) const override;
57};
58
59} // namespace mca
60} // namespace llvm
61
62#endif
This file defines the base class CustomBehaviour which can be inherited from by specific targets (ex.
This file defines the SmallVector class.
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:184
Interface to description of machine instruction set.
Definition: MCInstrInfo.h:26
Generic base class for all target subtargets.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1200
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
This class allows targets to optionally customize the logic that resolves scheduling class IDs.
const MCSubtargetInfo & STI
bool supportsInstrumentType(StringRef Type) const override
SharedInstrument createInstrument(StringRef Desc, StringRef Data) override
Create a Instrument for RISCV target.
unsigned getSchedClassID(const MCInstrInfo &MCII, const MCInst &MCI, const SmallVector< SharedInstrument > &IVec) const override
Using the Instrument, returns a SchedClassID to use instead of the SchedClassID that belongs to the M...
bool shouldIgnoreInstruments() const override
Returns true if llvm-mca should ignore instruments.
RISCVInstrumentManager(const MCSubtargetInfo &STI, const MCInstrInfo &MCII)
static bool isDataValid(StringRef Data)
static const StringRef DESC_NAME
std::shared_ptr< Instrument > SharedInstrument
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18