Jia Liu | b22310f | 2012-02-18 12:03:15 +0000 | [diff] [blame] | 1 | //===- PPCInstPrinter.h - Convert PPC MCInst to assembly syntax -*- C++ -*-===// |
Chris Lattner | a76eab4 | 2010-11-14 19:40:38 +0000 | [diff] [blame] | 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 { |
Bill Wendling | 00f0cdd | 2011-03-21 04:13:46 +0000 | [diff] [blame] | 20 | |
| 21 | class MCOperand; |
Chris Lattner | a76eab4 | 2010-11-14 19:40:38 +0000 | [diff] [blame] | 22 | |
| 23 | class PPCInstPrinter : public MCInstPrinter { |
Ulrich Weigand | 266db7f | 2013-07-08 20:20:51 +0000 | [diff] [blame] | 24 | bool IsDarwin; |
Chris Lattner | a76eab4 | 2010-11-14 19:40:38 +0000 | [diff] [blame] | 25 | public: |
Craig Topper | 54bfde7 | 2012-04-02 06:09:36 +0000 | [diff] [blame] | 26 | PPCInstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII, |
Ulrich Weigand | 266db7f | 2013-07-08 20:20:51 +0000 | [diff] [blame] | 27 | const MCRegisterInfo &MRI, bool isDarwin) |
| 28 | : MCInstPrinter(MAI, MII, MRI), IsDarwin(isDarwin) {} |
Chris Lattner | 7a5c57e | 2010-11-14 20:02:39 +0000 | [diff] [blame] | 29 | |
| 30 | bool isDarwinSyntax() const { |
Ulrich Weigand | 266db7f | 2013-07-08 20:20:51 +0000 | [diff] [blame] | 31 | return IsDarwin; |
Chris Lattner | 7a5c57e | 2010-11-14 20:02:39 +0000 | [diff] [blame] | 32 | } |
Chris Lattner | a76eab4 | 2010-11-14 19:40:38 +0000 | [diff] [blame] | 33 | |
Rafael Espindola | d686052 | 2011-06-02 02:34:55 +0000 | [diff] [blame] | 34 | virtual void printRegName(raw_ostream &OS, unsigned RegNo) const; |
Owen Anderson | a0c3b97 | 2011-09-15 23:38:46 +0000 | [diff] [blame] | 35 | virtual void printInst(const MCInst *MI, raw_ostream &O, StringRef Annot); |
Chris Lattner | a76eab4 | 2010-11-14 19:40:38 +0000 | [diff] [blame] | 36 | |
Chris Lattner | a76eab4 | 2010-11-14 19:40:38 +0000 | [diff] [blame] | 37 | // Autogenerated by tblgen. |
| 38 | void printInstruction(const MCInst *MI, raw_ostream &O); |
| 39 | static const char *getRegisterName(unsigned RegNo); |
| 40 | |
| 41 | |
Chris Lattner | 7a5c57e | 2010-11-14 20:02:39 +0000 | [diff] [blame] | 42 | void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O); |
Chris Lattner | a76eab4 | 2010-11-14 19:40:38 +0000 | [diff] [blame] | 43 | void printPredicateOperand(const MCInst *MI, unsigned OpNo, |
Hal Finkel | 460e94d | 2012-06-22 23:10:08 +0000 | [diff] [blame] | 44 | raw_ostream &O, const char *Modifier = 0); |
Chris Lattner | a76eab4 | 2010-11-14 19:40:38 +0000 | [diff] [blame] | 45 | |
Hal Finkel | 27774d9 | 2014-03-13 07:58:58 +0000 | [diff] [blame^] | 46 | void printU2ImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O); |
Chris Lattner | 9488143 | 2010-11-14 20:11:21 +0000 | [diff] [blame] | 47 | void printS5ImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O); |
| 48 | void printU5ImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O); |
| 49 | void printU6ImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O); |
| 50 | void printS16ImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O); |
| 51 | void printU16ImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O); |
Chris Lattner | 3dc9bb2 | 2010-11-14 21:20:46 +0000 | [diff] [blame] | 52 | void printBranchOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O); |
Ulrich Weigand | b6a30d1 | 2013-06-24 11:03:33 +0000 | [diff] [blame] | 53 | void printAbsBranchOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O); |
Ulrich Weigand | 5143bab | 2013-07-02 21:31:04 +0000 | [diff] [blame] | 54 | void printTLSCall(const MCInst *MI, unsigned OpNo, raw_ostream &O); |
Chris Lattner | a76eab4 | 2010-11-14 19:40:38 +0000 | [diff] [blame] | 55 | |
Chris Lattner | 0dcd800 | 2010-11-14 20:22:56 +0000 | [diff] [blame] | 56 | void printcrbitm(const MCInst *MI, unsigned OpNo, raw_ostream &O); |
Chris Lattner | a76eab4 | 2010-11-14 19:40:38 +0000 | [diff] [blame] | 57 | |
Chris Lattner | 0dcd800 | 2010-11-14 20:22:56 +0000 | [diff] [blame] | 58 | void printMemRegImm(const MCInst *MI, unsigned OpNo, raw_ostream &O); |
Chris Lattner | 0dcd800 | 2010-11-14 20:22:56 +0000 | [diff] [blame] | 59 | void printMemRegReg(const MCInst *MI, unsigned OpNo, raw_ostream &O); |
Chris Lattner | a76eab4 | 2010-11-14 19:40:38 +0000 | [diff] [blame] | 60 | }; |
| 61 | } // end namespace llvm |
| 62 | |
| 63 | #endif |