LLVM  3.7.0
TargetLoweringObjectFileImpl.h
Go to the documentation of this file.
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"
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 
36  bool UseInitArray;
37  mutable unsigned NextUniqueID = 0;
38 
39 public:
40  TargetLoweringObjectFileELF() : UseInitArray(false) {}
41 
43 
44  void emitPersonalityValue(MCStreamer &Streamer, const TargetMachine &TM,
45  const MCSymbol *Sym) const override;
46 
47  /// Given a constant with the SectionKind, return a section that it should be
48  /// placed in.
50  const Constant *C) const override;
51 
53  Mangler &Mang,
54  const TargetMachine &TM) const override;
55 
57  Mangler &Mang,
58  const TargetMachine &TM) const override;
59 
61  const TargetMachine &TM) const override;
62 
63  bool shouldPutJumpTableInFunctionSection(bool UsesLabelDifference,
64  const Function &F) const override;
65 
66  /// Return an MCExpr to use for a reference to the specified type info global
67  /// variable from exception handling information.
68  const MCExpr *
69  getTTypeGlobalReference(const GlobalValue *GV, unsigned Encoding,
70  Mangler &Mang, const TargetMachine &TM,
71  MachineModuleInfo *MMI,
72  MCStreamer &Streamer) const override;
73 
74  // The symbol that gets passed to .cfi_personality.
76  const TargetMachine &TM,
77  MachineModuleInfo *MMI) const override;
78 
79  void InitializeELF(bool UseInitArray_);
80  MCSection *getStaticCtorSection(unsigned Priority,
81  const MCSymbol *KeySym) const override;
82  MCSection *getStaticDtorSection(unsigned Priority,
83  const MCSymbol *KeySym) const override;
84 };
85 
86 
87 
89 public:
92 
93  /// Emit the module flags that specify the garbage collection information.
94  void emitModuleFlags(MCStreamer &Streamer,
96  Mangler &Mang, const TargetMachine &TM) const override;
97 
99  Mangler &Mang,
100  const TargetMachine &TM) const override;
101 
103  Mangler &Mang,
104  const TargetMachine &TM) const override;
105 
107  const Constant *C) const override;
108 
109  /// The mach-o version of this method defaults to returning a stub reference.
110  const MCExpr *
111  getTTypeGlobalReference(const GlobalValue *GV, unsigned Encoding,
112  Mangler &Mang, const TargetMachine &TM,
113  MachineModuleInfo *MMI,
114  MCStreamer &Streamer) const override;
115 
116  // The symbol that gets passed to .cfi_personality.
118  const TargetMachine &TM,
119  MachineModuleInfo *MMI) const override;
120 
121  /// Get MachO PC relative GOT entry relocation
122  const MCExpr *getIndirectSymViaGOTPCRel(const MCSymbol *Sym,
123  const MCValue &MV, int64_t Offset,
124  MachineModuleInfo *MMI,
125  MCStreamer &Streamer) const override;
126 };
127 
128 
129 
131 public:
133 
135  Mangler &Mang,
136  const TargetMachine &TM) const override;
137 
139  Mangler &Mang,
140  const TargetMachine &TM) const override;
141 
142  void getNameWithPrefix(SmallVectorImpl<char> &OutName, const GlobalValue *GV,
143  bool CannotUsePrivateLabel, Mangler &Mang,
144  const TargetMachine &TM) const override;
145 
147  const TargetMachine &TM) const override;
148 
149  /// Emit Obj-C garbage collection and linker options. Only linker option
150  /// emission is implemented for COFF.
151  void emitModuleFlags(MCStreamer &Streamer,
153  Mangler &Mang, const TargetMachine &TM) const override;
154 
155  MCSection *getStaticCtorSection(unsigned Priority,
156  const MCSymbol *KeySym) const override;
157  MCSection *getStaticDtorSection(unsigned Priority,
158  const MCSymbol *KeySym) const override;
159 
161  const Mangler &Mang) const override;
162 };
163 
164 } // end namespace llvm
165 
166 #endif
Instances of this class represent a uniqued identifier for a section in the current translation unit...
Definition: MCSection.h:48
MCSection * getSectionForConstant(SectionKind Kind, const Constant *C) const override
Given a constant with the SectionKind, return a section that it should be placed in.
const MCExpr * getTTypeGlobalReference(const GlobalValue *GV, unsigned Encoding, Mangler &Mang, const TargetMachine &TM, MachineModuleInfo *MMI, MCStreamer &Streamer) const override
Return an MCExpr to use for a reference to the specified type info global variable from exception han...
MCSection * getStaticCtorSection(unsigned Priority, const MCSymbol *KeySym) const override
This represents an "assembler immediate".
Definition: MCValue.h:44
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:39
void emitPersonalityValue(MCStreamer &Streamer, const TargetMachine &TM, const MCSymbol *Sym) const override
MCSection * getSectionForJumpTable(const Function &F, Mangler &Mang, const TargetMachine &TM) const override
F(f)
const MCExpr * getIndirectSymViaGOTPCRel(const MCSymbol *Sym, const MCValue &MV, int64_t Offset, MachineModuleInfo *MMI, MCStreamer &Streamer) const override
Get MachO PC relative GOT entry relocation.
const MCExpr * getTTypeGlobalReference(const GlobalValue *GV, unsigned Encoding, Mangler &Mang, const TargetMachine &TM, MachineModuleInfo *MMI, MCStreamer &Streamer) const override
The mach-o version of this method defaults to returning a stub reference.
MCSymbol * getCFIPersonalitySymbol(const GlobalValue *GV, Mangler &Mang, const TargetMachine &TM, MachineModuleInfo *MMI) const override
Base class for the full range of assembler expressions which are needed for parsing.
Definition: MCExpr.h:33
#define false
Definition: ConvertUTF.c:65
MCSection * getSectionForJumpTable(const Function &F, Mangler &Mang, const TargetMachine &TM) const override
MCSection * getStaticDtorSection(unsigned Priority, const MCSymbol *KeySym) const override
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
Definition: ArrayRef.h:31
MCSection * getSectionForConstant(SectionKind Kind, const Constant *C) const override
Given a constant with the SectionKind, return a section that it should be placed in.
Streaming machine code generation interface.
Definition: MCStreamer.h:157
MCSection * SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind, Mangler &Mang, const TargetMachine &TM) const override
This is an important base class in LLVM.
Definition: Constant.h:41
SectionKind - This is a simple POD value that classifies the properties of a section.
Definition: SectionKind.h:28
MCSection * getStaticDtorSection(unsigned Priority, const MCSymbol *KeySym) const override
bool shouldPutJumpTableInFunctionSection(bool UsesLabelDifference, const Function &F) const override
MCSymbol * getCFIPersonalitySymbol(const GlobalValue *GV, Mangler &Mang, const TargetMachine &TM, MachineModuleInfo *MMI) const override
MCSection * getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind, Mangler &Mang, const TargetMachine &TM) const override
Targets should implement this method to assign a section to globals with an explicit section specfied...
MCSection * SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind, Mangler &Mang, const TargetMachine &TM) const override
void emitModuleFlags(MCStreamer &Streamer, ArrayRef< Module::ModuleFlagEntry > ModuleFlags, Mangler &Mang, const TargetMachine &TM) const override
Emit the module flags that specify the garbage collection information.
MCSection * getStaticCtorSection(unsigned Priority, const MCSymbol *KeySym) const override
MCSection * getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind, Mangler &Mang, const TargetMachine &TM) const override
Targets should implement this method to assign a section to globals with an explicit section specfied...
void emitModuleFlags(MCStreamer &Streamer, ArrayRef< Module::ModuleFlagEntry > ModuleFlags, Mangler &Mang, const TargetMachine &TM) const override
Emit Obj-C garbage collection and linker options.
const ARM::ArchExtKind Kind
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:38
Primary interface to the complete machine description for the target machine.
void emitLinkerFlagsForGlobal(raw_ostream &OS, const GlobalValue *GV, const Mangler &Mang) const override
MCSection * SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind, Mangler &Mang, const TargetMachine &TM) const override
void getNameWithPrefix(SmallVectorImpl< char > &OutName, const GlobalValue *GV, bool CannotUsePrivateLabel, Mangler &Mang, const TargetMachine &TM) const override
MCSection * getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind, Mangler &Mang, const TargetMachine &TM) const override
Targets should implement this method to assign a section to globals with an explicit section specfied...
MachineModuleInfo - This class contains meta information specific to a module.