blob: cecf0b3d4133f62ff5b8c97c68b17a78514d5622 [file] [log] [blame]
Chris Lattnerb36cbd02005-07-01 22:44:09 +00001//===-- X86ATTAsmPrinter.h - Convert X86 LLVM code to Intel 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 {
Chris Lattnerb36cbd02005-07-01 22:44:09 +000021
22struct X86ATTAsmPrinter : public X86SharedAsmPrinter {
Jim Laskeya0f3d172006-09-07 22:06:40 +000023 X86ATTAsmPrinter(std::ostream &O, X86TargetMachine &TM, const TargetAsmInfo *T)
Jim Laskey563321a2006-09-06 18:34:40 +000024 : X86SharedAsmPrinter(O, TM, T) { }
Chris Lattnerb36cbd02005-07-01 22:44:09 +000025
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
Chris Lattnera3b8c572006-02-06 23:41:19 +000036 // These methods are used by the tablegen'erated instruction printer.
37 void printOperand(const MachineInstr *MI, unsigned OpNo,
Evan Cheng28b514392006-12-05 19:50:18 +000038 const char *Modifier = 0, bool NotRIPRel = false);
Nate Begeman391c5d22005-11-30 18:54:35 +000039 void printi8mem(const MachineInstr *MI, unsigned OpNo) {
Chris Lattnerb36cbd02005-07-01 22:44:09 +000040 printMemReference(MI, OpNo);
41 }
Nate Begeman391c5d22005-11-30 18:54:35 +000042 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 }
Evan Cheng470a6ad2006-02-22 02:26:30 +000051 void printi128mem(const MachineInstr *MI, unsigned OpNo) {
52 printMemReference(MI, OpNo);
53 }
Nate Begeman391c5d22005-11-30 18:54:35 +000054 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 }
Evan Cheng223547a2006-01-31 22:28:30 +000060 void printf128mem(const MachineInstr *MI, unsigned OpNo) {
Nate Begeman391c5d22005-11-30 18:54:35 +000061 printMemReference(MI, OpNo);
62 }
Evan Cheng25ab6902006-09-08 06:48:29 +000063 void printlea64_32mem(const MachineInstr *MI, unsigned OpNo) {
64 printMemReference(MI, OpNo, "subreg64");
65 }
Nate Begeman391c5d22005-11-30 18:54:35 +000066
Evan Cheng55c25f22006-04-28 23:19:39 +000067 bool printAsmMRegister(const MachineOperand &MO, const char Mode);
Evan Cheng3d48a902006-04-28 21:19:05 +000068 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);
Evan Cheng62f27002006-04-28 23:11:40 +000072
73 void printMachineInstruction(const MachineInstr *MI);
Nate Begeman391c5d22005-11-30 18:54:35 +000074 void printSSECC(const MachineInstr *MI, unsigned Op);
Evan Cheng25ab6902006-09-08 06:48:29 +000075 void printMemReference(const MachineInstr *MI, unsigned Op,
76 const char *Modifier=NULL);
Evan Cheng7ccced62006-02-18 00:15:05 +000077 void printPICLabel(const MachineInstr *MI, unsigned Op);
Chris Lattnerb36cbd02005-07-01 22:44:09 +000078 bool runOnMachineFunction(MachineFunction &F);
Chris Lattnerafbfded2006-10-05 02:43:52 +000079
80 /// getSectionForFunction - Return the section that we should emit the
81 /// specified function body into.
82 virtual std::string getSectionForFunction(const Function &F) const;
Chris Lattnerb36cbd02005-07-01 22:44:09 +000083};
84
Chris Lattnerb36cbd02005-07-01 22:44:09 +000085} // end namespace llvm
86
87#endif