blob: afd552563d9198c114cc836241bfb9998d12df97 [file] [log] [blame]
Chris Lattner67c6b6e2009-09-20 06:45:52 +00001//===-- 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
20namespace llvm {
21 class X86MachineFunctionInfo;
22 class TargetData;
23
24/// X86COFFMachineModuleInfo - This is a MachineModuleInfoImpl implementation
25/// for X86 COFF targets.
26class X86COFFMachineModuleInfo : public MachineModuleInfoImpl {
27 StringSet<> CygMingStubs;
28
29 // We have to propagate some information about MachineFunction to
30 // AsmPrinter. It's ok, when we're printing the function, since we have
31 // access to MachineFunction and can get the appropriate MachineFunctionInfo.
32 // Unfortunately, this is not possible when we're printing reference to
33 // Function (e.g. calling it and so on). Even more, there is no way to get the
34 // corresponding MachineFunctions: it can even be not created at all. That's
35 // why we should use additional structure, when we're collecting all necessary
36 // information.
37 //
38 // This structure is using e.g. for name decoration for stdcall & fastcall'ed
39 // function, since we have to use arguments' size for decoration.
40 typedef std::map<const Function*, X86MachineFunctionInfo> FMFInfoMap;
41 FMFInfoMap FunctionInfoMap;
42
43public:
44 X86COFFMachineModuleInfo(const MachineModuleInfo &);
45 ~X86COFFMachineModuleInfo();
46
47
48 void DecorateCygMingName(std::string &Name, const GlobalValue *GV,
49 const TargetData &TD);
50 void DecorateCygMingName(SmallVectorImpl<char> &Name, const GlobalValue *GV,
51 const TargetData &TD);
52
53 void AddFunctionInfo(const Function *F, const X86MachineFunctionInfo &Val);
54
55
56 typedef StringSet<>::const_iterator stub_iterator;
57 stub_iterator stub_begin() const { return CygMingStubs.begin(); }
58 stub_iterator stub_end() const { return CygMingStubs.end(); }
59
60
61};
62
63
64
65} // end namespace llvm
66
67#endif