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 bool applyTargetSpecificCLOption(StringRef Opt
) override
;
30 void printInst(const MCInst
*MI
, raw_ostream
&O
, StringRef Annot
,
31 const MCSubtargetInfo
&STI
) override
;
32 void printRegName(raw_ostream
&O
, unsigned RegNo
) const override
;
34 void printOperand(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
35 raw_ostream
&O
, const char *Modifier
= nullptr);
36 void printCSRSystemRegister(const MCInst
*MI
, unsigned OpNo
,
37 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
38 void printFenceArg(const MCInst
*MI
, unsigned OpNo
,
39 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
40 void printFRMArg(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
42 void printAtomicMemOp(const MCInst
*MI
, unsigned OpNo
,
43 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
45 // Autogenerated by tblgen.
46 void printInstruction(const MCInst
*MI
, const MCSubtargetInfo
&STI
,
48 bool printAliasInstr(const MCInst
*MI
, const MCSubtargetInfo
&STI
,
50 void printCustomAliasOperand(const MCInst
*MI
, unsigned OpIdx
,
51 unsigned PrintMethodIdx
,
52 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
53 static const char *getRegisterName(unsigned RegNo
);
54 static const char *getRegisterName(unsigned RegNo
, unsigned AltIdx
);