Dan Gohman | 8bc49c2 | 2007-06-25 15:11:25 +0000 | [diff] [blame] | 1 | //===-- X86ATTAsmPrinter.h - Convert X86 LLVM code to AT&T assembly -------===// |
Chris Lattner | b36cbd0 | 2005-07-01 22:44:09 +0000 | [diff] [blame] | 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Chris Lattner | 4ee451d | 2007-12-29 20:36:04 +0000 | [diff] [blame^] | 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
Chris Lattner | b36cbd0 | 2005-07-01 22:44:09 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // AT&T assembly code printer class. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #ifndef X86ATTASMPRINTER_H |
| 15 | #define X86ATTASMPRINTER_H |
| 16 | |
| 17 | #include "X86AsmPrinter.h" |
| 18 | #include "llvm/CodeGen/ValueTypes.h" |
| 19 | |
| 20 | namespace llvm { |
Chris Lattner | b36cbd0 | 2005-07-01 22:44:09 +0000 | [diff] [blame] | 21 | |
Anton Korobeynikov | 9de1934 | 2007-11-14 09:18:41 +0000 | [diff] [blame] | 22 | struct MachineJumpTableInfo; |
| 23 | |
Duncan Sands | 14db5ef | 2007-10-30 13:14:37 +0000 | [diff] [blame] | 24 | struct VISIBILITY_HIDDEN X86ATTAsmPrinter : public X86SharedAsmPrinter { |
Jim Laskey | a0f3d17 | 2006-09-07 22:06:40 +0000 | [diff] [blame] | 25 | X86ATTAsmPrinter(std::ostream &O, X86TargetMachine &TM, const TargetAsmInfo *T) |
Jim Laskey | 563321a | 2006-09-06 18:34:40 +0000 | [diff] [blame] | 26 | : X86SharedAsmPrinter(O, TM, T) { } |
Chris Lattner | b36cbd0 | 2005-07-01 22:44:09 +0000 | [diff] [blame] | 27 | |
| 28 | virtual const char *getPassName() const { |
| 29 | return "X86 AT&T-Style Assembly Printer"; |
| 30 | } |
| 31 | |
| 32 | /// printInstruction - This method is automatically generated by tablegen |
| 33 | /// from the instruction set description. This method returns true if the |
| 34 | /// machine instruction was sufficiently described to print it, otherwise it |
| 35 | /// returns false. |
| 36 | bool printInstruction(const MachineInstr *MI); |
| 37 | |
Chris Lattner | a3b8c57 | 2006-02-06 23:41:19 +0000 | [diff] [blame] | 38 | // These methods are used by the tablegen'erated instruction printer. |
| 39 | void printOperand(const MachineInstr *MI, unsigned OpNo, |
Evan Cheng | 28b51439 | 2006-12-05 19:50:18 +0000 | [diff] [blame] | 40 | const char *Modifier = 0, bool NotRIPRel = false); |
Nate Begeman | 391c5d2 | 2005-11-30 18:54:35 +0000 | [diff] [blame] | 41 | void printi8mem(const MachineInstr *MI, unsigned OpNo) { |
Chris Lattner | b36cbd0 | 2005-07-01 22:44:09 +0000 | [diff] [blame] | 42 | printMemReference(MI, OpNo); |
| 43 | } |
Nate Begeman | 391c5d2 | 2005-11-30 18:54:35 +0000 | [diff] [blame] | 44 | void printi16mem(const MachineInstr *MI, unsigned OpNo) { |
| 45 | printMemReference(MI, OpNo); |
| 46 | } |
| 47 | void printi32mem(const MachineInstr *MI, unsigned OpNo) { |
| 48 | printMemReference(MI, OpNo); |
| 49 | } |
| 50 | void printi64mem(const MachineInstr *MI, unsigned OpNo) { |
| 51 | printMemReference(MI, OpNo); |
| 52 | } |
Evan Cheng | 470a6ad | 2006-02-22 02:26:30 +0000 | [diff] [blame] | 53 | void printi128mem(const MachineInstr *MI, unsigned OpNo) { |
| 54 | printMemReference(MI, OpNo); |
| 55 | } |
Nate Begeman | 391c5d2 | 2005-11-30 18:54:35 +0000 | [diff] [blame] | 56 | void printf32mem(const MachineInstr *MI, unsigned OpNo) { |
| 57 | printMemReference(MI, OpNo); |
| 58 | } |
| 59 | void printf64mem(const MachineInstr *MI, unsigned OpNo) { |
| 60 | printMemReference(MI, OpNo); |
| 61 | } |
Dale Johannesen | 59a5873 | 2007-08-05 18:49:15 +0000 | [diff] [blame] | 62 | void printf80mem(const MachineInstr *MI, unsigned OpNo) { |
| 63 | printMemReference(MI, OpNo); |
| 64 | } |
Evan Cheng | 223547a | 2006-01-31 22:28:30 +0000 | [diff] [blame] | 65 | void printf128mem(const MachineInstr *MI, unsigned OpNo) { |
Nate Begeman | 391c5d2 | 2005-11-30 18:54:35 +0000 | [diff] [blame] | 66 | printMemReference(MI, OpNo); |
| 67 | } |
Evan Cheng | 25ab690 | 2006-09-08 06:48:29 +0000 | [diff] [blame] | 68 | void printlea64_32mem(const MachineInstr *MI, unsigned OpNo) { |
| 69 | printMemReference(MI, OpNo, "subreg64"); |
| 70 | } |
Nate Begeman | 391c5d2 | 2005-11-30 18:54:35 +0000 | [diff] [blame] | 71 | |
Evan Cheng | 55c25f2 | 2006-04-28 23:19:39 +0000 | [diff] [blame] | 72 | bool printAsmMRegister(const MachineOperand &MO, const char Mode); |
Evan Cheng | 3d48a90 | 2006-04-28 21:19:05 +0000 | [diff] [blame] | 73 | bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, |
| 74 | unsigned AsmVariant, const char *ExtraCode); |
| 75 | bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo, |
| 76 | unsigned AsmVariant, const char *ExtraCode); |
Evan Cheng | 62f2700 | 2006-04-28 23:11:40 +0000 | [diff] [blame] | 77 | |
| 78 | void printMachineInstruction(const MachineInstr *MI); |
Nate Begeman | 391c5d2 | 2005-11-30 18:54:35 +0000 | [diff] [blame] | 79 | void printSSECC(const MachineInstr *MI, unsigned Op); |
Evan Cheng | 25ab690 | 2006-09-08 06:48:29 +0000 | [diff] [blame] | 80 | void printMemReference(const MachineInstr *MI, unsigned Op, |
| 81 | const char *Modifier=NULL); |
Evan Cheng | cc41586 | 2007-11-09 01:32:10 +0000 | [diff] [blame] | 82 | void printPICJumpTableSetLabel(unsigned uid, |
| 83 | const MachineBasicBlock *MBB) const; |
| 84 | void printPICJumpTableSetLabel(unsigned uid, unsigned uid2, |
| 85 | const MachineBasicBlock *MBB) const { |
| 86 | AsmPrinter::printPICJumpTableSetLabel(uid, uid2, MBB); |
| 87 | } |
Anton Korobeynikov | 9de1934 | 2007-11-14 09:18:41 +0000 | [diff] [blame] | 88 | void printPICJumpTableEntry(const MachineJumpTableInfo *MJTI, |
| 89 | const MachineBasicBlock *MBB, |
| 90 | unsigned uid) const; |
| 91 | |
Evan Cheng | 7ccced6 | 2006-02-18 00:15:05 +0000 | [diff] [blame] | 92 | void printPICLabel(const MachineInstr *MI, unsigned Op); |
Chris Lattner | b36cbd0 | 2005-07-01 22:44:09 +0000 | [diff] [blame] | 93 | bool runOnMachineFunction(MachineFunction &F); |
Chris Lattner | afbfded | 2006-10-05 02:43:52 +0000 | [diff] [blame] | 94 | |
| 95 | /// getSectionForFunction - Return the section that we should emit the |
| 96 | /// specified function body into. |
| 97 | virtual std::string getSectionForFunction(const Function &F) const; |
Chris Lattner | b36cbd0 | 2005-07-01 22:44:09 +0000 | [diff] [blame] | 98 | }; |
| 99 | |
Chris Lattner | b36cbd0 | 2005-07-01 22:44:09 +0000 | [diff] [blame] | 100 | } // end namespace llvm |
| 101 | |
| 102 | #endif |