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 { |
Bill Wendling | a5c177e | 2011-03-21 04:13:46 +0000 | [diff] [blame] | 20 | |
| 21 | class MCOperand; |
Jim Grosbach | 196b48b | 2010-09-17 21:25:10 +0000 | [diff] [blame] | 22 | |
Chris Lattner | fd60382 | 2009-10-19 19:56:26 +0000 | [diff] [blame] | 23 | class ARMInstPrinter : public MCInstPrinter { |
| 24 | public: |
Evan Cheng | b262799 | 2011-07-06 19:45:42 +0000 | [diff] [blame] | 25 | ARMInstPrinter(const MCAsmInfo &MAI) |
Matt Beaumont-Gay | e4345c9 | 2011-03-31 00:39:16 +0000 | [diff] [blame] | 26 | : MCInstPrinter(MAI) {} |
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 | 6274ec4 | 2010-10-28 21:37:33 +0000 | [diff] [blame] | 29 | virtual StringRef getOpcodeName(unsigned Opcode) const; |
Rafael Espindola | cde4ce4 | 2011-06-02 02:34:55 +0000 | [diff] [blame] | 30 | virtual void printRegName(raw_ostream &OS, unsigned RegNo) const; |
Chris Lattner | 6274ec4 | 2010-10-28 21:37:33 +0000 | [diff] [blame] | 31 | |
| 32 | static const char *getInstructionName(unsigned Opcode); |
Jim Grosbach | 196b48b | 2010-09-17 21:25:10 +0000 | [diff] [blame] | 33 | |
Chris Lattner | fd60382 | 2009-10-19 19:56:26 +0000 | [diff] [blame] | 34 | // Autogenerated by tblgen. |
Chris Lattner | 35c33bd | 2010-04-04 04:47:45 +0000 | [diff] [blame] | 35 | void printInstruction(const MCInst *MI, raw_ostream &O); |
Chris Lattner | fd60382 | 2009-10-19 19:56:26 +0000 | [diff] [blame] | 36 | static const char *getRegisterName(unsigned RegNo); |
| 37 | |
| 38 | |
Jim Grosbach | 0a2287b | 2010-11-03 01:11:15 +0000 | [diff] [blame] | 39 | void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O); |
Jim Grosbach | 196b48b | 2010-09-17 21:25:10 +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); |
Bruno Cardoso Lopes | ae08554 | 2011-03-31 23:26:08 +0000 | [diff] [blame] | 42 | |
Chris Lattner | 35c33bd | 2010-04-04 04:47:45 +0000 | [diff] [blame] | 43 | void printAddrMode2Operand(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
Bruno Cardoso Lopes | ae08554 | 2011-03-31 23:26:08 +0000 | [diff] [blame] | 44 | void printAM2PostIndexOp(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
| 45 | void printAM2PreOrOffsetIndexOp(const MCInst *MI, unsigned OpNum, |
| 46 | raw_ostream &O); |
Chris Lattner | 35c33bd | 2010-04-04 04:47:45 +0000 | [diff] [blame] | 47 | void printAddrMode2OffsetOperand(const MCInst *MI, unsigned OpNum, |
| 48 | raw_ostream &O); |
Bruno Cardoso Lopes | ac79e4c | 2011-04-04 17:18:19 +0000 | [diff] [blame] | 49 | |
Chris Lattner | 35c33bd | 2010-04-04 04:47:45 +0000 | [diff] [blame] | 50 | void printAddrMode3Operand(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
Bruno Cardoso Lopes | ac79e4c | 2011-04-04 17:18:19 +0000 | [diff] [blame] | 51 | void printAM3PostIndexOp(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
| 52 | void printAM3PreOrOffsetIndexOp(const MCInst *MI, unsigned OpNum, |
| 53 | raw_ostream &O); |
Chris Lattner | 35c33bd | 2010-04-04 04:47:45 +0000 | [diff] [blame] | 54 | void printAddrMode3OffsetOperand(const MCInst *MI, unsigned OpNum, |
| 55 | raw_ostream &O); |
Bruno Cardoso Lopes | ac79e4c | 2011-04-04 17:18:19 +0000 | [diff] [blame] | 56 | |
Jim Grosbach | 0a2287b | 2010-11-03 01:11:15 +0000 | [diff] [blame] | 57 | void printLdStmModeOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
| 58 | void printAddrMode5Operand(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
Chris Lattner | 35c33bd | 2010-04-04 04:47:45 +0000 | [diff] [blame] | 59 | void printAddrMode6Operand(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
Bruno Cardoso Lopes | 505f3cd | 2011-03-24 21:04:58 +0000 | [diff] [blame] | 60 | void printAddrMode7Operand(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
Chris Lattner | 35c33bd | 2010-04-04 04:47:45 +0000 | [diff] [blame] | 61 | void printAddrMode6OffsetOperand(const MCInst *MI, unsigned OpNum, |
| 62 | raw_ostream &O); |
Johnny Chen | dd0f3cf | 2010-03-10 18:59:38 +0000 | [diff] [blame] | 63 | |
Chris Lattner | 35c33bd | 2010-04-04 04:47:45 +0000 | [diff] [blame] | 64 | void printBitfieldInvMaskImmOperand(const MCInst *MI, unsigned OpNum, |
| 65 | raw_ostream &O); |
Johnny Chen | 1adc40c | 2010-08-12 20:46:17 +0000 | [diff] [blame] | 66 | void printMemBOption(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
Bob Wilson | 22f5dc7 | 2010-08-16 18:27:34 +0000 | [diff] [blame] | 67 | void printShiftImmOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
Jim Grosbach | dde038a | 2011-07-20 21:40:26 +0000 | [diff] [blame] | 68 | void printPKHLSLShiftImm(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
| 69 | void printPKHASRShiftImm(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
Evan Cheng | 2ef9c8a | 2009-11-19 06:57:41 +0000 | [diff] [blame] | 70 | |
Chris Lattner | 35c33bd | 2010-04-04 04:47:45 +0000 | [diff] [blame] | 71 | void printThumbS4ImmOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
| 72 | void printThumbITMask(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
| 73 | void printThumbAddrModeRROperand(const MCInst *MI, unsigned OpNum, |
| 74 | raw_ostream &O); |
Bill Wendling | f4caf69 | 2010-12-14 03:36:38 +0000 | [diff] [blame] | 75 | void printThumbAddrModeImm5SOperand(const MCInst *MI, unsigned OpNum, |
| 76 | raw_ostream &O, unsigned Scale); |
| 77 | void printThumbAddrModeImm5S1Operand(const MCInst *MI, unsigned OpNum, |
| 78 | raw_ostream &O); |
| 79 | void printThumbAddrModeImm5S2Operand(const MCInst *MI, unsigned OpNum, |
| 80 | raw_ostream &O); |
| 81 | void printThumbAddrModeImm5S4Operand(const MCInst *MI, unsigned OpNum, |
| 82 | raw_ostream &O); |
Chris Lattner | 35c33bd | 2010-04-04 04:47:45 +0000 | [diff] [blame] | 83 | void printThumbAddrModeSPOperand(const MCInst *MI, unsigned OpNum, |
| 84 | raw_ostream &O); |
Jim Grosbach | 196b48b | 2010-09-17 21:25:10 +0000 | [diff] [blame] | 85 | |
Chris Lattner | 35c33bd | 2010-04-04 04:47:45 +0000 | [diff] [blame] | 86 | void printT2SOOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
Jim Grosbach | 458f2dc | 2010-10-25 20:00:01 +0000 | [diff] [blame] | 87 | void printAddrModeImm12Operand(const MCInst *MI, unsigned OpNum, |
| 88 | raw_ostream &O); |
Chris Lattner | 35c33bd | 2010-04-04 04:47:45 +0000 | [diff] [blame] | 89 | void printT2AddrModeImm8Operand(const MCInst *MI, unsigned OpNum, |
| 90 | raw_ostream &O); |
| 91 | void printT2AddrModeImm8s4Operand(const MCInst *MI, unsigned OpNum, |
| 92 | raw_ostream &O); |
| 93 | void printT2AddrModeImm8OffsetOperand(const MCInst *MI, unsigned OpNum, |
| 94 | raw_ostream &O); |
| 95 | void printT2AddrModeImm8s4OffsetOperand(const MCInst *MI, unsigned OpNum, |
| 96 | raw_ostream &O); |
| 97 | void printT2AddrModeSoRegOperand(const MCInst *MI, unsigned OpNum, |
| 98 | raw_ostream &O); |
Jim Grosbach | 196b48b | 2010-09-17 21:25:10 +0000 | [diff] [blame] | 99 | |
Jim Grosbach | b3af5de | 2010-10-13 21:00:04 +0000 | [diff] [blame] | 100 | void printSetendOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
Bruno Cardoso Lopes | a2b6e41 | 2011-02-14 13:09:44 +0000 | [diff] [blame] | 101 | void printCPSIMod(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
| 102 | void printCPSIFlag(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
Chris Lattner | 35c33bd | 2010-04-04 04:47:45 +0000 | [diff] [blame] | 103 | void printMSRMaskOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
Chris Lattner | 35c33bd | 2010-04-04 04:47:45 +0000 | [diff] [blame] | 104 | void printPredicateOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
| 105 | void printMandatoryPredicateOperand(const MCInst *MI, unsigned OpNum, |
| 106 | raw_ostream &O); |
| 107 | void printSBitModifierOperand(const MCInst *MI, unsigned OpNum, |
| 108 | raw_ostream &O); |
| 109 | void printRegisterList(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
Chris Lattner | 35c33bd | 2010-04-04 04:47:45 +0000 | [diff] [blame] | 110 | void printNoHashImmediate(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
Owen Anderson | e4e5e2a | 2011-01-13 21:46:02 +0000 | [diff] [blame] | 111 | void printPImmediate(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
| 112 | void printCImmediate(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
Chris Lattner | 35c33bd | 2010-04-04 04:47:45 +0000 | [diff] [blame] | 113 | void printVFPf32ImmOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
| 114 | void printVFPf64ImmOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
Bob Wilson | 1a913ed | 2010-06-11 21:34:50 +0000 | [diff] [blame] | 115 | void printNEONModImmOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
Chris Lattner | 4d15222 | 2009-10-19 22:23:04 +0000 | [diff] [blame] | 116 | |
Jim Grosbach | 196b48b | 2010-09-17 21:25:10 +0000 | [diff] [blame] | 117 | void printPCLabel(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
Chris Lattner | fd60382 | 2009-10-19 19:56:26 +0000 | [diff] [blame] | 118 | }; |
Jim Grosbach | 196b48b | 2010-09-17 21:25:10 +0000 | [diff] [blame] | 119 | |
Chris Lattner | 60d5b5f | 2010-11-14 19:40:38 +0000 | [diff] [blame] | 120 | } // end namespace llvm |
Chris Lattner | fd60382 | 2009-10-19 19:56:26 +0000 | [diff] [blame] | 121 | |
| 122 | #endif |