Add all of the data stream intrinsics and instructions. woo
[oota-llvm.git] / lib / Target / X86 / X86IntelAsmPrinter.h
1 //===-- X86IntelAsmPrinter.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 // Intel assembly code printer class.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef X86INTELASMPRINTER_H
15 #define X86INTELASMPRINTER_H
16
17 #include "X86AsmPrinter.h"
18 #include "llvm/CodeGen/ValueTypes.h"
19 #include "llvm/Target/MRegisterInfo.h"
20
21 namespace llvm {
22
23 struct X86IntelAsmPrinter : public X86SharedAsmPrinter {
24  X86IntelAsmPrinter(std::ostream &O, X86TargetMachine &TM)
25     : X86SharedAsmPrinter(O, TM) { }
26
27   virtual const char *getPassName() const {
28     return "X86 Intel-Style Assembly Printer";
29   }
30
31   /// printInstruction - This method is automatically generated by tablegen
32   /// from the instruction set description.  This method returns true if the
33   /// machine instruction was sufficiently described to print it, otherwise it
34   /// returns false.
35   bool printInstruction(const MachineInstr *MI);
36
37   // This method is used by the tablegen'erated instruction printer.
38   void printOperand(const MachineInstr *MI, unsigned OpNo,
39                     const char *Modifier = 0) {
40     const MachineOperand &MO = MI->getOperand(OpNo);
41     if (MO.getType() == MachineOperand::MO_MachineRegister) {
42       assert(MRegisterInfo::isPhysicalRegister(MO.getReg())&&"Not physref??");
43       // Bug Workaround: See note in Printer::doInitialization about %.
44       O << "%" << TM.getRegisterInfo()->get(MO.getReg()).Name;
45     } else {
46       printOp(MO, Modifier);
47     }
48   }
49
50   void printi8mem(const MachineInstr *MI, unsigned OpNo) {
51     O << "BYTE PTR ";
52     printMemReference(MI, OpNo);
53   }
54   void printi16mem(const MachineInstr *MI, unsigned OpNo) {
55     O << "WORD PTR ";
56     printMemReference(MI, OpNo);
57   }
58   void printi32mem(const MachineInstr *MI, unsigned OpNo) {
59     O << "DWORD PTR ";
60     printMemReference(MI, OpNo);
61   }
62   void printi64mem(const MachineInstr *MI, unsigned OpNo) {
63     O << "QWORD PTR ";
64     printMemReference(MI, OpNo);
65   }
66   void printi128mem(const MachineInstr *MI, unsigned OpNo) {
67     O << "XMMWORD PTR ";
68     printMemReference(MI, OpNo);
69   }
70   void printf32mem(const MachineInstr *MI, unsigned OpNo) {
71     O << "DWORD PTR ";
72     printMemReference(MI, OpNo);
73   }
74   void printf64mem(const MachineInstr *MI, unsigned OpNo) {
75     O << "QWORD PTR ";
76     printMemReference(MI, OpNo);
77   }
78   void printf128mem(const MachineInstr *MI, unsigned OpNo) {
79     O << "XMMWORD PTR ";
80     printMemReference(MI, OpNo);
81   }
82
83   void printMachineInstruction(const MachineInstr *MI);
84   void printOp(const MachineOperand &MO, const char *Modifier = 0);
85   void printSSECC(const MachineInstr *MI, unsigned Op);
86   void printMemReference(const MachineInstr *MI, unsigned Op);
87   void printPICLabel(const MachineInstr *MI, unsigned Op);
88   bool runOnMachineFunction(MachineFunction &F);
89   bool doInitialization(Module &M);
90 };
91
92 } // end namespace llvm
93
94 #endif