blob: de167e737ba6f43905868926e8ed84db1b75c153 [file] [log] [blame]
Dan Gohman8bc49c22007-06-25 15:11:25 +00001//===-- X86ATTAsmPrinter.h - Convert X86 LLVM code to AT&T assembly -------===//
Chris Lattnerb36cbd02005-07-01 22:44:09 +00002//
3// The LLVM Compiler Infrastructure
4//
Chris Lattner4ee451d2007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Chris Lattnerb36cbd02005-07-01 22:44:09 +00007//
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
20namespace llvm {
Chris Lattnerb36cbd02005-07-01 22:44:09 +000021
Anton Korobeynikov9de19342007-11-14 09:18:41 +000022struct MachineJumpTableInfo;
23
Duncan Sands14db5ef2007-10-30 13:14:37 +000024struct VISIBILITY_HIDDEN X86ATTAsmPrinter : public X86SharedAsmPrinter {
Jim Laskeya0f3d172006-09-07 22:06:40 +000025 X86ATTAsmPrinter(std::ostream &O, X86TargetMachine &TM, const TargetAsmInfo *T)
Jim Laskey563321a2006-09-06 18:34:40 +000026 : X86SharedAsmPrinter(O, TM, T) { }
Chris Lattnerb36cbd02005-07-01 22:44:09 +000027
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 Lattnera3b8c572006-02-06 23:41:19 +000038 // These methods are used by the tablegen'erated instruction printer.
39 void printOperand(const MachineInstr *MI, unsigned OpNo,
Evan Cheng28b514392006-12-05 19:50:18 +000040 const char *Modifier = 0, bool NotRIPRel = false);
Nate Begeman391c5d22005-11-30 18:54:35 +000041 void printi8mem(const MachineInstr *MI, unsigned OpNo) {
Chris Lattnerb36cbd02005-07-01 22:44:09 +000042 printMemReference(MI, OpNo);
43 }
Nate Begeman391c5d22005-11-30 18:54:35 +000044 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 Cheng470a6ad2006-02-22 02:26:30 +000053 void printi128mem(const MachineInstr *MI, unsigned OpNo) {
54 printMemReference(MI, OpNo);
55 }
Nate Begeman391c5d22005-11-30 18:54:35 +000056 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 Johannesen59a58732007-08-05 18:49:15 +000062 void printf80mem(const MachineInstr *MI, unsigned OpNo) {
63 printMemReference(MI, OpNo);
64 }
Evan Cheng223547a2006-01-31 22:28:30 +000065 void printf128mem(const MachineInstr *MI, unsigned OpNo) {
Nate Begeman391c5d22005-11-30 18:54:35 +000066 printMemReference(MI, OpNo);
67 }
Evan Cheng25ab6902006-09-08 06:48:29 +000068 void printlea64_32mem(const MachineInstr *MI, unsigned OpNo) {
69 printMemReference(MI, OpNo, "subreg64");
70 }
Nate Begeman391c5d22005-11-30 18:54:35 +000071
Evan Cheng55c25f22006-04-28 23:19:39 +000072 bool printAsmMRegister(const MachineOperand &MO, const char Mode);
Evan Cheng3d48a902006-04-28 21:19:05 +000073 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 Cheng62f27002006-04-28 23:11:40 +000077
78 void printMachineInstruction(const MachineInstr *MI);
Nate Begeman391c5d22005-11-30 18:54:35 +000079 void printSSECC(const MachineInstr *MI, unsigned Op);
Evan Cheng25ab6902006-09-08 06:48:29 +000080 void printMemReference(const MachineInstr *MI, unsigned Op,
81 const char *Modifier=NULL);
Evan Chengcc415862007-11-09 01:32:10 +000082 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 Korobeynikov9de19342007-11-14 09:18:41 +000088 void printPICJumpTableEntry(const MachineJumpTableInfo *MJTI,
89 const MachineBasicBlock *MBB,
90 unsigned uid) const;
91
Evan Cheng7ccced62006-02-18 00:15:05 +000092 void printPICLabel(const MachineInstr *MI, unsigned Op);
Chris Lattnerb36cbd02005-07-01 22:44:09 +000093 bool runOnMachineFunction(MachineFunction &F);
Chris Lattnerafbfded2006-10-05 02:43:52 +000094
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 Lattnerb36cbd02005-07-01 22:44:09 +000098};
99
Chris Lattnerb36cbd02005-07-01 22:44:09 +0000100} // end namespace llvm
101
102#endif