1 //===-- SparcInstPrinter.h - Convert Sparc MCInst to assembly syntax ------===// 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 an Sparc MCInst to a .s file. 10 // 11 //===----------------------------------------------------------------------===// 12 13 #ifndef LLVM_LIB_TARGET_SPARC_MCTARGETDESC_SPARCINSTPRINTER_H 14 #define LLVM_LIB_TARGET_SPARC_MCTARGETDESC_SPARCINSTPRINTER_H 15 16 #include "SparcMCTargetDesc.h" 17 #include "llvm/MC/MCInstPrinter.h" 18 19 namespace llvm { 20 21 class SparcInstPrinter : public MCInstPrinter { 22 public: SparcInstPrinter(const MCAsmInfo & MAI,const MCInstrInfo & MII,const MCRegisterInfo & MRI)23 SparcInstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII, 24 const MCRegisterInfo &MRI) 25 : MCInstPrinter(MAI, MII, MRI) {} 26 27 void printRegName(raw_ostream &OS, MCRegister Reg) const override; 28 void printRegName(raw_ostream &OS, MCRegister Reg, unsigned AltIdx) const; 29 void printInst(const MCInst *MI, uint64_t Address, StringRef Annot, 30 const MCSubtargetInfo &STI, raw_ostream &O) override; 31 bool printSparcAliasInstr(const MCInst *MI, const MCSubtargetInfo &STI, 32 raw_ostream &OS); 33 bool isV9(const MCSubtargetInfo &STI) const; 34 35 // Autogenerated by tblgen. 36 std::pair<const char *, uint64_t> getMnemonic(const MCInst *MI) override; 37 void printInstruction(const MCInst *MI, uint64_t Address, 38 const MCSubtargetInfo &STI, raw_ostream &O); 39 bool printAliasInstr(const MCInst *MI, uint64_t Address, 40 const MCSubtargetInfo &STI, raw_ostream &O); 41 void printCustomAliasOperand(const MCInst *MI, uint64_t Address, 42 unsigned OpIdx, unsigned PrintMethodIdx, 43 const MCSubtargetInfo &STI, raw_ostream &O); 44 static const char *getRegisterName(MCRegister Reg, 45 unsigned AltIdx = SP::NoRegAltName); 46 47 void printOperand(const MCInst *MI, int opNum, const MCSubtargetInfo &STI, 48 raw_ostream &OS); 49 void printMemOperand(const MCInst *MI, int opNum, const MCSubtargetInfo &STI, 50 raw_ostream &OS); 51 void printCCOperand(const MCInst *MI, int opNum, const MCSubtargetInfo &STI, 52 raw_ostream &OS); 53 bool printGetPCX(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, 54 raw_ostream &OS); 55 void printMembarTag(const MCInst *MI, int opNum, const MCSubtargetInfo &STI, 56 raw_ostream &O); 57 void printASITag(const MCInst *MI, int opNum, const MCSubtargetInfo &STI, 58 raw_ostream &O); 59 void printPrefetchTag(const MCInst *MI, int opNum, const MCSubtargetInfo &STI, 60 raw_ostream &O); 61 }; 62 } // end namespace llvm 63 64 #endif 65