LLVM 24.0.0git
TargetLoweringObjectFile.cpp
Go to the documentation of this file.
1//===-- llvm/Target/TargetLoweringObjectFile.cpp - Object File Info -------===//
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.
11//
12//===----------------------------------------------------------------------===//
13
16#include "llvm/IR/Attributes.h"
17#include "llvm/IR/Constants.h"
18#include "llvm/IR/DataLayout.h"
20#include "llvm/IR/Function.h"
21#include "llvm/IR/GlobalValue.h"
23#include "llvm/IR/Mangler.h"
24#include "llvm/IR/Module.h"
25#include "llvm/MC/MCAsmInfo.h"
26#include "llvm/MC/MCContext.h"
27#include "llvm/MC/MCExpr.h"
28#include "llvm/MC/MCStreamer.h"
29#include "llvm/MC/SectionKind.h"
33using namespace llvm;
34
35//===----------------------------------------------------------------------===//
36// Generic Code
37//===----------------------------------------------------------------------===//
38
39/// initialize - this method must be called before any actual lowering is
40/// done. This specifies the current context for codegen, and gives the
41/// lowering implementations a chance to set up their default sections.
43 const TargetMachine &TM,
44 const Module &M) {
45 // `initialize` can be called more than once.
46 delete Mang;
47 Mang = new Mangler();
48 initMCObjectFileInfo(ctx, TM.isPositionIndependent(),
49 TM.getCodeModel() == CodeModel::Large);
50
51 // Reset various EH DWARF encodings.
54
55 this->TM = &TM;
56}
57
61
63 // If target does not have LEB128 directives, we would need the
64 // call site encoding to be udata4 so that the alternative path
65 // for not having LEB128 directives could work.
66 if (!getContext().getAsmInfo().hasLEB128Directives())
68 return CallSiteEncoding;
69}
70
71static bool isNullOrUndef(const Constant *C) {
72 // Check that the constant isn't all zeros or undefs.
73 if (C->isNullValue() || isa<UndefValue>(C))
74 return true;
76 return false;
77 for (const auto *Operand : C->operand_values()) {
78 if (!isNullOrUndef(cast<Constant>(Operand)))
79 return false;
80 }
81 return true;
82}
83
84static bool isSuitableForBSS(const GlobalVariable *GV) {
85 const Constant *C = GV->getInitializer();
86
87 // Must have zero initializer.
88 if (!isNullOrUndef(C))
89 return false;
90
91 // Leave constant zeros in readonly constant sections, so they can be shared.
92 if (GV->isConstant())
93 return false;
94
95 // If the global has an explicit section specified, don't put it in BSS.
96 if (GV->hasSection())
97 return false;
98
99 // Otherwise, put it in BSS!
100 return true;
101}
102
103/// IsNullTerminatedString - Return true if the specified constant (which is
104/// known to have a type that is an array of 1/2/4 byte elements) ends with a
105/// nul value and contains no other nuls in it. Note that this is more general
106/// than ConstantDataSequential::isString because we allow 2 & 4 byte strings.
107static bool IsNullTerminatedString(const Constant *C) {
108 // First check: is we have constant array terminated with zero
110 uint64_t NumElts = CDS->getNumElements();
111 assert(NumElts != 0 && "Can't have an empty CDS");
112
113 if (CDS->getElementAsInteger(NumElts-1) != 0)
114 return false; // Not null terminated.
115
116 // Verify that the null doesn't occur anywhere else in the string.
117 for (uint64_t i = 0; i != NumElts - 1; ++i)
118 if (CDS->getElementAsInteger(i) == 0)
119 return false;
120 return true;
121 }
122
123 // Another possibility: [1 x i8] zeroinitializer
125 return cast<ArrayType>(C->getType())->getNumElements() == 1;
126
127 return false;
128}
129
131 const GlobalValue *GV, StringRef Suffix, const TargetMachine &TM) const {
132 assert(!Suffix.empty());
133
134 SmallString<60> NameStr;
135 NameStr += GV->getDataLayout().getInternalSymbolPrefix();
136 TM.getNameWithPrefix(NameStr, GV, *Mang);
137 NameStr.append(Suffix.begin(), Suffix.end());
138 return getContext().getOrCreateSymbol(NameStr);
139}
140
142 const GlobalValue *GV, const TargetMachine &TM,
143 MachineModuleInfo *MMI) const {
144 return TM.getSymbol(GV);
145}
146
150
152 const Module &M) const {
155 M.getModuleFlagsMetadata(ModuleFlags);
156
157 MDNode *CGProfile = nullptr;
158
159 for (const auto &MFE : ModuleFlags) {
160 StringRef Key = MFE.Key->getString();
161 if (Key == "CG Profile") {
162 CGProfile = cast<MDNode>(MFE.Val);
163 break;
164 }
165 }
166
167 if (!CGProfile)
168 return;
169
170 auto GetSym = [this](const MDOperand &MDO) -> MCSymbol * {
171 if (!MDO)
172 return nullptr;
173 auto *V = cast<ValueAsMetadata>(MDO);
174 const Function *F = cast<Function>(V->getValue()->stripPointerCasts());
175 if (F->hasDLLImportStorageClass())
176 return nullptr;
177 return TM->getSymbol(F);
178 };
179
180 for (const auto &Edge : CGProfile->operands()) {
181 MDNode *E = cast<MDNode>(Edge);
182 const MCSymbol *From = GetSym(E->getOperand(0));
183 const MCSymbol *To = GetSym(E->getOperand(1));
184 // Skip null functions. This can happen if functions are dead stripped after
185 // the CGProfile pass has been run.
186 if (!From || !To)
187 continue;
188 uint64_t Count = cast<ConstantAsMetadata>(E->getOperand(2))
189 ->getValue()
190 ->getUniqueInteger()
191 .getZExtValue();
192 Streamer.emitCGProfileEntry(MCSymbolRefExpr::create(From, C),
194 }
195}
196
198 MCStreamer &Streamer, const Module &M,
199 std::function<void(MCStreamer &Streamer)> COMDATSymEmitter) const {
200 NamedMDNode *FuncInfo = M.getNamedMetadata(PseudoProbeDescMetadataName);
201 if (!FuncInfo)
202 return;
203
204 // Emit a descriptor for every function including functions that have an
205 // available external linkage. We may not want this for imported functions
206 // that has code in another thinLTO module but we don't have a good way to
207 // tell them apart from inline functions defined in header files. Therefore
208 // we put each descriptor in a separate comdat section and rely on the
209 // linker to deduplicate.
210 auto &C = getContext();
211 for (const auto *Operand : FuncInfo->operands()) {
212 const auto *MD = cast<MDNode>(Operand);
213 auto *GUID = mdconst::extract<ConstantInt>(MD->getOperand(0));
214 auto *Hash = mdconst::extract<ConstantInt>(MD->getOperand(1));
215 auto *Name = cast<MDString>(MD->getOperand(2));
216 auto *S = C.getObjectFileInfo()->getPseudoProbeDescSection(
217 TM->getFunctionSections() ? Name->getString() : StringRef(),
218 Hash->getZExtValue());
219
220 Streamer.switchSection(S);
221
222 // emit COFF COMDAT symbol.
223 if (COMDATSymEmitter)
224 COMDATSymEmitter(Streamer);
225
226 Streamer.emitInt64(GUID->getZExtValue());
227 Streamer.emitInt64(Hash->getZExtValue());
228 Streamer.emitULEB128IntValue(Name->getString().size());
229 Streamer.emitBytes(Name->getString());
230 }
231}
232
233static bool containsConstantPtrAuth(const Constant *C) {
235 return true;
236
238 return false;
239
240 for (const Value *Op : C->operands())
242 return true;
243
244 return false;
245}
246
247/// getKindForGlobal - This is a top-level target-independent classifier for
248/// a global object. Given a global variable and information from the TM, this
249/// function classifies the global in a target independent manner. This function
250/// may be overridden by the target implementation.
252 const TargetMachine &TM){
254 "Can only be used for global definitions");
255
256 // Functions are classified as text sections.
257 if (isa<Function>(GO))
258 return SectionKind::getText();
259
260 // Basic blocks are classified as text sections.
261 if (isa<BasicBlock>(GO))
262 return SectionKind::getText();
263
264 // Global variables require more detailed analysis.
265 const auto *GVar = cast<GlobalVariable>(GO);
266
267 // Handle thread-local data first.
268 if (GVar->isThreadLocal()) {
269 if (isSuitableForBSS(GVar) && !TM.Options.NoZerosInBSS) {
270 // Zero-initialized TLS variables with local linkage always get classified
271 // as ThreadBSSLocal.
272 if (GVar->hasLocalLinkage()) {
274 }
276 }
278 }
279
280 // Variables with common linkage always get classified as common.
281 if (GVar->hasCommonLinkage())
282 return SectionKind::getCommon();
283
284 // Most non-mergeable zero data can be put in the BSS section unless otherwise
285 // specified.
286 if (isSuitableForBSS(GVar) && !TM.Options.NoZerosInBSS) {
287 if (GVar->hasLocalLinkage())
289 else if (GVar->hasExternalLinkage())
291 return SectionKind::getBSS();
292 }
293
294 // Global variables with '!exclude' should get the exclude section kind if
295 // they have an explicit section and no other metadata. Similarly,
296 // '!metadata_section_kind' forces the section kind to be 'metadata'.
297 if (GVar->hasSection()) {
298 if (MDNode *MD = GVar->getMetadata(LLVMContext::MD_exclude))
299 if (!MD->getNumOperands())
301 if (MDNode *MD = GVar->getMetadata(LLVMContext::MD_metadata_section_kind))
302 if (!MD->getNumOperands())
304 }
305
306 // If the global is marked constant, we can put it into a mergable section,
307 // a mergable string section, or general .data if it contains relocations.
308 if (GVar->isConstant()) {
309 // If the initializer for the global contains something that requires a
310 // relocation, then we may have to drop this into a writable data section
311 // even though it is marked const.
312 const Constant *C = GVar->getInitializer();
313 if (!C->needsRelocation()) {
314 // If the global is required to have a unique address, it can't be put
315 // into a mergable section: just drop it into the general read-only
316 // section instead.
317 if (!GVar->hasGlobalUnnamedAddr())
319
320 // If initializer is a null-terminated string, put it in a "cstring"
321 // section of the right width.
322 if (ArrayType *ATy = dyn_cast<ArrayType>(C->getType())) {
323 if (IntegerType *ITy =
324 dyn_cast<IntegerType>(ATy->getElementType())) {
325 if ((ITy->getBitWidth() == 8 || ITy->getBitWidth() == 16 ||
326 ITy->getBitWidth() == 32) &&
328 if (ITy->getBitWidth() == 8)
330 if (ITy->getBitWidth() == 16)
332
333 assert(ITy->getBitWidth() == 32 && "Unknown width");
335 }
336 }
337 }
338
339 // Otherwise, just drop it into a mergable constant section. If we have
340 // a section for this size, use it, otherwise use the arbitrary sized
341 // mergable section.
342 switch (
343 GVar->getDataLayout().getTypeAllocSize(C->getType())) {
344 case 4: return SectionKind::getMergeableConst4();
345 case 8: return SectionKind::getMergeableConst8();
346 case 16: return SectionKind::getMergeableConst16();
347 case 32: return SectionKind::getMergeableConst32();
348 default:
350 }
351
352 } else {
353 // The dynamic linker always needs to fix PtrAuth relocations up.
356
357 // GOFF: data in the code section is shared by all instances of the
358 // program, while function descriptors and other data live in the WSA
359 // of each instance. The binder rejects a relocation in the code section
360 // that refers to the WSA, even a local one, so every initializer that
361 // needs a relocation goes to the WSA.
362 if (TM.getTargetTriple().isOSBinFormatGOFF())
364
365 // In static, ROPI and RWPI relocation models, the linker will resolve
366 // all addresses, so the relocation entries will actually be constants by
367 // the time the app starts up. However, we can't put this into a
368 // mergable section, because the linker doesn't take relocations into
369 // consideration when it tries to merge entries in the section.
370 Reloc::Model ReloModel = TM.getRelocationModel();
371 if (ReloModel == Reloc::Static || ReloModel == Reloc::ROPI ||
372 ReloModel == Reloc::RWPI || ReloModel == Reloc::ROPI_RWPI ||
373 !C->needsDynamicRelocation())
375
376 // Otherwise, the dynamic linker needs to fix it up, put it in the
377 // writable data.rel section.
379 }
380 }
381
382 // Okay, this isn't a constant.
383 return SectionKind::getData();
384}
385
388 const TargetMachine &TM) {
389 // Check if '#pragma clang section' name is applicable.
390 // Note that pragma directive overrides -ffunction-section, -fdata-section
391 // and so section name is exactly as user specified and not uniqued.
393 if (GV && GV->hasImplicitSection()) {
394 SectionKind Kind = getKindForGlobal(GO, TM);
395 auto Attrs = GV->getAttributes();
396 if (Attrs.hasAttribute("bss-section") && Kind.isBSS())
397 return Attrs.getAttribute("bss-section").getValueAsString();
398 else if (Attrs.hasAttribute("rodata-section") && Kind.isReadOnly())
399 return Attrs.getAttribute("rodata-section").getValueAsString();
400 else if (Attrs.hasAttribute("relro-section") && Kind.isReadOnlyWithRel())
401 return Attrs.getAttribute("relro-section").getValueAsString();
402 else if (Attrs.hasAttribute("data-section") && Kind.isData())
403 return Attrs.getAttribute("data-section").getValueAsString();
404 }
405
406 return GO->getSection();
407}
408
409/// This method computes the appropriate section to emit the specified global
410/// variable or function definition. This should not be passed external (or
411/// available externally) globals.
413 const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const {
414 // Select section name.
415 if (GO->hasSection())
416 return getExplicitSectionGlobal(GO, Kind, TM);
417
418 if (auto *GVar = dyn_cast<GlobalVariable>(GO)) {
419 auto Attrs = GVar->getAttributes();
420 if ((Attrs.hasAttribute("bss-section") && Kind.isBSS()) ||
421 (Attrs.hasAttribute("data-section") && Kind.isData()) ||
422 (Attrs.hasAttribute("relro-section") && Kind.isReadOnlyWithRel()) ||
423 (Attrs.hasAttribute("rodata-section") && Kind.isReadOnly())) {
424 return getExplicitSectionGlobal(GO, Kind, TM);
425 }
426 }
427
428 // Use default section depending on the 'type' of global
429 return SelectSectionForGlobal(GO, Kind, TM);
430}
431
432/// This method computes the appropriate section to emit the specified global
433/// variable or function definition. This should not be passed external (or
434/// available externally) globals.
435MCSection *
440
442 const Function &F, const TargetMachine &TM) const {
443 return getSectionForJumpTable(F, TM, /*JTE=*/nullptr);
444}
445
447 const Function &F, const TargetMachine &TM,
448 const MachineJumpTableEntry *JTE) const {
449 Align Alignment(1);
450 return getSectionForConstant(F.getDataLayout(), SectionKind::getReadOnly(),
451 /*C=*/nullptr, Alignment, &F);
452}
453
455 bool UsesLabelDifference, const Function &F) const {
456 // In PIC mode, we need to emit the jump table to the same section as the
457 // function body itself, otherwise the label differences won't make sense.
458 // FIXME: Need a better predicate for this: what about custom entries?
459 if (UsesLabelDifference)
460 return true;
461
462 // We should also do if the section name is NULL or function is declared
463 // in discardable section
464 // FIXME: this isn't the right predicate, should be based on the MCSection
465 // for the function.
466 return F.isWeakForLinker();
467}
468
469/// Given a mergable constant with the specified size and relocation
470/// information, return a section that it should be placed in.
472 const DataLayout &DL, SectionKind Kind, const Constant *C, Align &Alignment,
473 const Function *F) const {
474 if (Kind.isReadOnly() && ReadOnlySection != nullptr)
475 return ReadOnlySection;
476
477 return DataSection;
478}
479
481 const DataLayout &DL, SectionKind Kind, const Constant *C, Align &Alignment,
482 const Function *F, StringRef SectionPrefix) const {
483 // Fallback to `getSectionForConstant` without `SectionPrefix` parameter if it
484 // is empty.
485 if (SectionPrefix.empty())
486 return getSectionForConstant(DL, Kind, C, Alignment, F);
488 "TargetLoweringObjectFile::getSectionForConstant that "
489 "accepts SectionPrefix is not implemented for the object file format");
490}
491
497
499 const Function &F, const TargetMachine &TM) const {
500 return nullptr;
501}
502
503/// getTTypeGlobalReference - Return an MCExpr to use for a
504/// reference to the specified global variable from exception
505/// handling information.
507 const GlobalValue *GV, unsigned Encoding, const TargetMachine &TM,
509 const MCSymbolRefExpr *Ref =
510 MCSymbolRefExpr::create(TM.getSymbol(GV), getContext());
511
512 return getTTypeReference(Ref, Encoding, Streamer);
513}
514
516getTTypeReference(const MCSymbolRefExpr *Sym, unsigned Encoding,
517 MCStreamer &Streamer) const {
518 switch (Encoding & 0x70) {
519 default:
520 report_fatal_error("We do not support this DWARF encoding yet!");
522 // Do nothing special
523 return Sym;
525 // Emit a label to the streamer for the current position. This gives us
526 // .-foo addressing.
528 Streamer.emitLabel(PCSym);
529 const MCExpr *PC = MCSymbolRefExpr::create(PCSym, getContext());
530 return MCBinaryExpr::createSub(Sym, PC, getContext());
531 }
532 }
533}
534
536 // FIXME: It's not clear what, if any, default this should have - perhaps a
537 // null return could mean 'no location' & we should just do that here.
538 return MCSymbolRefExpr::create(Sym, getContext());
539}
540
542 SmallVectorImpl<char> &OutName, const GlobalValue *GV,
543 const TargetMachine &TM) const {
544 Mang->getNameWithPrefix(OutName, GV, /*CannotUsePrivateLabel=*/false);
545}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
unsigned uint64_t
MachineBasicBlock & MBB
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
This file contains the simple types necessary to represent the attributes associated with functions a...
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
This file contains the declarations for the subclasses of Constant, which represent the different fla...
This file contains constants used for implementing Dwarf debug support.
Module.h This file contains the declarations for the Module class.
#define F(x, y, z)
Definition MD5.cpp:54
std::unique_ptr< MCStreamer > && Streamer
static bool isNullOrUndef(const Constant *C)
static bool IsNullTerminatedString(const Constant *C)
IsNullTerminatedString - Return true if the specified constant (which is known to have a type that is...
static bool isSuitableForBSS(const GlobalVariable *GV)
static bool containsConstantPtrAuth(const Constant *C)
Class to represent array types.
ConstantDataSequential - A vector or array constant whose element type is a simple 1/2/4/8-byte integ...
Definition Constants.h:755
This is an important base class in LLVM.
Definition Constant.h:43
A parsed version of the target data layout string in and methods for querying it.
Definition DataLayout.h:64
StringRef getInternalSymbolPrefix() const
Definition DataLayout.h:308
StringRef getSection() const
Get the custom section of this global if it has one.
bool hasSection() const
Check if this global has a custom object file section.
bool isDeclarationForLinker() const
LLVM_ABI const DataLayout & getDataLayout() const
Get the data layout of the module this global belongs to.
Definition Globals.cpp:205
const Constant * getInitializer() const
getInitializer - Return the initializer for this global variable.
AttributeSet getAttributes() const
Return the attribute set for this global.
bool hasImplicitSection() const
Check if section name is present.
bool isConstant() const
If the value is a global constant, its value is immutable throughout the runtime execution of the pro...
Class to represent integer types.
static const MCBinaryExpr * createSub(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
Definition MCExpr.h:427
Context object for machine code objects.
Definition MCContext.h:83
LLVM_ABI MCSymbol * createTempSymbol()
Create a temporary symbol with a unique name.
LLVM_ABI MCSymbol * getOrCreateSymbol(const Twine &Name)
Lookup the symbol inside with the specified Name.
Base class for the full range of assembler expressions which are needed for parsing.
Definition MCExpr.h:34
void initMCObjectFileInfo(MCContext &MCCtx, bool PIC, bool LargeCodeModel=false)
MCSection * ReadOnlySection
Section that is readonly and can contain arbitrary initialized data.
MCContext & getContext() const
MCSection * DataSection
Section directive for standard data.
Instances of this class represent a uniqued identifier for a section in the current translation unit.
Definition MCSection.h:580
Streaming machine code generation interface.
Definition MCStreamer.h:222
Represent a reference to a symbol from inside an expression.
Definition MCExpr.h:190
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx, SMLoc Loc=SMLoc())
Definition MCExpr.h:213
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition MCSymbol.h:42
Metadata node.
Definition Metadata.h:1081
ArrayRef< MDOperand > operands() const
Definition Metadata.h:1435
Tracking metadata reference owned by Metadata.
Definition Metadata.h:902
This class contains meta information specific to a module.
A Module instance is used to store all the information related to an LLVM module.
Definition Module.h:68
A tuple of MDNodes.
Definition Metadata.h:1797
iterator_range< op_iterator > operands()
Definition Metadata.h:1893
SectionKind - This is a simple POD value that classifies the properties of a section.
Definition SectionKind.h:22
static SectionKind getThreadData()
static SectionKind getBSSExtern()
static SectionKind getMetadata()
static SectionKind getMergeable2ByteCString()
static SectionKind getExclude()
static SectionKind getBSSLocal()
static SectionKind getMergeableConst4()
static SectionKind getCommon()
static SectionKind getText()
static SectionKind getThreadBSSLocal()
static SectionKind getReadOnlyWithRel()
static SectionKind getData()
static SectionKind getMergeableConst8()
static SectionKind getBSS()
static SectionKind getThreadBSS()
static SectionKind getMergeableConst16()
static SectionKind getMergeable4ByteCString()
static SectionKind getMergeable1ByteCString()
static SectionKind getReadOnly()
static SectionKind getMergeableConst32()
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
Definition SmallString.h:26
void append(StringRef RHS)
Append from a StringRef.
Definition SmallString.h:68
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
constexpr bool empty() const
Check if the string is empty.
Definition StringRef.h:141
iterator begin() const
Definition StringRef.h:114
iterator end() const
Definition StringRef.h:116
virtual void getNameWithPrefix(SmallVectorImpl< char > &OutName, const GlobalValue *GV, const TargetMachine &TM) const
unsigned PersonalityEncoding
PersonalityEncoding, LSDAEncoding, TTypeEncoding - Some encoding values for EH.
void emitCGProfileMetadata(MCStreamer &Streamer, const Module &M) const
Emit Call Graph Profile metadata.
static SectionKind getKindForGlobal(const GlobalObject *GO, const TargetMachine &TM)
Classify the specified global variable into a set of target independent categories embodied in Sectio...
virtual MCSection * getSectionForJumpTable(const Function &F, const TargetMachine &TM) const
virtual bool shouldPutJumpTableInFunctionSection(bool UsesLabelDifference, const Function &F) const
virtual void initialize(MCContext &ctx, const TargetMachine &TM, const Module &M)
This method must be called before any actual lowering is done.
virtual MCSymbol * getCFIPersonalitySymbol(const GlobalValue *GV, const TargetMachine &TM, MachineModuleInfo *MMI) const
virtual MCSection * SelectSectionForGlobal(const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const =0
virtual MCSection * getSectionForConstant(const DataLayout &DL, SectionKind Kind, const Constant *C, Align &Alignment, const Function *F) const
Given a constant with the SectionKind, return a section that it should be placed in.
static StringRef getCustomSectionName(const GlobalObject *GO, const TargetMachine &TM)
Return the section name specified by 'pragma clang section' or the section attribute.
MCSymbol * getSymbolWithGlobalValueBase(const GlobalValue *GV, StringRef Suffix, const TargetMachine &TM) const
Return the MCSymbol for a private symbol with global value name as its base, with the specified suffi...
virtual MCSection * getSectionForMachineBasicBlock(const Function &F, const MachineBasicBlock &MBB, const TargetMachine &TM) const
virtual const MCExpr * getDebugThreadLocalSymbol(const MCSymbol *Sym) const
Create a symbol reference to describe the given TLS variable when emitting the address in debug info.
virtual const MCExpr * getTTypeGlobalReference(const GlobalValue *GV, unsigned Encoding, const TargetMachine &TM, MachineModuleInfo *MMI, MCStreamer &Streamer) const
Return an MCExpr to use for a reference to the specified global variable from exception handling info...
void emitPseudoProbeDescMetadata(MCStreamer &Streamer, const Module &M, std::function< void(MCStreamer &Streamer)> COMDATSymEmitter=nullptr) const
Emit pseudo_probe_desc metadata.
virtual MCSection * getExplicitSectionGlobal(const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const =0
Targets should implement this method to assign a section to globals with an explicit section specfied...
const MCExpr * getTTypeReference(const MCSymbolRefExpr *Sym, unsigned Encoding, MCStreamer &Streamer) const
virtual void emitPersonalityValue(MCStreamer &Streamer, const DataLayout &TM, const MCSymbol *Sym, const MachineModuleInfo *MMI) const
virtual MCSection * getUniqueSectionForFunction(const Function &F, const TargetMachine &TM) const
MCSection * SectionForGlobal(const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const
This method computes the appropriate section to emit the specified global variable or function defini...
Primary interface to the complete machine description for the target machine.
LLVM Value Representation.
Definition Value.h:75
@ DW_EH_PE_pcrel
Definition Dwarf.h:977
@ DW_EH_PE_absptr
Definition Dwarf.h:966
@ DW_EH_PE_udata4
Definition Dwarf.h:970
@ DW_EH_PE_uleb128
Definition Dwarf.h:968
std::enable_if_t< detail::IsValidPointer< X, Y >::value, X * > extract(Y &&MD)
Extract a Value from Metadata.
Definition Metadata.h:679
This is an optimization pass for GlobalISel generic memory operations.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
Definition Casting.h:643
LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)
Definition Error.cpp:163
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
Definition Casting.h:547
LLVM_ATTRIBUTE_VISIBILITY_DEFAULT AnalysisKey InnerAnalysisManagerProxy< AnalysisManagerT, IRUnitT, ExtraArgTs... >::Key
@ Ref
The access may reference the value stored in memory.
Definition ModRef.h:32
RelativeUniformCounterPtr ValuesPtrExpr VTableAddr Count
Definition InstrProf.h:145
DWARFExpression::Operation Op
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
Definition Casting.h:559
constexpr const char * PseudoProbeDescMetadataName
Definition PseudoProbe.h:26
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition Alignment.h:39
MachineJumpTableEntry - One jump table in the jump table info.