109467b48Spatrick //===-- RISCVInstPrinter.h - Convert RISCV MCInst to asm syntax ---*- C++ -*--// 209467b48Spatrick // 309467b48Spatrick // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 409467b48Spatrick // See https://llvm.org/LICENSE.txt for license information. 509467b48Spatrick // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 609467b48Spatrick // 709467b48Spatrick //===----------------------------------------------------------------------===// 809467b48Spatrick // 909467b48Spatrick // This class prints a RISCV MCInst to a .s file. 1009467b48Spatrick // 1109467b48Spatrick //===----------------------------------------------------------------------===// 1209467b48Spatrick 1309467b48Spatrick #ifndef LLVM_LIB_TARGET_RISCV_MCTARGETDESC_RISCVINSTPRINTER_H 1409467b48Spatrick #define LLVM_LIB_TARGET_RISCV_MCTARGETDESC_RISCVINSTPRINTER_H 1509467b48Spatrick 1609467b48Spatrick #include "MCTargetDesc/RISCVMCTargetDesc.h" 1709467b48Spatrick #include "llvm/MC/MCInstPrinter.h" 1809467b48Spatrick 1909467b48Spatrick namespace llvm { 2009467b48Spatrick 2109467b48Spatrick class RISCVInstPrinter : public MCInstPrinter { 2209467b48Spatrick public: RISCVInstPrinter(const MCAsmInfo & MAI,const MCInstrInfo & MII,const MCRegisterInfo & MRI)2309467b48Spatrick RISCVInstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII, 2409467b48Spatrick const MCRegisterInfo &MRI) 2509467b48Spatrick : MCInstPrinter(MAI, MII, MRI) {} 2609467b48Spatrick 2709467b48Spatrick bool applyTargetSpecificCLOption(StringRef Opt) override; 2809467b48Spatrick 2909467b48Spatrick void printInst(const MCInst *MI, uint64_t Address, StringRef Annot, 3009467b48Spatrick const MCSubtargetInfo &STI, raw_ostream &O) override; 31*d415bd75Srobert void printRegName(raw_ostream &O, MCRegister Reg) const override; 3209467b48Spatrick 3309467b48Spatrick void printOperand(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, 3409467b48Spatrick raw_ostream &O, const char *Modifier = nullptr); 3573471bf0Spatrick void printBranchOperand(const MCInst *MI, uint64_t Address, unsigned OpNo, 3673471bf0Spatrick const MCSubtargetInfo &STI, raw_ostream &O); 3709467b48Spatrick void printCSRSystemRegister(const MCInst *MI, unsigned OpNo, 3809467b48Spatrick const MCSubtargetInfo &STI, raw_ostream &O); 3909467b48Spatrick void printFenceArg(const MCInst *MI, unsigned OpNo, 4009467b48Spatrick const MCSubtargetInfo &STI, raw_ostream &O); 4109467b48Spatrick void printFRMArg(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, 4209467b48Spatrick raw_ostream &O); 43*d415bd75Srobert void printZeroOffsetMemOp(const MCInst *MI, unsigned OpNo, 4409467b48Spatrick const MCSubtargetInfo &STI, raw_ostream &O); 45097a140dSpatrick void printVTypeI(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, 46097a140dSpatrick raw_ostream &O); 47097a140dSpatrick void printVMaskReg(const MCInst *MI, unsigned OpNo, 48097a140dSpatrick const MCSubtargetInfo &STI, raw_ostream &O); 4909467b48Spatrick 5009467b48Spatrick // Autogenerated by tblgen. 5173471bf0Spatrick std::pair<const char *, uint64_t> getMnemonic(const MCInst *MI) override; 5209467b48Spatrick void printInstruction(const MCInst *MI, uint64_t Address, 5309467b48Spatrick const MCSubtargetInfo &STI, raw_ostream &O); 54097a140dSpatrick bool printAliasInstr(const MCInst *MI, uint64_t Address, 55097a140dSpatrick const MCSubtargetInfo &STI, raw_ostream &O); 56097a140dSpatrick void printCustomAliasOperand(const MCInst *MI, uint64_t Address, 57097a140dSpatrick unsigned OpIdx, unsigned PrintMethodIdx, 5809467b48Spatrick const MCSubtargetInfo &STI, raw_ostream &O); 59*d415bd75Srobert static const char *getRegisterName(MCRegister Reg); 60*d415bd75Srobert static const char *getRegisterName(MCRegister Reg, unsigned AltIdx); 6109467b48Spatrick }; 6209467b48Spatrick } // namespace llvm 6309467b48Spatrick 6409467b48Spatrick #endif 65