Chris Lattner | fd60382 | 2009-10-19 19:56:26 +0000 | [diff] [blame] | 1 | //===-- ARMInstPrinter.h - Convert ARM 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 ARM MCInst to a .s file. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #ifndef ARMINSTPRINTER_H |
| 15 | #define ARMINSTPRINTER_H |
| 16 | |
| 17 | #include "llvm/MC/MCInstPrinter.h" |
| 18 | |
| 19 | namespace llvm { |
| 20 | class MCOperand; |
| 21 | |
| 22 | class ARMInstPrinter : public MCInstPrinter { |
Chris Lattner | 61d35c2 | 2009-10-19 21:21:39 +0000 | [diff] [blame] | 23 | bool VerboseAsm; |
Chris Lattner | fd60382 | 2009-10-19 19:56:26 +0000 | [diff] [blame] | 24 | public: |
Chris Lattner | d374087 | 2010-04-04 05:04:31 +0000 | [diff] [blame] | 25 | ARMInstPrinter(const MCAsmInfo &MAI, bool verboseAsm) |
| 26 | : MCInstPrinter(MAI), VerboseAsm(verboseAsm) {} |
Chris Lattner | fd60382 | 2009-10-19 19:56:26 +0000 | [diff] [blame] | 27 | |
Chris Lattner | d374087 | 2010-04-04 05:04:31 +0000 | [diff] [blame] | 28 | virtual void printInst(const MCInst *MI, raw_ostream &O); |
Chris Lattner | fd60382 | 2009-10-19 19:56:26 +0000 | [diff] [blame] | 29 | |
| 30 | // Autogenerated by tblgen. |
Chris Lattner | 35c33bd | 2010-04-04 04:47:45 +0000 | [diff] [blame] | 31 | void printInstruction(const MCInst *MI, raw_ostream &O); |
Chris Lattner | fd60382 | 2009-10-19 19:56:26 +0000 | [diff] [blame] | 32 | static const char *getRegisterName(unsigned RegNo); |
| 33 | |
| 34 | |
Chris Lattner | 35c33bd | 2010-04-04 04:47:45 +0000 | [diff] [blame] | 35 | void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O, |
Chris Lattner | 8bc86cb | 2009-10-19 20:59:55 +0000 | [diff] [blame] | 36 | const char *Modifier = 0); |
Chris Lattner | fd60382 | 2009-10-19 19:56:26 +0000 | [diff] [blame] | 37 | |
Chris Lattner | 35c33bd | 2010-04-04 04:47:45 +0000 | [diff] [blame] | 38 | void printSOImmOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
| 39 | void printSOImm2PartOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
Chris Lattner | 61d35c2 | 2009-10-19 21:21:39 +0000 | [diff] [blame] | 40 | |
Chris Lattner | 35c33bd | 2010-04-04 04:47:45 +0000 | [diff] [blame] | 41 | void printSORegOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
| 42 | void printAddrMode2Operand(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
| 43 | void printAddrMode2OffsetOperand(const MCInst *MI, unsigned OpNum, |
| 44 | raw_ostream &O); |
| 45 | void printAddrMode3Operand(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
| 46 | void printAddrMode3OffsetOperand(const MCInst *MI, unsigned OpNum, |
| 47 | raw_ostream &O); |
| 48 | void printAddrMode4Operand(const MCInst *MI, unsigned OpNum, raw_ostream &O, |
Chris Lattner | e306d8d | 2009-10-19 22:09:23 +0000 | [diff] [blame] | 49 | const char *Modifier = 0); |
Chris Lattner | 35c33bd | 2010-04-04 04:47:45 +0000 | [diff] [blame] | 50 | void printAddrMode5Operand(const MCInst *MI, unsigned OpNum, raw_ostream &O, |
Chris Lattner | bf16faa | 2009-10-20 06:15:28 +0000 | [diff] [blame] | 51 | const char *Modifier = 0); |
Chris Lattner | 35c33bd | 2010-04-04 04:47:45 +0000 | [diff] [blame] | 52 | void printAddrMode6Operand(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
| 53 | void printAddrMode6OffsetOperand(const MCInst *MI, unsigned OpNum, |
| 54 | raw_ostream &O); |
| 55 | void printAddrModePCOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O, |
Chris Lattner | 235e2f6 | 2009-10-20 06:22:33 +0000 | [diff] [blame] | 56 | const char *Modifier = 0); |
Johnny Chen | dd0f3cf | 2010-03-10 18:59:38 +0000 | [diff] [blame] | 57 | |
Chris Lattner | 35c33bd | 2010-04-04 04:47:45 +0000 | [diff] [blame] | 58 | void printBitfieldInvMaskImmOperand(const MCInst *MI, unsigned OpNum, |
| 59 | raw_ostream &O); |
Bob Wilson | eaf1c98 | 2010-08-11 23:10:46 +0000 | [diff] [blame] | 60 | void printSatShiftOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
Evan Cheng | 2ef9c8a | 2009-11-19 06:57:41 +0000 | [diff] [blame] | 61 | |
Chris Lattner | 35c33bd | 2010-04-04 04:47:45 +0000 | [diff] [blame] | 62 | void printThumbS4ImmOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
| 63 | void printThumbITMask(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
| 64 | void printThumbAddrModeRROperand(const MCInst *MI, unsigned OpNum, |
| 65 | raw_ostream &O); |
Chris Lattner | fd60382 | 2009-10-19 19:56:26 +0000 | [diff] [blame] | 66 | void printThumbAddrModeRI5Operand(const MCInst *MI, unsigned OpNum, |
Chris Lattner | 35c33bd | 2010-04-04 04:47:45 +0000 | [diff] [blame] | 67 | raw_ostream &O, unsigned Scale); |
| 68 | void printThumbAddrModeS1Operand(const MCInst *MI, unsigned OpNum, |
| 69 | raw_ostream &O); |
| 70 | void printThumbAddrModeS2Operand(const MCInst *MI, unsigned OpNum, |
| 71 | raw_ostream &O); |
| 72 | void printThumbAddrModeS4Operand(const MCInst *MI, unsigned OpNum, |
| 73 | raw_ostream &O); |
| 74 | void printThumbAddrModeSPOperand(const MCInst *MI, unsigned OpNum, |
| 75 | raw_ostream &O); |
Chris Lattner | fd60382 | 2009-10-19 19:56:26 +0000 | [diff] [blame] | 76 | |
Chris Lattner | 35c33bd | 2010-04-04 04:47:45 +0000 | [diff] [blame] | 77 | void printT2SOOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
| 78 | void printT2AddrModeImm12Operand(const MCInst *MI, unsigned OpNum, |
| 79 | raw_ostream &O); |
| 80 | void printT2AddrModeImm8Operand(const MCInst *MI, unsigned OpNum, |
| 81 | raw_ostream &O); |
| 82 | void printT2AddrModeImm8s4Operand(const MCInst *MI, unsigned OpNum, |
| 83 | raw_ostream &O); |
| 84 | void printT2AddrModeImm8OffsetOperand(const MCInst *MI, unsigned OpNum, |
| 85 | raw_ostream &O); |
| 86 | void printT2AddrModeImm8s4OffsetOperand(const MCInst *MI, unsigned OpNum, |
| 87 | raw_ostream &O); |
| 88 | void printT2AddrModeSoRegOperand(const MCInst *MI, unsigned OpNum, |
| 89 | raw_ostream &O); |
Chris Lattner | fd60382 | 2009-10-19 19:56:26 +0000 | [diff] [blame] | 90 | |
Chris Lattner | 35c33bd | 2010-04-04 04:47:45 +0000 | [diff] [blame] | 91 | void printCPSOptionOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
| 92 | void printMSRMaskOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
| 93 | void printNegZeroOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
| 94 | void printPredicateOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
| 95 | void printMandatoryPredicateOperand(const MCInst *MI, unsigned OpNum, |
| 96 | raw_ostream &O); |
| 97 | void printSBitModifierOperand(const MCInst *MI, unsigned OpNum, |
| 98 | raw_ostream &O); |
| 99 | void printRegisterList(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
| 100 | void printCPInstOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O, |
Chris Lattner | a70e644 | 2009-10-19 22:33:05 +0000 | [diff] [blame] | 101 | const char *Modifier); |
Chris Lattner | 35c33bd | 2010-04-04 04:47:45 +0000 | [diff] [blame] | 102 | void printJTBlockOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O) {} |
| 103 | void printJT2BlockOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O) {} |
| 104 | void printTBAddrMode(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
| 105 | void printNoHashImmediate(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
| 106 | void printVFPf32ImmOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
| 107 | void printVFPf64ImmOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
Bob Wilson | 1a913ed | 2010-06-11 21:34:50 +0000 | [diff] [blame] | 108 | void printNEONModImmOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
Chris Lattner | 4d15222 | 2009-10-19 22:23:04 +0000 | [diff] [blame] | 109 | |
Chris Lattner | 35c33bd | 2010-04-04 04:47:45 +0000 | [diff] [blame] | 110 | void printPCLabel(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
Chris Lattner | 4d15222 | 2009-10-19 22:23:04 +0000 | [diff] [blame] | 111 | // FIXME: Implement. |
Chris Lattner | 35c33bd | 2010-04-04 04:47:45 +0000 | [diff] [blame] | 112 | void PrintSpecial(const MCInst *MI, raw_ostream &O, const char *Kind) {} |
Chris Lattner | fd60382 | 2009-10-19 19:56:26 +0000 | [diff] [blame] | 113 | }; |
| 114 | |
| 115 | } |
| 116 | |
| 117 | #endif |