LLVM 19.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:
43 static const StringRef DESC_NAME;
44 static bool isDataValid(StringRef Data);
45
47
49
50 uint8_t getSEW() const;
51};
52
54public:
57
58 bool shouldIgnoreInstruments() const override { return false; }
59 bool supportsInstrumentType(StringRef Type) const override;
60
61 /// Create a Instrument for RISC-V target
63
65
66 /// Using the Instrument, returns a SchedClassID to use instead of
67 /// the SchedClassID that belongs to the MCI or the original SchedClassID.
68 unsigned
69 getSchedClassID(const MCInstrInfo &MCII, const MCInst &MCI,
70 const SmallVector<Instrument *> &IVec) const override;
71};
72
73} // namespace mca
74} // namespace llvm
75
76#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:1209
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
unsigned getSchedClassID(const MCInstrInfo &MCII, const MCInst &MCI, const SmallVector< Instrument * > &IVec) const override
Using the Instrument, returns a SchedClassID to use instead of the SchedClassID that belongs to the M...
UniqueInstrument createInstrument(StringRef Desc, StringRef Data) override
Create a Instrument for RISC-V target.
SmallVector< UniqueInstrument > createInstruments(const MCInst &Inst) override
Return a list of unique pointers to Instruments, where each Instrument is allocated by this function.
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
static bool isDataValid(StringRef Data)
static const StringRef DESC_NAME
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.