Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1 | //===-- X86ATTAsmPrinter.h - Convert X86 LLVM code to AT&T assembly -------===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Chris Lattner | 081ce94 | 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. |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +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 { |
| 21 | |
Anton Korobeynikov | 5772c67 | 2007-11-14 09:18:41 +0000 | [diff] [blame] | 22 | struct MachineJumpTableInfo; |
| 23 | |
Duncan Sands | e73ef97 | 2007-10-30 13:14:37 +0000 | [diff] [blame] | 24 | struct VISIBILITY_HIDDEN X86ATTAsmPrinter : public X86SharedAsmPrinter { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 25 | X86ATTAsmPrinter(std::ostream &O, X86TargetMachine &TM, const TargetAsmInfo *T) |
| 26 | : X86SharedAsmPrinter(O, TM, T) { } |
| 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 | |
| 38 | // These methods are used by the tablegen'erated instruction printer. |
| 39 | void printOperand(const MachineInstr *MI, unsigned OpNo, |
| 40 | const char *Modifier = 0, bool NotRIPRel = false); |
| 41 | void printi8mem(const MachineInstr *MI, unsigned OpNo) { |
| 42 | printMemReference(MI, OpNo); |
| 43 | } |
| 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 | } |
| 53 | void printi128mem(const MachineInstr *MI, unsigned OpNo) { |
| 54 | printMemReference(MI, OpNo); |
| 55 | } |
| 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 | 4ab00bd | 2007-08-05 18:49:15 +0000 | [diff] [blame] | 62 | void printf80mem(const MachineInstr *MI, unsigned OpNo) { |
| 63 | printMemReference(MI, OpNo); |
| 64 | } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 65 | void printf128mem(const MachineInstr *MI, unsigned OpNo) { |
| 66 | printMemReference(MI, OpNo); |
| 67 | } |
| 68 | void printlea64_32mem(const MachineInstr *MI, unsigned OpNo) { |
| 69 | printMemReference(MI, OpNo, "subreg64"); |
| 70 | } |
| 71 | |
| 72 | bool printAsmMRegister(const MachineOperand &MO, const char Mode); |
| 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); |
| 77 | |
| 78 | void printMachineInstruction(const MachineInstr *MI); |
| 79 | void printSSECC(const MachineInstr *MI, unsigned Op); |
| 80 | void printMemReference(const MachineInstr *MI, unsigned Op, |
| 81 | const char *Modifier=NULL); |
Evan Cheng | 6fb0676 | 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 | 5772c67 | 2007-11-14 09:18:41 +0000 | [diff] [blame] | 88 | void printPICJumpTableEntry(const MachineJumpTableInfo *MJTI, |
| 89 | const MachineBasicBlock *MBB, |
| 90 | unsigned uid) const; |
| 91 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 92 | void printPICLabel(const MachineInstr *MI, unsigned Op); |
| 93 | bool runOnMachineFunction(MachineFunction &F); |
| 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; |
| 98 | }; |
| 99 | |
| 100 | } // end namespace llvm |
| 101 | |
| 102 | #endif |