clean up the asmprinter header and privatize some stuff.
[oota-llvm.git] / lib / Target / X86 / AsmPrinter / X86AsmPrinter.h
1 //===-- X86AsmPrinter.h - Convert X86 LLVM code to assembly -----*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // AT&T assembly code printer class.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef X86ASMPRINTER_H
15 #define X86ASMPRINTER_H
16
17 #include "../X86.h"
18 #include "../X86MachineFunctionInfo.h"
19 #include "../X86TargetMachine.h"
20 #include "llvm/ADT/StringSet.h"
21 #include "llvm/CodeGen/AsmPrinter.h"
22 #include "llvm/CodeGen/DwarfWriter.h"
23 #include "llvm/CodeGen/MachineModuleInfo.h"
24 #include "llvm/CodeGen/ValueTypes.h"
25 #include "llvm/Support/Compiler.h"
26
27 namespace llvm {
28
29 class MachineJumpTableInfo;
30 class MCContext;
31 class MCInst;
32 class MCStreamer;
33 class MCSymbol;
34
35 class VISIBILITY_HIDDEN X86AsmPrinter : public AsmPrinter {
36   const X86Subtarget *Subtarget;
37  public:
38   explicit X86AsmPrinter(TargetMachine &TM, MCStreamer &Streamer)
39     : AsmPrinter(TM, Streamer) {
40     Subtarget = &TM.getSubtarget<X86Subtarget>();
41   }
42
43   virtual const char *getPassName() const {
44     return "X86 AT&T-Style Assembly Printer";
45   }
46   
47   const X86Subtarget &getSubtarget() const { return *Subtarget; }
48
49   void getAnalysisUsage(AnalysisUsage &AU) const {
50     AU.setPreservesAll();
51     AU.addRequired<MachineModuleInfo>();
52     AU.addRequired<DwarfWriter>();
53     AsmPrinter::getAnalysisUsage(AU);
54   }
55
56   virtual void EmitStartOfAsmFile(Module &M);
57
58   virtual void EmitEndOfAsmFile(Module &M);
59   
60   virtual void EmitInstruction(const MachineInstr *MI);
61   
62   void printSymbolOperand(const MachineOperand &MO, raw_ostream &O);
63
64   // These methods are used by the tablegen'erated instruction printer.
65   void printOperand(const MachineInstr *MI, unsigned OpNo, raw_ostream &O,
66                     const char *Modifier = 0);
67   void print_pcrel_imm(const MachineInstr *MI, unsigned OpNo, raw_ostream &O);
68
69   bool printAsmMRegister(const MachineOperand &MO, char Mode, raw_ostream &O);
70   bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
71                        unsigned AsmVariant, const char *ExtraCode,
72                        raw_ostream &OS);
73   bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
74                              unsigned AsmVariant, const char *ExtraCode,
75                              raw_ostream &OS);
76
77   void printMachineInstruction(const MachineInstr *MI);
78   void printSSECC(const MachineInstr *MI, unsigned Op, raw_ostream &O);
79   void printMemReference(const MachineInstr *MI, unsigned Op, raw_ostream &O,
80                          const char *Modifier=NULL);
81   void printLeaMemReference(const MachineInstr *MI, unsigned Op, raw_ostream &O,
82                             const char *Modifier=NULL);
83
84   void printPICLabel(const MachineInstr *MI, unsigned Op, raw_ostream &O);
85
86   void PrintPICBaseSymbol(raw_ostream &O) const;
87   
88   bool runOnMachineFunction(MachineFunction &F);
89   
90   void PrintDebugValueComment(const MachineInstr *MI, raw_ostream &OS);
91 };
92
93 } // end namespace llvm
94
95 #endif