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; |
| 22 | class TargetMachine; |
Jim Grosbach | 196b48b | 2010-09-17 21:25:10 +0000 | [diff] [blame] | 23 | |
Chris Lattner | fd60382 | 2009-10-19 19:56:26 +0000 | [diff] [blame] | 24 | class ARMInstPrinter : public MCInstPrinter { |
Bruno Cardoso Lopes | 40829ed | 2011-03-30 23:32:32 +0000 | [diff] [blame^] | 25 | private: |
| 26 | TargetMachine &TM; |
Chris Lattner | fd60382 | 2009-10-19 19:56:26 +0000 | [diff] [blame] | 27 | public: |
Bruno Cardoso Lopes | 40829ed | 2011-03-30 23:32:32 +0000 | [diff] [blame^] | 28 | ARMInstPrinter(TargetMachine &_TM, const MCAsmInfo &MAI) |
| 29 | : MCInstPrinter(MAI), TM(_TM) {} |
Chris Lattner | fd60382 | 2009-10-19 19:56:26 +0000 | [diff] [blame] | 30 | |
Chris Lattner | d374087 | 2010-04-04 05:04:31 +0000 | [diff] [blame] | 31 | virtual void printInst(const MCInst *MI, raw_ostream &O); |
Chris Lattner | 6274ec4 | 2010-10-28 21:37:33 +0000 | [diff] [blame] | 32 | virtual StringRef getOpcodeName(unsigned Opcode) const; |
Anton Korobeynikov | 57caad7 | 2011-03-05 18:43:32 +0000 | [diff] [blame] | 33 | virtual StringRef getRegName(unsigned RegNo) const; |
Chris Lattner | 6274ec4 | 2010-10-28 21:37:33 +0000 | [diff] [blame] | 34 | |
| 35 | static const char *getInstructionName(unsigned Opcode); |
Jim Grosbach | 196b48b | 2010-09-17 21:25:10 +0000 | [diff] [blame] | 36 | |
Chris Lattner | fd60382 | 2009-10-19 19:56:26 +0000 | [diff] [blame] | 37 | // Autogenerated by tblgen. |
Chris Lattner | 35c33bd | 2010-04-04 04:47:45 +0000 | [diff] [blame] | 38 | void printInstruction(const MCInst *MI, raw_ostream &O); |
Chris Lattner | fd60382 | 2009-10-19 19:56:26 +0000 | [diff] [blame] | 39 | static const char *getRegisterName(unsigned RegNo); |
| 40 | |
| 41 | |
Jim Grosbach | 0a2287b | 2010-11-03 01:11:15 +0000 | [diff] [blame] | 42 | void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O); |
Jim Grosbach | 196b48b | 2010-09-17 21:25:10 +0000 | [diff] [blame] | 43 | |
Chris Lattner | 35c33bd | 2010-04-04 04:47:45 +0000 | [diff] [blame] | 44 | void printSOImmOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
Jim Grosbach | 196b48b | 2010-09-17 21:25:10 +0000 | [diff] [blame] | 45 | |
Chris Lattner | 35c33bd | 2010-04-04 04:47:45 +0000 | [diff] [blame] | 46 | void printSORegOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
Bruno Cardoso Lopes | 40829ed | 2011-03-30 23:32:32 +0000 | [diff] [blame^] | 47 | |
Chris Lattner | 35c33bd | 2010-04-04 04:47:45 +0000 | [diff] [blame] | 48 | void printAddrMode2Operand(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
Bruno Cardoso Lopes | 40829ed | 2011-03-30 23:32:32 +0000 | [diff] [blame^] | 49 | void printAM2PostIndexOp(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
| 50 | void printAM2PreOrOffsetIndexOp(const MCInst *MI, unsigned OpNum, |
| 51 | raw_ostream &O); |
Chris Lattner | 35c33bd | 2010-04-04 04:47:45 +0000 | [diff] [blame] | 52 | void printAddrMode2OffsetOperand(const MCInst *MI, unsigned OpNum, |
| 53 | raw_ostream &O); |
| 54 | void printAddrMode3Operand(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
| 55 | void printAddrMode3OffsetOperand(const MCInst *MI, unsigned OpNum, |
| 56 | raw_ostream &O); |
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); |
Evan Cheng | 2ef9c8a | 2009-11-19 06:57:41 +0000 | [diff] [blame] | 68 | |
Chris Lattner | 35c33bd | 2010-04-04 04:47:45 +0000 | [diff] [blame] | 69 | void printThumbS4ImmOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
| 70 | void printThumbITMask(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
| 71 | void printThumbAddrModeRROperand(const MCInst *MI, unsigned OpNum, |
| 72 | raw_ostream &O); |
Bill Wendling | f4caf69 | 2010-12-14 03:36:38 +0000 | [diff] [blame] | 73 | void printThumbAddrModeImm5SOperand(const MCInst *MI, unsigned OpNum, |
| 74 | raw_ostream &O, unsigned Scale); |
| 75 | void printThumbAddrModeImm5S1Operand(const MCInst *MI, unsigned OpNum, |
| 76 | raw_ostream &O); |
| 77 | void printThumbAddrModeImm5S2Operand(const MCInst *MI, unsigned OpNum, |
| 78 | raw_ostream &O); |
| 79 | void printThumbAddrModeImm5S4Operand(const MCInst *MI, unsigned OpNum, |
| 80 | raw_ostream &O); |
Chris Lattner | 35c33bd | 2010-04-04 04:47:45 +0000 | [diff] [blame] | 81 | void printThumbAddrModeSPOperand(const MCInst *MI, unsigned OpNum, |
| 82 | raw_ostream &O); |
Jim Grosbach | 196b48b | 2010-09-17 21:25:10 +0000 | [diff] [blame] | 83 | |
Chris Lattner | 35c33bd | 2010-04-04 04:47:45 +0000 | [diff] [blame] | 84 | void printT2SOOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
Jim Grosbach | 458f2dc | 2010-10-25 20:00:01 +0000 | [diff] [blame] | 85 | void printAddrModeImm12Operand(const MCInst *MI, unsigned OpNum, |
| 86 | raw_ostream &O); |
Chris Lattner | 35c33bd | 2010-04-04 04:47:45 +0000 | [diff] [blame] | 87 | void printT2AddrModeImm8Operand(const MCInst *MI, unsigned OpNum, |
| 88 | raw_ostream &O); |
| 89 | void printT2AddrModeImm8s4Operand(const MCInst *MI, unsigned OpNum, |
| 90 | raw_ostream &O); |
| 91 | void printT2AddrModeImm8OffsetOperand(const MCInst *MI, unsigned OpNum, |
| 92 | raw_ostream &O); |
| 93 | void printT2AddrModeImm8s4OffsetOperand(const MCInst *MI, unsigned OpNum, |
| 94 | raw_ostream &O); |
| 95 | void printT2AddrModeSoRegOperand(const MCInst *MI, unsigned OpNum, |
| 96 | raw_ostream &O); |
Jim Grosbach | 196b48b | 2010-09-17 21:25:10 +0000 | [diff] [blame] | 97 | |
Jim Grosbach | b3af5de | 2010-10-13 21:00:04 +0000 | [diff] [blame] | 98 | void printSetendOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
Bruno Cardoso Lopes | a2b6e41 | 2011-02-14 13:09:44 +0000 | [diff] [blame] | 99 | void printCPSIMod(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
| 100 | void printCPSIFlag(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
Chris Lattner | 35c33bd | 2010-04-04 04:47:45 +0000 | [diff] [blame] | 101 | void printMSRMaskOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
Chris Lattner | 35c33bd | 2010-04-04 04:47:45 +0000 | [diff] [blame] | 102 | void printPredicateOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
| 103 | void printMandatoryPredicateOperand(const MCInst *MI, unsigned OpNum, |
| 104 | raw_ostream &O); |
| 105 | void printSBitModifierOperand(const MCInst *MI, unsigned OpNum, |
| 106 | raw_ostream &O); |
| 107 | void printRegisterList(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
Chris Lattner | 35c33bd | 2010-04-04 04:47:45 +0000 | [diff] [blame] | 108 | void printNoHashImmediate(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
Owen Anderson | e4e5e2a | 2011-01-13 21:46:02 +0000 | [diff] [blame] | 109 | void printPImmediate(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
| 110 | void printCImmediate(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
Chris Lattner | 35c33bd | 2010-04-04 04:47:45 +0000 | [diff] [blame] | 111 | void printVFPf32ImmOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
| 112 | void printVFPf64ImmOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
Bob Wilson | 1a913ed | 2010-06-11 21:34:50 +0000 | [diff] [blame] | 113 | void printNEONModImmOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
Chris Lattner | 4d15222 | 2009-10-19 22:23:04 +0000 | [diff] [blame] | 114 | |
Jim Grosbach | 196b48b | 2010-09-17 21:25:10 +0000 | [diff] [blame] | 115 | void printPCLabel(const MCInst *MI, unsigned OpNum, raw_ostream &O); |
Chris Lattner | fd60382 | 2009-10-19 19:56:26 +0000 | [diff] [blame] | 116 | }; |
Jim Grosbach | 196b48b | 2010-09-17 21:25:10 +0000 | [diff] [blame] | 117 | |
Chris Lattner | 60d5b5f | 2010-11-14 19:40:38 +0000 | [diff] [blame] | 118 | } // end namespace llvm |
Chris Lattner | fd60382 | 2009-10-19 19:56:26 +0000 | [diff] [blame] | 119 | |
| 120 | #endif |