Make intel asmprinter child of generic asmprinter, not x86 shared asm printer. This...
[oota-llvm.git] / lib / Target / X86 / X86AsmPrinter.h
1 //===-- X86AsmPrinter.h - Convert X86 LLVM code to Intel assembly ---------===//
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 // This file the shared super class printer that converts from our internal
11 // representation of machine-dependent LLVM code to Intel and AT&T format
12 // assembly language.  This printer is the output mechanism used by `llc'.
13 //
14 //===----------------------------------------------------------------------===//
15
16 #ifndef X86ASMPRINTER_H
17 #define X86ASMPRINTER_H
18
19 #include "X86.h"
20 #include "X86MachineFunctionInfo.h"
21 #include "X86TargetMachine.h"
22 #include "llvm/ADT/StringSet.h"
23 #include "llvm/CodeGen/AsmPrinter.h"
24 #include "llvm/CodeGen/DwarfWriter.h"
25 #include "llvm/CodeGen/MachineModuleInfo.h"
26 #include "llvm/Support/Compiler.h"
27
28 namespace llvm {
29
30 struct VISIBILITY_HIDDEN X86SharedAsmPrinter : public AsmPrinter {
31   DwarfWriter DW;
32   MachineModuleInfo *MMI;
33
34   X86SharedAsmPrinter(std::ostream &O, X86TargetMachine &TM,
35                       const TargetAsmInfo *T)
36     : AsmPrinter(O, TM, T), DW(O, this, T), MMI(0) {
37     Subtarget = &TM.getSubtarget<X86Subtarget>();
38   }
39
40   // We have to propagate some information about MachineFunction to
41   // AsmPrinter. It's ok, when we're printing the function, since we have
42   // access to MachineFunction and can get the appropriate MachineFunctionInfo.
43   // Unfortunately, this is not possible when we're printing reference to
44   // Function (e.g. calling it and so on). Even more, there is no way to get the
45   // corresponding MachineFunctions: it can even be not created at all. That's
46   // why we should use additional structure, when we're collecting all necessary
47   // information.
48   //
49   // This structure is using e.g. for name decoration for stdcall & fastcall'ed
50   // function, since we have to use arguments' size for decoration.
51   typedef std::map<const Function*, X86MachineFunctionInfo> FMFInfoMap;
52   FMFInfoMap FunctionInfoMap;
53
54   void decorateName(std::string& Name, const GlobalValue* GV);
55
56   bool doInitialization(Module &M);
57   bool doFinalization(Module &M);
58
59   void getAnalysisUsage(AnalysisUsage &AU) const {
60     AU.setPreservesAll();
61     if (Subtarget->isTargetDarwin() ||
62         Subtarget->isTargetELF() ||
63         Subtarget->isTargetCygMing()) {
64       AU.addRequired<MachineModuleInfo>();
65     }
66     AsmPrinter::getAnalysisUsage(AU);
67   }
68
69   const X86Subtarget *Subtarget;
70
71   // Necessary for Darwin to print out the apprioriate types of linker stubs
72   StringSet<> FnStubs, GVStubs, LinkOnceStubs;
73
74   // Necessary for dllexport support
75   StringSet<> DLLExportedFns, DLLExportedGVs;
76 };
77
78 } // end namespace llvm
79
80 #endif