1 //===-- CSKYInstPrinter.h - Convert CSKY MCInst to asm syntax ---*- 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 // 9 // This class prints a CSKY MCInst to a .s file. 10 // 11 //===----------------------------------------------------------------------===// 12 13 #ifndef LLVM_LIB_TARGET_CSKY_MCTARGETDESC_CSKYINSTPRINTER_H 14 #define LLVM_LIB_TARGET_CSKY_MCTARGETDESC_CSKYINSTPRINTER_H 15 16 #include "MCTargetDesc/CSKYMCTargetDesc.h" 17 #include "llvm/MC/MCInstPrinter.h" 18 19 namespace llvm { 20 21 class CSKYInstPrinter : public MCInstPrinter { 22 public: 23 CSKYInstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII, 24 const MCRegisterInfo &MRI) 25 : MCInstPrinter(MAI, MII, MRI) {} 26 27 bool applyTargetSpecificCLOption(StringRef Opt) override; 28 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; 32 33 void printOperand(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, 34 raw_ostream &O, const char *Modifier = nullptr); 35 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); 45 46 static const char *getRegisterName(unsigned RegNo); 47 static const char *getRegisterName(unsigned RegNo, unsigned AltIdx); 48 }; 49 50 } // namespace llvm 51 52 #endif // LLVM_LIB_TARGET_CSKY_MCTARGETDESC_CSKYINSTPRINTER_H 53