Chris Lattner | 67c6b6e | 2009-09-20 06:45:52 +0000 | [diff] [blame] | 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" |
Chris Lattner | bf108bd | 2009-12-03 01:10:05 +0000 | [diff] [blame] | 19 | #include "X86MachineFunctionInfo.h" |
Chris Lattner | 67c6b6e | 2009-09-20 06:45:52 +0000 | [diff] [blame] | 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 | |
Chris Lattner | 5957c84 | 2010-01-18 00:59:24 +0000 | [diff] [blame] | 49 | void DecorateCygMingName(MCSymbol* &Name, MCContext &Ctx, |
Chris Lattner | 4fb69f4 | 2010-01-16 00:51:39 +0000 | [diff] [blame] | 50 | const GlobalValue *GV, const TargetData &TD); |
Chris Lattner | 67c6b6e | 2009-09-20 06:45:52 +0000 | [diff] [blame] | 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 |