[clang] Document the return value of __builtin_COLUMN (#118360)
[llvm-project.git] / llvm / lib / Target / RISCV / MCA / RISCVCustomBehaviour.h
blob34efa0b2ebad5a00180ea88300f7aa5269ec5d93
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 //===----------------------------------------------------------------------===//
17 #ifndef LLVM_LIB_TARGET_RISCV_MCA_RISCVCUSTOMBEHAVIOUR_H
18 #define LLVM_LIB_TARGET_RISCV_MCA_RISCVCUSTOMBEHAVIOUR_H
20 #include "llvm/ADT/SmallVector.h"
21 #include "llvm/MC/MCInst.h"
22 #include "llvm/MC/MCInstrDesc.h"
23 #include "llvm/MC/MCInstrInfo.h"
24 #include "llvm/MCA/CustomBehaviour.h"
26 namespace llvm {
27 namespace mca {
29 class RISCVLMULInstrument : public Instrument {
30 public:
31 static const StringRef DESC_NAME;
32 static bool isDataValid(StringRef Data);
34 explicit RISCVLMULInstrument(StringRef Data) : Instrument(DESC_NAME, Data) {}
36 ~RISCVLMULInstrument() = default;
38 uint8_t getLMUL() const;
41 class RISCVSEWInstrument : public Instrument {
42 public:
43 static const StringRef DESC_NAME;
44 static bool isDataValid(StringRef Data);
46 explicit RISCVSEWInstrument(StringRef Data) : Instrument(DESC_NAME, Data) {}
48 ~RISCVSEWInstrument() = default;
50 uint8_t getSEW() const;
53 class RISCVInstrumentManager : public InstrumentManager {
54 public:
55 RISCVInstrumentManager(const MCSubtargetInfo &STI, const MCInstrInfo &MCII)
56 : InstrumentManager(STI, MCII) {}
58 bool shouldIgnoreInstruments() const override { return false; }
59 bool supportsInstrumentType(StringRef Type) const override;
61 /// Create a Instrument for RISC-V target
62 UniqueInstrument createInstrument(StringRef Desc, StringRef Data) override;
64 SmallVector<UniqueInstrument> createInstruments(const MCInst &Inst) override;
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;
73 } // namespace mca
74 } // namespace llvm
76 #endif