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; |
Jim Grosbach | 196b48b | 2010-09-17 21:25:10 +0000 | [diff] [blame] | 21 | |
Chris Lattner | fd60382 | 2009-10-19 19:56:26 +0000 | [diff] [blame] | 22 | class ARMInstPrinter : public MCInstPrinter { |
| 23 | public: |
Jim Grosbach | 74d7e6c | 2010-09-17 21:33:25 +0000 | [diff] [blame] | 24 | ARMInstPrinter(const MCAsmInfo &MAI) : MCInstPrinter(MAI) {} |
Chris Lattner | fd60382 | 2009-10-19 19:56:26 +0000 | [diff] [blame] | 25 | |
Chris Lattner | d374087 | 2010-04-04 05:04:31 +0000 | [diff] [blame] | 26 | virtual void printInst(const MCInst *MI, raw_ostream &O); |
Jim Grosbach | 196b48b | 2010-09-17 21:25:10 +0000 | [diff] [blame] | 27 | |
Chris Lattner | fd60382 | 2009-10-19 19:56:26 +0000 | [diff] [blame] | 28 | // Autogenerated by tblgen. |
Chris Lattner | 35c33bd | 2010-04-04 04:47:45 +0000 | [diff] [blame] | 29 | void printInstruction(const MCInst *MI, raw_ostream &O); |
Chris Lattner | fd60382 | 2009-10-19 19:56:26 +0000 | [diff] [blame] | 30 | static const char *getRegisterName(unsigned RegNo); |
| 31 | |
| 32 | |
Chris Lattner | 35c33bd | 2010-04-04 04:47:45 +0000 | [diff] [blame] | 33 | void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O, |
Chris Lattner | 8bc86cb | 2009-10-19 20:59:55 +0000 | [diff] [blame] | 34 | const char *Modifier = 0); |
Jim Grosbach | 196b48b | 2010-09-17 21:25:10 +0000 | [diff] [blame] | 35 | |
Chris Lattner | 35c33bd | 2010-04-04 04:47:45 +0000 | [diff] [blame] | 36 | void printSOImmOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
| 37 | void printSOImm2PartOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
Jim Grosbach | 196b48b | 2010-09-17 21:25:10 +0000 | [diff] [blame] | 38 | |
Chris Lattner | 35c33bd | 2010-04-04 04:47:45 +0000 | [diff] [blame] | 39 | void printSORegOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
| 40 | void printAddrMode2Operand(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
| 41 | void printAddrMode2OffsetOperand(const MCInst *MI, unsigned OpNum, |
| 42 | raw_ostream &O); |
| 43 | void printAddrMode3Operand(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
| 44 | void printAddrMode3OffsetOperand(const MCInst *MI, unsigned OpNum, |
| 45 | raw_ostream &O); |
| 46 | void printAddrMode4Operand(const MCInst *MI, unsigned OpNum, raw_ostream &O, |
Chris Lattner | e306d8d | 2009-10-19 22:09:23 +0000 | [diff] [blame] | 47 | const char *Modifier = 0); |
Chris Lattner | 35c33bd | 2010-04-04 04:47:45 +0000 | [diff] [blame] | 48 | void printAddrMode5Operand(const MCInst *MI, unsigned OpNum, raw_ostream &O, |
Chris Lattner | bf16faa | 2009-10-20 06:15:28 +0000 | [diff] [blame] | 49 | const char *Modifier = 0); |
Chris Lattner | 35c33bd | 2010-04-04 04:47:45 +0000 | [diff] [blame] | 50 | void printAddrMode6Operand(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
| 51 | void printAddrMode6OffsetOperand(const MCInst *MI, unsigned OpNum, |
| 52 | raw_ostream &O); |
| 53 | void printAddrModePCOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O, |
Chris Lattner | 235e2f6 | 2009-10-20 06:22:33 +0000 | [diff] [blame] | 54 | const char *Modifier = 0); |
Johnny Chen | dd0f3cf | 2010-03-10 18:59:38 +0000 | [diff] [blame] | 55 | |
Chris Lattner | 35c33bd | 2010-04-04 04:47:45 +0000 | [diff] [blame] | 56 | void printBitfieldInvMaskImmOperand(const MCInst *MI, unsigned OpNum, |
| 57 | raw_ostream &O); |
Johnny Chen | 1adc40c | 2010-08-12 20:46:17 +0000 | [diff] [blame] | 58 | void printMemBOption(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
Bob Wilson | 22f5dc7 | 2010-08-16 18:27:34 +0000 | [diff] [blame] | 59 | void printShiftImmOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
Evan Cheng | 2ef9c8a | 2009-11-19 06:57:41 +0000 | [diff] [blame] | 60 | |
Chris Lattner | 35c33bd | 2010-04-04 04:47:45 +0000 | [diff] [blame] | 61 | void printThumbS4ImmOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
| 62 | void printThumbITMask(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
| 63 | void printThumbAddrModeRROperand(const MCInst *MI, unsigned OpNum, |
| 64 | raw_ostream &O); |
Chris Lattner | fd60382 | 2009-10-19 19:56:26 +0000 | [diff] [blame] | 65 | void printThumbAddrModeRI5Operand(const MCInst *MI, unsigned OpNum, |
Chris Lattner | 35c33bd | 2010-04-04 04:47:45 +0000 | [diff] [blame] | 66 | raw_ostream &O, unsigned Scale); |
| 67 | void printThumbAddrModeS1Operand(const MCInst *MI, unsigned OpNum, |
| 68 | raw_ostream &O); |
| 69 | void printThumbAddrModeS2Operand(const MCInst *MI, unsigned OpNum, |
| 70 | raw_ostream &O); |
| 71 | void printThumbAddrModeS4Operand(const MCInst *MI, unsigned OpNum, |
| 72 | raw_ostream &O); |
| 73 | void printThumbAddrModeSPOperand(const MCInst *MI, unsigned OpNum, |
| 74 | raw_ostream &O); |
Jim Grosbach | 196b48b | 2010-09-17 21:25:10 +0000 | [diff] [blame] | 75 | |
Chris Lattner | 35c33bd | 2010-04-04 04:47:45 +0000 | [diff] [blame] | 76 | void printT2SOOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
| 77 | void printT2AddrModeImm12Operand(const MCInst *MI, unsigned OpNum, |
| 78 | raw_ostream &O); |
| 79 | void printT2AddrModeImm8Operand(const MCInst *MI, unsigned OpNum, |
| 80 | raw_ostream &O); |
| 81 | void printT2AddrModeImm8s4Operand(const MCInst *MI, unsigned OpNum, |
| 82 | raw_ostream &O); |
| 83 | void printT2AddrModeImm8OffsetOperand(const MCInst *MI, unsigned OpNum, |
| 84 | raw_ostream &O); |
| 85 | void printT2AddrModeImm8s4OffsetOperand(const MCInst *MI, unsigned OpNum, |
| 86 | raw_ostream &O); |
| 87 | void printT2AddrModeSoRegOperand(const MCInst *MI, unsigned OpNum, |
| 88 | raw_ostream &O); |
Jim Grosbach | 196b48b | 2010-09-17 21:25:10 +0000 | [diff] [blame] | 89 | |
Jim Grosbach | b3af5de | 2010-10-13 21:00:04 +0000 | [diff] [blame^] | 90 | void printSetendOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
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); |
Jim Grosbach | 882ef2b | 2010-09-21 23:28:16 +0000 | [diff] [blame] | 102 | // The jump table instructions have custom handling in ARMAsmPrinter |
| 103 | // to output the jump table. Nothing further is necessary here. |
Chris Lattner | 35c33bd | 2010-04-04 04:47:45 +0000 | [diff] [blame] | 104 | void printJTBlockOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O) {} |
| 105 | void printJT2BlockOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O) {} |
| 106 | void printTBAddrMode(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
| 107 | void printNoHashImmediate(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
| 108 | void printVFPf32ImmOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
| 109 | void printVFPf64ImmOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
Bob Wilson | 1a913ed | 2010-06-11 21:34:50 +0000 | [diff] [blame] | 110 | void printNEONModImmOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
Chris Lattner | 4d15222 | 2009-10-19 22:23:04 +0000 | [diff] [blame] | 111 | |
Jim Grosbach | 196b48b | 2010-09-17 21:25:10 +0000 | [diff] [blame] | 112 | void printPCLabel(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
Chris Lattner | fd60382 | 2009-10-19 19:56:26 +0000 | [diff] [blame] | 113 | }; |
Jim Grosbach | 196b48b | 2010-09-17 21:25:10 +0000 | [diff] [blame] | 114 | |
Chris Lattner | fd60382 | 2009-10-19 19:56:26 +0000 | [diff] [blame] | 115 | } |
| 116 | |
| 117 | #endif |