1 //===- PPCInstPrinter.h - Convert PPC MCInst to assembly syntax -*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 // 10 // This class prints an PPC MCInst to a .s file. 11 // 12 //===----------------------------------------------------------------------===// 13 14 #ifndef LLVM_LIB_TARGET_POWERPC_INSTPRINTER_PPCINSTPRINTER_H 15 #define LLVM_LIB_TARGET_POWERPC_INSTPRINTER_PPCINSTPRINTER_H 16 17 #include "llvm/MC/MCInstPrinter.h" 18 19 namespace llvm { 20 21 class MCOperand; 22 23 class PPCInstPrinter : public MCInstPrinter { 24 bool IsDarwin; 25 public: PPCInstPrinter(const MCAsmInfo & MAI,const MCInstrInfo & MII,const MCRegisterInfo & MRI,bool isDarwin)26 PPCInstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII, 27 const MCRegisterInfo &MRI, bool isDarwin) 28 : MCInstPrinter(MAI, MII, MRI), IsDarwin(isDarwin) {} 29 isDarwinSyntax()30 bool isDarwinSyntax() const { 31 return IsDarwin; 32 } 33 34 void printRegName(raw_ostream &OS, unsigned RegNo) const override; 35 void printInst(const MCInst *MI, raw_ostream &O, StringRef Annot) override; 36 37 // Autogenerated by tblgen. 38 void printInstruction(const MCInst *MI, raw_ostream &O); 39 static const char *getRegisterName(unsigned RegNo); 40 41 42 void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O); 43 void printPredicateOperand(const MCInst *MI, unsigned OpNo, 44 raw_ostream &O, const char *Modifier = nullptr); 45 46 void printU2ImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O); 47 void printU4ImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O); 48 void printS5ImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O); 49 void printU5ImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O); 50 void printU6ImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O); 51 void printS16ImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O); 52 void printU16ImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O); 53 void printBranchOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O); 54 void printAbsBranchOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O); 55 void printTLSCall(const MCInst *MI, unsigned OpNo, raw_ostream &O); 56 57 void printcrbitm(const MCInst *MI, unsigned OpNo, raw_ostream &O); 58 59 void printMemRegImm(const MCInst *MI, unsigned OpNo, raw_ostream &O); 60 void printMemRegReg(const MCInst *MI, unsigned OpNo, raw_ostream &O); 61 }; 62 } // end namespace llvm 63 64 #endif 65