1 //==-- llvm/CodeGen/TargetLoweringObjectFileImpl.h - Object Info -*- C++ -*-==//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file implements classes used to handle lowerings specific to common
11 // object file formats.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_CODEGEN_TARGETLOWERINGOBJECTFILEIMPL_H
16 #define LLVM_CODEGEN_TARGETLOWERINGOBJECTFILEIMPL_H
18 #include "llvm/ADT/StringRef.h"
19 #include "llvm/MC/SectionKind.h"
20 #include "llvm/Target/TargetLoweringObjectFile.h"
23 class MachineModuleInfo;
35 class TargetLoweringObjectFileELF : public TargetLoweringObjectFile {
37 virtual ~TargetLoweringObjectFileELF() {}
39 virtual void emitPersonalityValue(MCStreamer &Streamer,
40 const TargetMachine &TM,
41 const MCSymbol *Sym) const;
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;
48 virtual const MCSection *
49 getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind,
50 Mangler *Mang, const TargetMachine &TM) const;
52 virtual const MCSection *
53 SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
54 Mangler *Mang, const TargetMachine &TM) const;
56 /// getExprForDwarfGlobalReference - Return an MCExpr to use for a reference
57 /// to the specified global variable from exception handling information.
59 virtual const MCExpr *
60 getExprForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
61 MachineModuleInfo *MMI, unsigned Encoding,
62 MCStreamer &Streamer) const;
64 // getCFIPersonalitySymbol - The symbol that gets passed to .cfi_personality.
66 getCFIPersonalitySymbol(const GlobalValue *GV, Mangler *Mang,
67 MachineModuleInfo *MMI) const;
69 virtual const MCSection *
70 getStaticCtorSection(unsigned Priority = 65535) const;
71 virtual const MCSection *
72 getStaticDtorSection(unsigned Priority = 65535) const;
77 class TargetLoweringObjectFileMachO : public TargetLoweringObjectFile {
79 virtual ~TargetLoweringObjectFileMachO() {}
81 /// emitModuleFlags - Emit the module flags that specify the garbage
82 /// collection information.
83 virtual void emitModuleFlags(MCStreamer &Streamer, NamedMDNode *ModFlags,
84 Mangler *Mang, const TargetMachine &TM) const;
86 virtual const MCSection *
87 SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
88 Mangler *Mang, const TargetMachine &TM) const;
90 virtual const MCSection *
91 getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind,
92 Mangler *Mang, const TargetMachine &TM) const;
94 virtual const MCSection *getSectionForConstant(SectionKind Kind) const;
96 /// shouldEmitUsedDirectiveFor - This hook allows targets to selectively
97 /// decide not to emit the UsedDirective for some symbols in llvm.used.
98 /// FIXME: REMOVE this (rdar://7071300)
99 virtual bool shouldEmitUsedDirectiveFor(const GlobalValue *GV,
102 /// getExprForDwarfGlobalReference - The mach-o version of this method
103 /// defaults to returning a stub reference.
104 virtual const MCExpr *
105 getExprForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
106 MachineModuleInfo *MMI, unsigned Encoding,
107 MCStreamer &Streamer) const;
109 // getCFIPersonalitySymbol - The symbol that gets passed to .cfi_personality.
111 getCFIPersonalitySymbol(const GlobalValue *GV, Mangler *Mang,
112 MachineModuleInfo *MMI) const;
117 class TargetLoweringObjectFileCOFF : public TargetLoweringObjectFile {
119 virtual ~TargetLoweringObjectFileCOFF() {}
121 virtual const MCSection *
122 getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind,
123 Mangler *Mang, const TargetMachine &TM) const;
125 virtual const MCSection *
126 SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
127 Mangler *Mang, const TargetMachine &TM) const;
130 } // end namespace llvm