RISCVInstPrinter.h revision 360784
1//===-- RISCVInstPrinter.h - Convert RISCV 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 RISCV MCInst to a .s file. 10// 11//===----------------------------------------------------------------------===// 12 13#ifndef LLVM_LIB_TARGET_RISCV_MCTARGETDESC_RISCVINSTPRINTER_H 14#define LLVM_LIB_TARGET_RISCV_MCTARGETDESC_RISCVINSTPRINTER_H 15 16#include "MCTargetDesc/RISCVMCTargetDesc.h" 17#include "llvm/MC/MCInstPrinter.h" 18 19namespace llvm { 20class MCOperand; 21 22class RISCVInstPrinter : public MCInstPrinter { 23public: 24 RISCVInstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII, 25 const MCRegisterInfo &MRI) 26 : MCInstPrinter(MAI, MII, MRI) {} 27 28 bool applyTargetSpecificCLOption(StringRef Opt) override; 29 30 void printInst(const MCInst *MI, uint64_t Address, StringRef Annot, 31 const MCSubtargetInfo &STI, raw_ostream &O) override; 32 void printRegName(raw_ostream &O, unsigned RegNo) const override; 33 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, 41 raw_ostream &O); 42 void printAtomicMemOp(const MCInst *MI, unsigned OpNo, 43 const MCSubtargetInfo &STI, raw_ostream &O); 44 45 // Autogenerated by tblgen. 46 void printInstruction(const MCInst *MI, uint64_t Address, 47 const MCSubtargetInfo &STI, raw_ostream &O); 48 bool printAliasInstr(const MCInst *MI, const MCSubtargetInfo &STI, 49 raw_ostream &O); 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); 55}; 56} // namespace llvm 57 58#endif 59