Path: blob/main/contrib/llvm-project/llvm/lib/Target/RISCV/MCA/RISCVCustomBehaviour.h
35294 views
//===-------------------- RISCVCustomBehaviour.h -----------------*-C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7/// \file8///9/// This file defines the RISCVCustomBehaviour class which inherits from10/// CustomBehaviour. This class is used by the tool llvm-mca to enforce11/// target specific behaviour that is not expressed well enough in the12/// scheduling model for mca to enforce it automatically.13///14//===----------------------------------------------------------------------===//1516#ifndef LLVM_LIB_TARGET_RISCV_MCA_RISCVCUSTOMBEHAVIOUR_H17#define LLVM_LIB_TARGET_RISCV_MCA_RISCVCUSTOMBEHAVIOUR_H1819#include "llvm/ADT/SmallVector.h"20#include "llvm/MC/MCInst.h"21#include "llvm/MC/MCInstrDesc.h"22#include "llvm/MC/MCInstrInfo.h"23#include "llvm/MCA/CustomBehaviour.h"2425namespace llvm {26namespace mca {2728class RISCVLMULInstrument : public Instrument {29public:30static const StringRef DESC_NAME;31static bool isDataValid(StringRef Data);3233explicit RISCVLMULInstrument(StringRef Data) : Instrument(DESC_NAME, Data) {}3435~RISCVLMULInstrument() = default;3637uint8_t getLMUL() const;38};3940class RISCVSEWInstrument : public Instrument {41public:42static const StringRef DESC_NAME;43static bool isDataValid(StringRef Data);4445explicit RISCVSEWInstrument(StringRef Data) : Instrument(DESC_NAME, Data) {}4647~RISCVSEWInstrument() = default;4849uint8_t getSEW() const;50};5152class RISCVInstrumentManager : public InstrumentManager {53public:54RISCVInstrumentManager(const MCSubtargetInfo &STI, const MCInstrInfo &MCII)55: InstrumentManager(STI, MCII) {}5657bool shouldIgnoreInstruments() const override { return false; }58bool supportsInstrumentType(StringRef Type) const override;5960/// Create a Instrument for RISC-V target61UniqueInstrument createInstrument(StringRef Desc, StringRef Data) override;6263SmallVector<UniqueInstrument> createInstruments(const MCInst &Inst) override;6465/// Using the Instrument, returns a SchedClassID to use instead of66/// the SchedClassID that belongs to the MCI or the original SchedClassID.67unsigned68getSchedClassID(const MCInstrInfo &MCII, const MCInst &MCI,69const SmallVector<Instrument *> &IVec) const override;70};7172} // namespace mca73} // namespace llvm7475#endif767778