1 //===-- CSKYInstPrinter.h - Convert CSKY 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 CSKY MCInst to a .s file.
11 //===----------------------------------------------------------------------===//
13 #ifndef LLVM_LIB_TARGET_CSKY_MCTARGETDESC_CSKYINSTPRINTER_H
14 #define LLVM_LIB_TARGET_CSKY_MCTARGETDESC_CSKYINSTPRINTER_H
16 #include "MCTargetDesc/CSKYMCTargetDesc.h"
17 #include "llvm/MC/MCInstPrinter.h"
21 class CSKYInstPrinter
: public MCInstPrinter
{
23 CSKYInstPrinter(const MCAsmInfo
&MAI
, const MCInstrInfo
&MII
,
24 const MCRegisterInfo
&MRI
)
25 : MCInstPrinter(MAI
, MII
, MRI
) {}
27 bool applyTargetSpecificCLOption(StringRef Opt
) override
;
29 void printInst(const MCInst
*MI
, uint64_t Address
, StringRef Annot
,
30 const MCSubtargetInfo
&STI
, raw_ostream
&O
) override
;
31 void printRegName(raw_ostream
&O
, unsigned RegNo
) const override
;
33 void printOperand(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
34 raw_ostream
&O
, const char *Modifier
= nullptr);
36 // Autogenerated by tblgen.
37 std::pair
<const char *, uint64_t> getMnemonic(const MCInst
*MI
) override
;
38 void printInstruction(const MCInst
*MI
, uint64_t Address
,
39 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
40 bool printAliasInstr(const MCInst
*MI
, uint64_t Address
,
41 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
42 void printCustomAliasOperand(const MCInst
*MI
, uint64_t Address
,
43 unsigned OpIdx
, unsigned PrintMethodIdx
,
44 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
46 static const char *getRegisterName(unsigned RegNo
);
47 static const char *getRegisterName(unsigned RegNo
, unsigned AltIdx
);
52 #endif // LLVM_LIB_TARGET_CSKY_MCTARGETDESC_CSKYINSTPRINTER_H