]> CyberLeo.Net >> Repos - FreeBSD/releng/9.0.git/blob - contrib/llvm/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h
Copy stable/9 to releng/9.0 as part of the FreeBSD 9.0-RELEASE release
[FreeBSD/releng/9.0.git] / contrib / llvm / include / llvm / CodeGen / TargetLoweringObjectFileImpl.h
1 //==-- llvm/CodeGen/TargetLoweringObjectFileImpl.h - Object Info -*- 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 file implements classes used to handle lowerings specific to common
11 // object file formats.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #ifndef LLVM_CODEGEN_TARGETLOWERINGOBJECTFILEIMPL_H
16 #define LLVM_CODEGEN_TARGETLOWERINGOBJECTFILEIMPL_H
17
18 #include "llvm/ADT/StringRef.h"
19 #include "llvm/MC/SectionKind.h"
20 #include "llvm/Target/TargetLoweringObjectFile.h"
21
22 namespace llvm {
23   class MachineModuleInfo;
24   class Mangler;
25   class MCAsmInfo;
26   class MCExpr;
27   class MCSection;
28   class MCSectionMachO;
29   class MCSymbol;
30   class MCContext;
31   class GlobalValue;
32   class TargetMachine;
33
34
35 class TargetLoweringObjectFileELF : public TargetLoweringObjectFile {
36 public:
37   virtual ~TargetLoweringObjectFileELF() {}
38
39   virtual void emitPersonalityValue(MCStreamer &Streamer,
40                                     const TargetMachine &TM,
41                                     const MCSymbol *Sym) const;
42
43   /// getSectionForConstant - Given a constant with the SectionKind, return a
44   /// section that it should be placed in.
45   virtual const MCSection *getSectionForConstant(SectionKind Kind) const;
46
47
48   virtual const MCSection *
49   getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind,
50                            Mangler *Mang, const TargetMachine &TM) const;
51
52   virtual const MCSection *
53   SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
54                          Mangler *Mang, const TargetMachine &TM) const;
55
56   /// getExprForDwarfGlobalReference - Return an MCExpr to use for a reference
57   /// to the specified global variable from exception handling information.
58   ///
59   virtual const MCExpr *
60   getExprForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
61                                  MachineModuleInfo *MMI, unsigned Encoding,
62                                  MCStreamer &Streamer) const;
63
64   // getCFIPersonalitySymbol - The symbol that gets passed to .cfi_personality.
65   virtual MCSymbol *
66   getCFIPersonalitySymbol(const GlobalValue *GV, Mangler *Mang,
67                           MachineModuleInfo *MMI) const;
68 };
69
70
71
72 class TargetLoweringObjectFileMachO : public TargetLoweringObjectFile {
73 public:
74   virtual ~TargetLoweringObjectFileMachO() {}
75
76   virtual const MCSection *
77   SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
78                          Mangler *Mang, const TargetMachine &TM) const;
79
80   virtual const MCSection *
81   getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind,
82                            Mangler *Mang, const TargetMachine &TM) const;
83
84   virtual const MCSection *getSectionForConstant(SectionKind Kind) const;
85
86   /// shouldEmitUsedDirectiveFor - This hook allows targets to selectively
87   /// decide not to emit the UsedDirective for some symbols in llvm.used.
88   /// FIXME: REMOVE this (rdar://7071300)
89   virtual bool shouldEmitUsedDirectiveFor(const GlobalValue *GV,
90                                           Mangler *) const;
91
92   /// getExprForDwarfGlobalReference - The mach-o version of this method
93   /// defaults to returning a stub reference.
94   virtual const MCExpr *
95   getExprForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
96                                  MachineModuleInfo *MMI, unsigned Encoding,
97                                  MCStreamer &Streamer) const;
98
99   // getCFIPersonalitySymbol - The symbol that gets passed to .cfi_personality.
100   virtual MCSymbol *
101   getCFIPersonalitySymbol(const GlobalValue *GV, Mangler *Mang,
102                           MachineModuleInfo *MMI) const;
103 };
104
105
106
107 class TargetLoweringObjectFileCOFF : public TargetLoweringObjectFile {
108 public:
109   virtual ~TargetLoweringObjectFileCOFF() {}
110
111   virtual const MCSection *
112   getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind,
113                            Mangler *Mang, const TargetMachine &TM) const;
114
115   virtual const MCSection *
116   SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
117                          Mangler *Mang, const TargetMachine &TM) const;
118 };
119
120 } // end namespace llvm
121
122 #endif