]> git.proxmox.com Git - rustc.git/blame - src/llvm/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h
Imported Upstream version 1.0.0-alpha.2
[rustc.git] / src / llvm / include / llvm / CodeGen / TargetLoweringObjectFileImpl.h
CommitLineData
223e47cc
LB
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
970d7e83 18#include "llvm/ADT/StringRef.h"
223e47cc
LB
19#include "llvm/MC/SectionKind.h"
20#include "llvm/Target/TargetLoweringObjectFile.h"
223e47cc
LB
21
22namespace 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
35class TargetLoweringObjectFileELF : public TargetLoweringObjectFile {
36 bool UseInitArray;
37
38public:
39 virtual ~TargetLoweringObjectFileELF() {}
40
1a4d82fc
JJ
41 void emitPersonalityValue(MCStreamer &Streamer, const TargetMachine &TM,
42 const MCSymbol *Sym) const override;
43
44 /// Given a constant with the SectionKind, return a section that it should be
45 /// placed in.
46 const MCSection *getSectionForConstant(SectionKind Kind,
47 const Constant *C) const override;
48
49 const MCSection *getExplicitSectionGlobal(const GlobalValue *GV,
50 SectionKind Kind, Mangler &Mang,
51 const TargetMachine &TM) const override;
52
53 const MCSection *SelectSectionForGlobal(const GlobalValue *GV,
54 SectionKind Kind, Mangler &Mang,
55 const TargetMachine &TM) const override;
56
57 /// Return an MCExpr to use for a reference to the specified type info global
58 /// variable from exception handling information.
59 const MCExpr *
60 getTTypeGlobalReference(const GlobalValue *GV, unsigned Encoding,
61 Mangler &Mang, const TargetMachine &TM,
62 MachineModuleInfo *MMI,
63 MCStreamer &Streamer) const override;
64
65 // The symbol that gets passed to .cfi_personality.
66 MCSymbol *getCFIPersonalitySymbol(const GlobalValue *GV, Mangler &Mang,
223e47cc 67 const TargetMachine &TM,
1a4d82fc 68 MachineModuleInfo *MMI) const override;
223e47cc 69
1a4d82fc
JJ
70 void InitializeELF(bool UseInitArray_);
71 const MCSection *getStaticCtorSection(unsigned Priority,
72 const MCSymbol *KeySym) const override;
73 const MCSection *getStaticDtorSection(unsigned Priority,
74 const MCSymbol *KeySym) const override;
75};
223e47cc
LB
76
77
223e47cc 78
1a4d82fc
JJ
79class TargetLoweringObjectFileMachO : public TargetLoweringObjectFile {
80public:
81 virtual ~TargetLoweringObjectFileMachO() {}
223e47cc 82
1a4d82fc
JJ
83 /// Extract the dependent library name from a linker option string. Returns
84 /// StringRef() if the option does not specify a library.
85 StringRef getDepLibFromLinkerOpt(StringRef LinkerOption) const override;
223e47cc 86
1a4d82fc
JJ
87 /// Emit the module flags that specify the garbage collection information.
88 void emitModuleFlags(MCStreamer &Streamer,
89 ArrayRef<Module::ModuleFlagEntry> ModuleFlags,
90 Mangler &Mang, const TargetMachine &TM) const override;
223e47cc 91
1a4d82fc
JJ
92 const MCSection *
93 SelectSectionForGlobal(const GlobalValue *GV,
94 SectionKind Kind, Mangler &Mang,
95 const TargetMachine &TM) const override;
223e47cc 96
1a4d82fc
JJ
97 const MCSection *
98 getExplicitSectionGlobal(const GlobalValue *GV,
99 SectionKind Kind, Mangler &Mang,
100 const TargetMachine &TM) const override;
223e47cc 101
1a4d82fc
JJ
102 const MCSection *getSectionForConstant(SectionKind Kind,
103 const Constant *C) const override;
223e47cc 104
1a4d82fc
JJ
105 /// The mach-o version of this method defaults to returning a stub reference.
106 const MCExpr *
107 getTTypeGlobalReference(const GlobalValue *GV, unsigned Encoding,
108 Mangler &Mang, const TargetMachine &TM,
109 MachineModuleInfo *MMI,
110 MCStreamer &Streamer) const override;
111
112 // The symbol that gets passed to .cfi_personality.
113 MCSymbol *getCFIPersonalitySymbol(const GlobalValue *GV, Mangler &Mang,
114 const TargetMachine &TM,
115 MachineModuleInfo *MMI) const override;
223e47cc
LB
116};
117
118
119
120class TargetLoweringObjectFileCOFF : public TargetLoweringObjectFile {
121public:
122 virtual ~TargetLoweringObjectFileCOFF() {}
123
1a4d82fc
JJ
124 const MCSection *
125 getExplicitSectionGlobal(const GlobalValue *GV,
126 SectionKind Kind, Mangler &Mang,
127 const TargetMachine &TM) const override;
128
129 const MCSection *
130 SelectSectionForGlobal(const GlobalValue *GV,
131 SectionKind Kind, Mangler &Mang,
132 const TargetMachine &TM) const override;
133
134 /// Extract the dependent library name from a linker option string. Returns
135 /// StringRef() if the option does not specify a library.
136 StringRef getDepLibFromLinkerOpt(StringRef LinkerOption) const override;
137
138 /// Emit Obj-C garbage collection and linker options. Only linker option
139 /// emission is implemented for COFF.
140 void emitModuleFlags(MCStreamer &Streamer,
141 ArrayRef<Module::ModuleFlagEntry> ModuleFlags,
142 Mangler &Mang, const TargetMachine &TM) const override;
143
144 const MCSection *getStaticCtorSection(unsigned Priority,
145 const MCSymbol *KeySym) const override;
146 const MCSection *getStaticDtorSection(unsigned Priority,
147 const MCSymbol *KeySym) const override;
223e47cc
LB
148};
149
150} // end namespace llvm
151
152#endif