Chris Lattner | 60d5b5f | 2010-11-14 19:40:38 +0000 | [diff] [blame] | 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 | class MCOperand; |
| 21 | |
| 22 | class PPCInstPrinter : public MCInstPrinter { |
Chris Lattner | 0d1b7d9 | 2010-11-14 20:02:39 +0000 | [diff] [blame] | 23 | // 0 -> AIX, 1 -> Darwin. |
| 24 | unsigned SyntaxVariant; |
Chris Lattner | 60d5b5f | 2010-11-14 19:40:38 +0000 | [diff] [blame] | 25 | public: |
Chris Lattner | 0d1b7d9 | 2010-11-14 20:02:39 +0000 | [diff] [blame] | 26 | PPCInstPrinter(const MCAsmInfo &MAI, unsigned syntaxVariant) |
| 27 | : MCInstPrinter(MAI), SyntaxVariant(syntaxVariant) {} |
| 28 | |
| 29 | bool isDarwinSyntax() const { |
| 30 | return SyntaxVariant == 1; |
| 31 | } |
Chris Lattner | 60d5b5f | 2010-11-14 19:40:38 +0000 | [diff] [blame] | 32 | |
| 33 | virtual void printInst(const MCInst *MI, raw_ostream &O); |
| 34 | virtual StringRef getOpcodeName(unsigned Opcode) const; |
| 35 | |
| 36 | static const char *getInstructionName(unsigned Opcode); |
| 37 | |
| 38 | // Autogenerated by tblgen. |
| 39 | void printInstruction(const MCInst *MI, raw_ostream &O); |
| 40 | static const char *getRegisterName(unsigned RegNo); |
| 41 | |
| 42 | |
Chris Lattner | 0d1b7d9 | 2010-11-14 20:02:39 +0000 | [diff] [blame] | 43 | void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O); |
Chris Lattner | 60d5b5f | 2010-11-14 19:40:38 +0000 | [diff] [blame] | 44 | void printPredicateOperand(const MCInst *MI, unsigned OpNo, |
| 45 | raw_ostream &O, const char *Modifier) {} |
| 46 | |
| 47 | |
Chris Lattner | 9988913 | 2010-11-14 20:11:21 +0000 | [diff] [blame^] | 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 printS16X4ImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O); |
Chris Lattner | 60d5b5f | 2010-11-14 19:40:38 +0000 | [diff] [blame] | 54 | void printBranchOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O) {} |
| 55 | void printCallOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O) {} |
| 56 | void printAbsAddrOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O) {} |
| 57 | |
| 58 | void printcrbitm(const MCInst *MI, unsigned OpNo, raw_ostream &O) {} |
| 59 | |
| 60 | void printMemRegImm(const MCInst *MI, unsigned OpNo, raw_ostream &O) {} |
| 61 | void printMemRegImmShifted(const MCInst *MI, unsigned OpNo, raw_ostream &O) {} |
| 62 | void printMemRegReg(const MCInst *MI, unsigned OpNo, raw_ostream &O) {} |
| 63 | |
| 64 | // FIXME: Remove |
| 65 | void PrintSpecial(const MCInst *MI, raw_ostream &O, const char *Modifier) {} |
| 66 | void printSymbolLo(const MCInst *MI, unsigned OpNo, raw_ostream &O) {} |
| 67 | void printSymbolHi(const MCInst *MI, unsigned OpNo, raw_ostream &O) {} |
| 68 | void printPICLabel(const MCInst *MI, unsigned OpNo, raw_ostream &O) {} |
| 69 | void printTOCEntryLabel(const MCInst *MI, unsigned OpNo, raw_ostream &O) {} |
| 70 | |
| 71 | }; |
| 72 | } // end namespace llvm |
| 73 | |
| 74 | #endif |