De-virtualize SwitchSection.
[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
26   virtual const char *getPassName() const {
27     return "X86 Intel-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   // This method is used by the tablegen'erated instruction printer.
37   void printOperand(const MachineInstr *MI, unsigned OpNo,
38                     const char *Modifier = 0) {
39     const MachineOperand &MO = MI->getOperand(OpNo);
40     if (MO.getType() == MachineOperand::MO_MachineRegister) {
41       assert(MRegisterInfo::isPhysicalRegister(MO.getReg())&&"Not physref??");
42       O << TM.getRegisterInfo()->get(MO.getReg()).Name;
43     } else {
44       printOp(MO, Modifier);
45     }
46   }
47
48   void printi8mem(const MachineInstr *MI, unsigned OpNo) {
49     O << "BYTE PTR ";
50     printMemReference(MI, OpNo);
51   }
52   void printi16mem(const MachineInstr *MI, unsigned OpNo) {
53     O << "WORD PTR ";
54     printMemReference(MI, OpNo);
55   }
56   void printi32mem(const MachineInstr *MI, unsigned OpNo) {
57     O << "DWORD PTR ";
58     printMemReference(MI, OpNo);
59   }
60   void printi64mem(const MachineInstr *MI, unsigned OpNo) {
61     O << "QWORD PTR ";
62     printMemReference(MI, OpNo);
63   }
64   void printi128mem(const MachineInstr *MI, unsigned OpNo) {
65     O << "XMMWORD PTR ";
66     printMemReference(MI, OpNo);
67   }
68   void printf32mem(const MachineInstr *MI, unsigned OpNo) {
69     O << "DWORD PTR ";
70     printMemReference(MI, OpNo);
71   }
72   void printf64mem(const MachineInstr *MI, unsigned OpNo) {
73     O << "QWORD PTR ";
74     printMemReference(MI, OpNo);
75   }
76   void printf128mem(const MachineInstr *MI, unsigned OpNo) {
77     O << "XMMWORD PTR ";
78     printMemReference(MI, OpNo);
79   }
80
81   bool printAsmMRegister(const MachineOperand &MO, const char Mode);
82   bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
83                        unsigned AsmVariant, const char *ExtraCode);
84   bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
85                              unsigned AsmVariant, const char *ExtraCode);
86   void printMachineInstruction(const MachineInstr *MI);
87   void printOp(const MachineOperand &MO, const char *Modifier = 0);
88   void printSSECC(const MachineInstr *MI, unsigned Op);
89   void printMemReference(const MachineInstr *MI, unsigned Op);
90   void printPICLabel(const MachineInstr *MI, unsigned Op);
91   bool runOnMachineFunction(MachineFunction &F);
92   bool doInitialization(Module &M);
93   bool doFinalization(Module &M);
94
95   virtual void EmitString(const ConstantArray *CVA) const;
96 };
97
98 } // end namespace llvm
99
100 #endif