blob: f8dca7232d91b2478608251e6b68ab3e3d3dd46e [file] [log] [blame]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001//===-- 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
20namespace llvm {
21
22struct 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 }
Dale Johannesen4ab00bd2007-08-05 18:49:15 +000060 void printf80mem(const MachineInstr *MI, unsigned OpNo) {
61 printMemReference(MI, OpNo);
62 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +000063 void printf128mem(const MachineInstr *MI, unsigned OpNo) {
64 printMemReference(MI, OpNo);
65 }
66 void printlea64_32mem(const MachineInstr *MI, unsigned OpNo) {
67 printMemReference(MI, OpNo, "subreg64");
68 }
69
70 bool printAsmMRegister(const MachineOperand &MO, const char Mode);
71 bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
72 unsigned AsmVariant, const char *ExtraCode);
73 bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
74 unsigned AsmVariant, const char *ExtraCode);
75
76 void printMachineInstruction(const MachineInstr *MI);
77 void printSSECC(const MachineInstr *MI, unsigned Op);
78 void printMemReference(const MachineInstr *MI, unsigned Op,
79 const char *Modifier=NULL);
80 void printPICLabel(const MachineInstr *MI, unsigned Op);
81 bool runOnMachineFunction(MachineFunction &F);
82
83 /// getSectionForFunction - Return the section that we should emit the
84 /// specified function body into.
85 virtual std::string getSectionForFunction(const Function &F) const;
86};
87
88} // end namespace llvm
89
90#endif