1 //===-- PPCInstPrinter.h - Convert PPC MCInst to assembly syntax ----------===// 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 PPCINSTPRINTER_H 15 #define PPCINSTPRINTER_H 16 17 #include "llvm/MC/MCInstPrinter.h" 18 19 namespace llvm { 20 21 class MCOperand; 22 23 class PPCInstPrinter : public MCInstPrinter { 24 // 0 -> AIX, 1 -> Darwin. 25 unsigned SyntaxVariant; 26 public: PPCInstPrinter(const MCAsmInfo & MAI,unsigned syntaxVariant)27 PPCInstPrinter(const MCAsmInfo &MAI, unsigned syntaxVariant) 28 : MCInstPrinter(MAI), SyntaxVariant(syntaxVariant) {} 29 isDarwinSyntax()30 bool isDarwinSyntax() const { 31 return SyntaxVariant == 1; 32 } 33 34 virtual void printRegName(raw_ostream &OS, unsigned RegNo) const; 35 virtual void printInst(const MCInst *MI, raw_ostream &O); 36 virtual StringRef getOpcodeName(unsigned Opcode) const; 37 38 static const char *getInstructionName(unsigned Opcode); 39 40 // Autogenerated by tblgen. 41 void printInstruction(const MCInst *MI, raw_ostream &O); 42 static const char *getRegisterName(unsigned RegNo); 43 44 45 void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O); 46 void printPredicateOperand(const MCInst *MI, unsigned OpNo, 47 raw_ostream &O, const char *Modifier); 48 49 50 void printS5ImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O); 51 void printU5ImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O); 52 void printU6ImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O); 53 void printS16ImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O); 54 void printU16ImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O); 55 void printS16X4ImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O); 56 void printBranchOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O); 57 void printAbsAddrOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O); 58 59 void printcrbitm(const MCInst *MI, unsigned OpNo, raw_ostream &O); 60 61 void printMemRegImm(const MCInst *MI, unsigned OpNo, raw_ostream &O); 62 void printMemRegImmShifted(const MCInst *MI, unsigned OpNo, raw_ostream &O); 63 void printMemRegReg(const MCInst *MI, unsigned OpNo, raw_ostream &O); 64 65 // FIXME: Remove 66 void printSymbolLo(const MCInst *MI, unsigned OpNo, raw_ostream &O); 67 void printSymbolHi(const MCInst *MI, unsigned OpNo, raw_ostream &O); 68 }; 69 } // end namespace llvm 70 71 #endif 72