1 //===-- RISCVInstPrinter.h - Convert RISCV MCInst to asm syntax ---*- C++ -*--//
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
7 //===----------------------------------------------------------------------===//
9 // This class prints a RISCV MCInst to a .s file.
11 //===----------------------------------------------------------------------===//
13 #ifndef LLVM_LIB_TARGET_RISCV_MCTARGETDESC_RISCVINSTPRINTER_H
14 #define LLVM_LIB_TARGET_RISCV_MCTARGETDESC_RISCVINSTPRINTER_H
16 #include "MCTargetDesc/RISCVMCTargetDesc.h"
17 #include "llvm/MC/MCInstPrinter.h"
22 class RISCVInstPrinter
: public MCInstPrinter
{
24 RISCVInstPrinter(const MCAsmInfo
&MAI
, const MCInstrInfo
&MII
,
25 const MCRegisterInfo
&MRI
)
26 : MCInstPrinter(MAI
, MII
, MRI
) {}
28 void printInst(const MCInst
*MI
, raw_ostream
&O
, StringRef Annot
,
29 const MCSubtargetInfo
&STI
) override
;
30 void printRegName(raw_ostream
&O
, unsigned RegNo
) const override
;
32 void printOperand(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
33 raw_ostream
&O
, const char *Modifier
= nullptr);
34 void printCSRSystemRegister(const MCInst
*MI
, unsigned OpNo
,
35 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
36 void printFenceArg(const MCInst
*MI
, unsigned OpNo
,
37 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
38 void printFRMArg(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
41 // Autogenerated by tblgen.
42 void printInstruction(const MCInst
*MI
, const MCSubtargetInfo
&STI
,
44 bool printAliasInstr(const MCInst
*MI
, const MCSubtargetInfo
&STI
,
46 void printCustomAliasOperand(const MCInst
*MI
, unsigned OpIdx
,
47 unsigned PrintMethodIdx
,
48 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
49 static const char *getRegisterName(unsigned RegNo
,
50 unsigned AltIdx
= RISCV::ABIRegAltName
);