[ARM] MVE integer min and max
[llvm-complete.git] / include / llvm / CodeGen / TargetLoweringObjectFileImpl.h
bloba1fb81cb009d2f05c8e7a1c1dda98e048717298a
1 //==- llvm/CodeGen/TargetLoweringObjectFileImpl.h - Object Info --*- C++ -*-==//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file implements classes used to handle lowerings specific to common
10 // object file formats.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_CODEGEN_TARGETLOWERINGOBJECTFILEIMPL_H
15 #define LLVM_CODEGEN_TARGETLOWERINGOBJECTFILEIMPL_H
17 #include "llvm/IR/Module.h"
18 #include "llvm/MC/MCExpr.h"
19 #include "llvm/Target/TargetLoweringObjectFile.h"
21 namespace llvm {
23 class GlobalValue;
24 class MachineModuleInfo;
25 class Mangler;
26 class MCContext;
27 class MCSection;
28 class MCSymbol;
29 class TargetMachine;
31 class TargetLoweringObjectFileELF : public TargetLoweringObjectFile {
32 bool UseInitArray = false;
33 mutable unsigned NextUniqueID = 1; // ID 0 is reserved for execute-only sections
35 protected:
36 MCSymbolRefExpr::VariantKind PLTRelativeVariantKind =
37 MCSymbolRefExpr::VK_None;
38 const TargetMachine *TM;
40 public:
41 TargetLoweringObjectFileELF() = default;
42 ~TargetLoweringObjectFileELF() override = default;
44 void Initialize(MCContext &Ctx, const TargetMachine &TM) override;
46 /// Emit Obj-C garbage collection and linker options.
47 void emitModuleMetadata(MCStreamer &Streamer, Module &M) const override;
49 void emitPersonalityValue(MCStreamer &Streamer, const DataLayout &DL,
50 const MCSymbol *Sym) const override;
52 /// Given a constant with the SectionKind, return a section that it should be
53 /// placed in.
54 MCSection *getSectionForConstant(const DataLayout &DL, SectionKind Kind,
55 const Constant *C,
56 unsigned &Align) const override;
58 MCSection *getExplicitSectionGlobal(const GlobalObject *GO, SectionKind Kind,
59 const TargetMachine &TM) const override;
61 MCSection *SelectSectionForGlobal(const GlobalObject *GO, SectionKind Kind,
62 const TargetMachine &TM) const override;
64 MCSection *getSectionForJumpTable(const Function &F,
65 const TargetMachine &TM) const override;
67 bool shouldPutJumpTableInFunctionSection(bool UsesLabelDifference,
68 const Function &F) const override;
70 /// Return an MCExpr to use for a reference to the specified type info global
71 /// variable from exception handling information.
72 const MCExpr *getTTypeGlobalReference(const GlobalValue *GV,
73 unsigned Encoding,
74 const TargetMachine &TM,
75 MachineModuleInfo *MMI,
76 MCStreamer &Streamer) const override;
78 // The symbol that gets passed to .cfi_personality.
79 MCSymbol *getCFIPersonalitySymbol(const GlobalValue *GV,
80 const TargetMachine &TM,
81 MachineModuleInfo *MMI) const override;
83 void InitializeELF(bool UseInitArray_);
84 MCSection *getStaticCtorSection(unsigned Priority,
85 const MCSymbol *KeySym) const override;
86 MCSection *getStaticDtorSection(unsigned Priority,
87 const MCSymbol *KeySym) const override;
89 const MCExpr *lowerRelativeReference(const GlobalValue *LHS,
90 const GlobalValue *RHS,
91 const TargetMachine &TM) const override;
93 MCSection *getSectionForCommandLines() const override;
96 class TargetLoweringObjectFileMachO : public TargetLoweringObjectFile {
97 public:
98 TargetLoweringObjectFileMachO();
99 ~TargetLoweringObjectFileMachO() override = default;
101 void Initialize(MCContext &Ctx, const TargetMachine &TM) override;
103 /// Emit the module flags that specify the garbage collection information.
104 void emitModuleMetadata(MCStreamer &Streamer, Module &M) const override;
106 MCSection *SelectSectionForGlobal(const GlobalObject *GO, SectionKind Kind,
107 const TargetMachine &TM) const override;
109 MCSection *getExplicitSectionGlobal(const GlobalObject *GO, SectionKind Kind,
110 const TargetMachine &TM) const override;
112 MCSection *getSectionForConstant(const DataLayout &DL, SectionKind Kind,
113 const Constant *C,
114 unsigned &Align) const override;
116 /// The mach-o version of this method defaults to returning a stub reference.
117 const MCExpr *getTTypeGlobalReference(const GlobalValue *GV,
118 unsigned Encoding,
119 const TargetMachine &TM,
120 MachineModuleInfo *MMI,
121 MCStreamer &Streamer) const override;
123 // The symbol that gets passed to .cfi_personality.
124 MCSymbol *getCFIPersonalitySymbol(const GlobalValue *GV,
125 const TargetMachine &TM,
126 MachineModuleInfo *MMI) const override;
128 /// Get MachO PC relative GOT entry relocation
129 const MCExpr *getIndirectSymViaGOTPCRel(const MCSymbol *Sym,
130 const MCValue &MV, int64_t Offset,
131 MachineModuleInfo *MMI,
132 MCStreamer &Streamer) const override;
134 void getNameWithPrefix(SmallVectorImpl<char> &OutName, const GlobalValue *GV,
135 const TargetMachine &TM) const override;
138 class TargetLoweringObjectFileCOFF : public TargetLoweringObjectFile {
139 mutable unsigned NextUniqueID = 0;
141 public:
142 ~TargetLoweringObjectFileCOFF() override = default;
144 void Initialize(MCContext &Ctx, const TargetMachine &TM) override;
145 MCSection *getExplicitSectionGlobal(const GlobalObject *GO, SectionKind Kind,
146 const TargetMachine &TM) const override;
148 MCSection *SelectSectionForGlobal(const GlobalObject *GO, SectionKind Kind,
149 const TargetMachine &TM) const override;
151 void getNameWithPrefix(SmallVectorImpl<char> &OutName, const GlobalValue *GV,
152 const TargetMachine &TM) const override;
154 MCSection *getSectionForJumpTable(const Function &F,
155 const TargetMachine &TM) const override;
157 /// Emit Obj-C garbage collection and linker options.
158 void emitModuleMetadata(MCStreamer &Streamer, Module &M) const override;
160 MCSection *getStaticCtorSection(unsigned Priority,
161 const MCSymbol *KeySym) const override;
162 MCSection *getStaticDtorSection(unsigned Priority,
163 const MCSymbol *KeySym) const override;
165 void emitLinkerFlagsForGlobal(raw_ostream &OS,
166 const GlobalValue *GV) const override;
168 void emitLinkerFlagsForUsed(raw_ostream &OS,
169 const GlobalValue *GV) const override;
171 const MCExpr *lowerRelativeReference(const GlobalValue *LHS,
172 const GlobalValue *RHS,
173 const TargetMachine &TM) const override;
175 /// Given a mergeable constant with the specified size and relocation
176 /// information, return a section that it should be placed in.
177 MCSection *getSectionForConstant(const DataLayout &DL, SectionKind Kind,
178 const Constant *C,
179 unsigned &Align) const override;
182 class TargetLoweringObjectFileWasm : public TargetLoweringObjectFile {
183 mutable unsigned NextUniqueID = 0;
185 public:
186 TargetLoweringObjectFileWasm() = default;
187 ~TargetLoweringObjectFileWasm() override = default;
189 MCSection *getExplicitSectionGlobal(const GlobalObject *GO, SectionKind Kind,
190 const TargetMachine &TM) const override;
192 MCSection *SelectSectionForGlobal(const GlobalObject *GO, SectionKind Kind,
193 const TargetMachine &TM) const override;
195 bool shouldPutJumpTableInFunctionSection(bool UsesLabelDifference,
196 const Function &F) const override;
198 void InitializeWasm();
199 MCSection *getStaticCtorSection(unsigned Priority,
200 const MCSymbol *KeySym) const override;
201 MCSection *getStaticDtorSection(unsigned Priority,
202 const MCSymbol *KeySym) const override;
204 const MCExpr *lowerRelativeReference(const GlobalValue *LHS,
205 const GlobalValue *RHS,
206 const TargetMachine &TM) const override;
209 } // end namespace llvm
211 #endif // LLVM_CODEGEN_TARGETLOWERINGOBJECTFILEIMPL_H