switch X86 target off CurFunctionName and MCIze more.
[oota-llvm.git] / lib / Target / X86 / X86COFFMachineModuleInfo.h
1 //===-- llvm/CodeGen/X86COFFMachineModuleInfo.h -----------------*- 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 // This is an MMI implementation for X86 COFF (windows) targets.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef X86COFF_MACHINEMODULEINFO_H
15 #define X86COFF_MACHINEMODULEINFO_H
16
17 #include "llvm/CodeGen/MachineModuleInfo.h"
18 #include "llvm/ADT/StringSet.h"
19 #include "X86MachineFunctionInfo.h"
20
21 namespace llvm {
22   class X86MachineFunctionInfo;
23   class TargetData;
24   
25 /// X86COFFMachineModuleInfo - This is a MachineModuleInfoImpl implementation
26 /// for X86 COFF targets.
27 class X86COFFMachineModuleInfo : public MachineModuleInfoImpl {
28   StringSet<> CygMingStubs;
29   
30   // We have to propagate some information about MachineFunction to
31   // AsmPrinter. It's ok, when we're printing the function, since we have
32   // access to MachineFunction and can get the appropriate MachineFunctionInfo.
33   // Unfortunately, this is not possible when we're printing reference to
34   // Function (e.g. calling it and so on). Even more, there is no way to get the
35   // corresponding MachineFunctions: it can even be not created at all. That's
36   // why we should use additional structure, when we're collecting all necessary
37   // information.
38   //
39   // This structure is using e.g. for name decoration for stdcall & fastcall'ed
40   // function, since we have to use arguments' size for decoration.
41   typedef std::map<const Function*, X86MachineFunctionInfo> FMFInfoMap;
42   FMFInfoMap FunctionInfoMap;
43   
44 public:
45   X86COFFMachineModuleInfo(const MachineModuleInfo &);
46   ~X86COFFMachineModuleInfo();
47   
48   
49   void DecorateCygMingName(const MCSymbol* &Name, MCContext &Ctx,
50                            const GlobalValue *GV, const TargetData &TD);
51   void DecorateCygMingName(SmallVectorImpl<char> &Name, const GlobalValue *GV,
52                            const TargetData &TD);
53   
54   void AddFunctionInfo(const Function *F, const X86MachineFunctionInfo &Val);
55   
56
57   typedef StringSet<>::const_iterator stub_iterator;
58   stub_iterator stub_begin() const { return CygMingStubs.begin(); }
59   stub_iterator stub_end() const { return CygMingStubs.end(); }
60
61   
62 };
63
64
65
66 } // end namespace llvm
67
68 #endif