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