blob: 0e2009e003d3ee7f1ba79573415b06ae0a8f6826 [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"
Chris Lattnerbf108bd2009-12-03 01:10:05 +000019#include "X86MachineFunctionInfo.h"
Chris Lattner67c6b6e2009-09-20 06:45:52 +000020
21namespace llvm {
22 class X86MachineFunctionInfo;
23 class TargetData;
24
25/// X86COFFMachineModuleInfo - This is a MachineModuleInfoImpl implementation
26/// for X86 COFF targets.
27class 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
44public:
45 X86COFFMachineModuleInfo(const MachineModuleInfo &);
46 ~X86COFFMachineModuleInfo();
47
48
Chris Lattner5957c842010-01-18 00:59:24 +000049 void DecorateCygMingName(MCSymbol* &Name, MCContext &Ctx,
Chris Lattner4fb69f42010-01-16 00:51:39 +000050 const GlobalValue *GV, const TargetData &TD);
Chris Lattner67c6b6e2009-09-20 06:45:52 +000051 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