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 | // |
| 5 | // This file was developed by the LLVM research group and is distributed under |
| 6 | // the University of Illinois Open Source License. See LICENSE.TXT for details. |
| 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 | |
| 22 | struct X86ATTAsmPrinter : public X86SharedAsmPrinter { |
| 23 | X86ATTAsmPrinter(std::ostream &O, X86TargetMachine &TM, const TargetAsmInfo *T) |
| 24 | : X86SharedAsmPrinter(O, TM, T) { } |
| 25 | |
| 26 | virtual const char *getPassName() const { |
| 27 | return "X86 AT&T-Style Assembly Printer"; |
| 28 | } |
| 29 | |
| 30 | /// printInstruction - This method is automatically generated by tablegen |
| 31 | /// from the instruction set description. This method returns true if the |
| 32 | /// machine instruction was sufficiently described to print it, otherwise it |
| 33 | /// returns false. |
| 34 | bool printInstruction(const MachineInstr *MI); |
| 35 | |
| 36 | // These methods are used by the tablegen'erated instruction printer. |
| 37 | void printOperand(const MachineInstr *MI, unsigned OpNo, |
| 38 | const char *Modifier = 0, bool NotRIPRel = false); |
| 39 | void printi8mem(const MachineInstr *MI, unsigned OpNo) { |
| 40 | printMemReference(MI, OpNo); |
| 41 | } |
| 42 | void printi16mem(const MachineInstr *MI, unsigned OpNo) { |
| 43 | printMemReference(MI, OpNo); |
| 44 | } |
| 45 | void printi32mem(const MachineInstr *MI, unsigned OpNo) { |
| 46 | printMemReference(MI, OpNo); |
| 47 | } |
| 48 | void printi64mem(const MachineInstr *MI, unsigned OpNo) { |
| 49 | printMemReference(MI, OpNo); |
| 50 | } |
| 51 | void printi128mem(const MachineInstr *MI, unsigned OpNo) { |
| 52 | printMemReference(MI, OpNo); |
| 53 | } |
| 54 | void printf32mem(const MachineInstr *MI, unsigned OpNo) { |
| 55 | printMemReference(MI, OpNo); |
| 56 | } |
| 57 | void printf64mem(const MachineInstr *MI, unsigned OpNo) { |
| 58 | printMemReference(MI, OpNo); |
| 59 | } |
| 60 | void printf128mem(const MachineInstr *MI, unsigned OpNo) { |
| 61 | printMemReference(MI, OpNo); |
| 62 | } |
| 63 | void printlea64_32mem(const MachineInstr *MI, unsigned OpNo) { |
| 64 | printMemReference(MI, OpNo, "subreg64"); |
| 65 | } |
| 66 | |
| 67 | bool printAsmMRegister(const MachineOperand &MO, const char Mode); |
| 68 | bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, |
| 69 | unsigned AsmVariant, const char *ExtraCode); |
| 70 | bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo, |
| 71 | unsigned AsmVariant, const char *ExtraCode); |
| 72 | |
| 73 | void printMachineInstruction(const MachineInstr *MI); |
| 74 | void printSSECC(const MachineInstr *MI, unsigned Op); |
| 75 | void printMemReference(const MachineInstr *MI, unsigned Op, |
| 76 | const char *Modifier=NULL); |
| 77 | void printPICLabel(const MachineInstr *MI, unsigned Op); |
| 78 | bool runOnMachineFunction(MachineFunction &F); |
| 79 | |
| 80 | /// getSectionForFunction - Return the section that we should emit the |
| 81 | /// specified function body into. |
| 82 | virtual std::string getSectionForFunction(const Function &F) const; |
| 83 | }; |
| 84 | |
| 85 | } // end namespace llvm |
| 86 | |
| 87 | #endif |