1 //===-- X86IntelAsmPrinter.h - Convert X86 LLVM code to Intel assembly ----===//
3 // The LLVM Compiler Infrastructure
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.
8 //===----------------------------------------------------------------------===//
10 // Intel assembly code printer class.
12 //===----------------------------------------------------------------------===//
14 #ifndef X86INTELASMPRINTER_H
15 #define X86INTELASMPRINTER_H
17 #include "X86AsmPrinter.h"
18 #include "llvm/CodeGen/ValueTypes.h"
19 #include "llvm/Target/MRegisterInfo.h"
23 struct X86IntelAsmPrinter : public X86SharedAsmPrinter {
24 X86IntelAsmPrinter(std::ostream &O, X86TargetMachine &TM, TargetAsmInfo *T)
25 : X86SharedAsmPrinter(O, TM, T) {
28 virtual const char *getPassName() const {
29 return "X86 Intel-Style Assembly Printer";
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
36 bool printInstruction(const MachineInstr *MI);
38 // This method is used by the tablegen'erated instruction printer.
39 void printOperand(const MachineInstr *MI, unsigned OpNo,
40 const char *Modifier = 0) {
41 const MachineOperand &MO = MI->getOperand(OpNo);
42 if (MO.isRegister()) {
43 assert(MRegisterInfo::isPhysicalRegister(MO.getReg()) && "Not physreg??");
44 O << TM.getRegisterInfo()->get(MO.getReg()).Name;
46 printOp(MO, Modifier);
50 void printi8mem(const MachineInstr *MI, unsigned OpNo) {
52 printMemReference(MI, OpNo);
54 void printi16mem(const MachineInstr *MI, unsigned OpNo) {
56 printMemReference(MI, OpNo);
58 void printi32mem(const MachineInstr *MI, unsigned OpNo) {
60 printMemReference(MI, OpNo);
62 void printi64mem(const MachineInstr *MI, unsigned OpNo) {
64 printMemReference(MI, OpNo);
66 void printi128mem(const MachineInstr *MI, unsigned OpNo) {
68 printMemReference(MI, OpNo);
70 void printf32mem(const MachineInstr *MI, unsigned OpNo) {
72 printMemReference(MI, OpNo);
74 void printf64mem(const MachineInstr *MI, unsigned OpNo) {
76 printMemReference(MI, OpNo);
78 void printf128mem(const MachineInstr *MI, unsigned OpNo) {
80 printMemReference(MI, OpNo);
83 bool printAsmMRegister(const MachineOperand &MO, const char Mode);
84 bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
85 unsigned AsmVariant, const char *ExtraCode);
86 bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
87 unsigned AsmVariant, const char *ExtraCode);
88 void printMachineInstruction(const MachineInstr *MI);
89 void printOp(const MachineOperand &MO, const char *Modifier = 0);
90 void printSSECC(const MachineInstr *MI, unsigned Op);
91 void printMemReference(const MachineInstr *MI, unsigned Op);
92 void printPICLabel(const MachineInstr *MI, unsigned Op);
93 bool runOnMachineFunction(MachineFunction &F);
94 bool doInitialization(Module &M);
95 bool doFinalization(Module &M);
97 virtual void EmitString(const ConstantArray *CVA) const;
100 } // end namespace llvm