Movatterモバイル変換


[0]ホーム

URL:


LLVM 20.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
14#include "llvm/Target/TargetLoweringObjectFile.h"
15#include "llvm/BinaryFormat/Dwarf.h"
16#include "llvm/IR/Constants.h"
17#include "llvm/IR/DataLayout.h"
18#include "llvm/IR/DerivedTypes.h"
19#include "llvm/IR/Function.h"
20#include "llvm/IR/GlobalVariable.h"
21#include "llvm/IR/Mangler.h"
22#include "llvm/IR/Module.h"
23#include "llvm/MC/MCAsmInfo.h"
24#include "llvm/MC/MCContext.h"
25#include "llvm/MC/MCExpr.h"
26#include "llvm/MC/MCStreamer.h"
27#include "llvm/MC/SectionKind.h"
28#include "llvm/Support/ErrorHandling.h"
29#include "llvm/Target/TargetMachine.h"
30#include "llvm/Target/TargetOptions.h"
31using namespacellvm;
32
33//===----------------------------------------------------------------------===//
34// Generic Code
35//===----------------------------------------------------------------------===//
36
37/// Initialize - this method must be called before any actual lowering is
38/// done. This specifies the current context for codegen, and gives the
39/// lowering implementations a chance to set up their default sections.
40voidTargetLoweringObjectFile::Initialize(MCContext &ctx,
41constTargetMachine &TM) {
42// `Initialize` can be called more than once.
43delete Mang;
44 Mang =newMangler();
45initMCObjectFileInfo(ctx,TM.isPositionIndependent(),
46TM.getCodeModel() ==CodeModel::Large);
47
48// Reset various EH DWARF encodings.
49PersonalityEncoding =LSDAEncoding =TTypeEncoding =dwarf::DW_EH_PE_absptr;
50CallSiteEncoding =dwarf::DW_EH_PE_uleb128;
51
52 this->TM = &TM;
53}
54
55TargetLoweringObjectFile::~TargetLoweringObjectFile() {
56delete Mang;
57}
58
59unsignedTargetLoweringObjectFile::getCallSiteEncoding() const{
60// If target does not have LEB128 directives, we would need the
61// call site encoding to be udata4 so that the alternative path
62// for not having LEB128 directives could work.
63if (!getContext().getAsmInfo()->hasLEB128Directives())
64returndwarf::DW_EH_PE_udata4;
65returnCallSiteEncoding;
66}
67
68staticboolisNullOrUndef(constConstant *C) {
69// Check that the constant isn't all zeros or undefs.
70if (C->isNullValue() || isa<UndefValue>(C))
71returntrue;
72if (!isa<ConstantAggregate>(C))
73returnfalse;
74for (constauto *Operand :C->operand_values()) {
75if (!isNullOrUndef(cast<Constant>(Operand)))
76returnfalse;
77 }
78returntrue;
79}
80
81staticboolisSuitableForBSS(constGlobalVariable *GV) {
82constConstant *C = GV->getInitializer();
83
84// Must have zero initializer.
85if (!isNullOrUndef(C))
86returnfalse;
87
88// Leave constant zeros in readonly constant sections, so they can be shared.
89if (GV->isConstant())
90returnfalse;
91
92// If the global has an explicit section specified, don't put it in BSS.
93if (GV->hasSection())
94returnfalse;
95
96// Otherwise, put it in BSS!
97returntrue;
98}
99
100/// IsNullTerminatedString - Return true if the specified constant (which is
101/// known to have a type that is an array of 1/2/4 byte elements) ends with a
102/// nul value and contains no other nuls in it. Note that this is more general
103/// than ConstantDataSequential::isString because we allow 2 & 4 byte strings.
104staticboolIsNullTerminatedString(constConstant *C) {
105// First check: is we have constant array terminated with zero
106if (constConstantDataSequential *CDS = dyn_cast<ConstantDataSequential>(C)) {
107unsigned NumElts = CDS->getNumElements();
108assert(NumElts != 0 &&"Can't have an empty CDS");
109
110if (CDS->getElementAsInteger(NumElts-1) != 0)
111returnfalse;// Not null terminated.
112
113// Verify that the null doesn't occur anywhere else in the string.
114for (unsigned i = 0; i != NumElts-1; ++i)
115if (CDS->getElementAsInteger(i) == 0)
116returnfalse;
117returntrue;
118 }
119
120// Another possibility: [1 x i8] zeroinitializer
121if (isa<ConstantAggregateZero>(C))
122return cast<ArrayType>(C->getType())->getNumElements() == 1;
123
124returnfalse;
125}
126
127MCSymbol *TargetLoweringObjectFile::getSymbolWithGlobalValueBase(
128constGlobalValue *GV,StringRef Suffix,constTargetMachine &TM) const{
129assert(!Suffix.empty());
130
131SmallString<60> NameStr;
132 NameStr += GV->getDataLayout().getPrivateGlobalPrefix();
133TM.getNameWithPrefix(NameStr, GV, *Mang);
134 NameStr.append(Suffix.begin(), Suffix.end());
135returngetContext().getOrCreateSymbol(NameStr);
136}
137
138MCSymbol *TargetLoweringObjectFile::getCFIPersonalitySymbol(
139constGlobalValue *GV,constTargetMachine &TM,
140MachineModuleInfo *MMI) const{
141returnTM.getSymbol(GV);
142}
143
144voidTargetLoweringObjectFile::emitPersonalityValue(
145MCStreamer &Streamer,constDataLayout &,constMCSymbol *Sym,
146constMachineModuleInfo *MMI) const{}
147
148voidTargetLoweringObjectFile::emitCGProfileMetadata(MCStreamer &Streamer,
149Module &M) const{
150MCContext &C =getContext();
151SmallVector<Module::ModuleFlagEntry, 8> ModuleFlags;
152 M.getModuleFlagsMetadata(ModuleFlags);
153
154MDNode *CFGProfile =nullptr;
155
156for (constauto &MFE : ModuleFlags) {
157StringRef Key = MFE.Key->getString();
158if (Key =="CG Profile") {
159 CFGProfile = cast<MDNode>(MFE.Val);
160break;
161 }
162 }
163
164if (!CFGProfile)
165return;
166
167auto GetSym = [this](constMDOperand &MDO) ->MCSymbol * {
168if (!MDO)
169returnnullptr;
170auto *V = cast<ValueAsMetadata>(MDO);
171constFunction *F = cast<Function>(V->getValue()->stripPointerCasts());
172if (F->hasDLLImportStorageClass())
173returnnullptr;
174returnTM->getSymbol(F);
175 };
176
177for (constauto &Edge : CFGProfile->operands()) {
178MDNode *E = cast<MDNode>(Edge);
179constMCSymbol *From = GetSym(E->getOperand(0));
180constMCSymbol *To = GetSym(E->getOperand(1));
181// Skip null functions. This can happen if functions are dead stripped after
182// the CGProfile pass has been run.
183if (!From || !To)
184continue;
185uint64_t Count = cast<ConstantAsMetadata>(E->getOperand(2))
186 ->getValue()
187 ->getUniqueInteger()
188 .getZExtValue();
189 Streamer.emitCGProfileEntry(
190MCSymbolRefExpr::create(From,MCSymbolRefExpr::VK_None,C),
191MCSymbolRefExpr::create(To,MCSymbolRefExpr::VK_None,C), Count);
192 }
193}
194
195/// getKindForGlobal - This is a top-level target-independent classifier for
196/// a global object. Given a global variable and information from the TM, this
197/// function classifies the global in a target independent manner. This function
198/// may be overridden by the target implementation.
199SectionKindTargetLoweringObjectFile::getKindForGlobal(constGlobalObject *GO,
200constTargetMachine &TM){
201assert(!GO->isDeclarationForLinker() &&
202"Can only be used for global definitions");
203
204// Functions are classified as text sections.
205if (isa<Function>(GO))
206returnSectionKind::getText();
207
208// Basic blocks are classified as text sections.
209if (isa<BasicBlock>(GO))
210returnSectionKind::getText();
211
212// Global variables require more detailed analysis.
213constauto *GVar = cast<GlobalVariable>(GO);
214
215// Handle thread-local data first.
216if (GVar->isThreadLocal()) {
217if (isSuitableForBSS(GVar) && !TM.Options.NoZerosInBSS) {
218// Zero-initialized TLS variables with local linkage always get classified
219// as ThreadBSSLocal.
220if (GVar->hasLocalLinkage()) {
221returnSectionKind::getThreadBSSLocal();
222 }
223returnSectionKind::getThreadBSS();
224 }
225returnSectionKind::getThreadData();
226 }
227
228// Variables with common linkage always get classified as common.
229if (GVar->hasCommonLinkage())
230returnSectionKind::getCommon();
231
232// Most non-mergeable zero data can be put in the BSS section unless otherwise
233// specified.
234if (isSuitableForBSS(GVar) && !TM.Options.NoZerosInBSS) {
235if (GVar->hasLocalLinkage())
236returnSectionKind::getBSSLocal();
237elseif (GVar->hasExternalLinkage())
238returnSectionKind::getBSSExtern();
239returnSectionKind::getBSS();
240 }
241
242// Global variables with '!exclude' should get the exclude section kind if
243// they have an explicit section and no other metadata.
244if (GVar->hasSection())
245if (MDNode *MD = GVar->getMetadata(LLVMContext::MD_exclude))
246if (!MD->getNumOperands())
247returnSectionKind::getExclude();
248
249// If the global is marked constant, we can put it into a mergable section,
250// a mergable string section, or general .data if it contains relocations.
251if (GVar->isConstant()) {
252// If the initializer for the global contains something that requires a
253// relocation, then we may have to drop this into a writable data section
254// even though it is marked const.
255constConstant *C = GVar->getInitializer();
256if (!C->needsRelocation()) {
257// If the global is required to have a unique address, it can't be put
258// into a mergable section: just drop it into the general read-only
259// section instead.
260if (!GVar->hasGlobalUnnamedAddr())
261returnSectionKind::getReadOnly();
262
263// If initializer is a null-terminated string, put it in a "cstring"
264// section of the right width.
265if (ArrayType *ATy = dyn_cast<ArrayType>(C->getType())) {
266if (IntegerType *ITy =
267 dyn_cast<IntegerType>(ATy->getElementType())) {
268if ((ITy->getBitWidth() == 8 || ITy->getBitWidth() == 16 ||
269 ITy->getBitWidth() == 32) &&
270IsNullTerminatedString(C)) {
271if (ITy->getBitWidth() == 8)
272returnSectionKind::getMergeable1ByteCString();
273if (ITy->getBitWidth() == 16)
274returnSectionKind::getMergeable2ByteCString();
275
276assert(ITy->getBitWidth() == 32 &&"Unknown width");
277returnSectionKind::getMergeable4ByteCString();
278 }
279 }
280 }
281
282// Otherwise, just drop it into a mergable constant section. If we have
283// a section for this size, use it, otherwise use the arbitrary sized
284// mergable section.
285switch (
286 GVar->getDataLayout().getTypeAllocSize(C->getType())) {
287case 4:returnSectionKind::getMergeableConst4();
288case 8:returnSectionKind::getMergeableConst8();
289case 16:returnSectionKind::getMergeableConst16();
290case 32:returnSectionKind::getMergeableConst32();
291default:
292returnSectionKind::getReadOnly();
293 }
294
295 }else {
296// In static, ROPI and RWPI relocation models, the linker will resolve
297// all addresses, so the relocation entries will actually be constants by
298// the time the app starts up. However, we can't put this into a
299// mergable section, because the linker doesn't take relocations into
300// consideration when it tries to merge entries in the section.
301Reloc::Model ReloModel =TM.getRelocationModel();
302if (ReloModel ==Reloc::Static || ReloModel ==Reloc::ROPI ||
303 ReloModel ==Reloc::RWPI || ReloModel ==Reloc::ROPI_RWPI ||
304 !C->needsDynamicRelocation())
305returnSectionKind::getReadOnly();
306
307// Otherwise, the dynamic linker needs to fix it up, put it in the
308// writable data.rel section.
309returnSectionKind::getReadOnlyWithRel();
310 }
311 }
312
313// Okay, this isn't a constant.
314returnSectionKind::getData();
315}
316
317/// This method computes the appropriate section to emit the specified global
318/// variable or function definition. This should not be passed external (or
319/// available externally) globals.
320MCSection *TargetLoweringObjectFile::SectionForGlobal(
321constGlobalObject *GO,SectionKind Kind,constTargetMachine &TM) const{
322// Select section name.
323if (GO->hasSection())
324returngetExplicitSectionGlobal(GO, Kind,TM);
325
326if (auto *GVar = dyn_cast<GlobalVariable>(GO)) {
327auto Attrs = GVar->getAttributes();
328if ((Attrs.hasAttribute("bss-section") && Kind.isBSS()) ||
329 (Attrs.hasAttribute("data-section") && Kind.isData()) ||
330 (Attrs.hasAttribute("relro-section") && Kind.isReadOnlyWithRel()) ||
331 (Attrs.hasAttribute("rodata-section") && Kind.isReadOnly())) {
332returngetExplicitSectionGlobal(GO, Kind,TM);
333 }
334 }
335
336// Use default section depending on the 'type' of global
337returnSelectSectionForGlobal(GO, Kind,TM);
338}
339
340/// This method computes the appropriate section to emit the specified global
341/// variable or function definition. This should not be passed external (or
342/// available externally) globals.
343MCSection *
344TargetLoweringObjectFile::SectionForGlobal(constGlobalObject *GO,
345constTargetMachine &TM) const{
346returnSectionForGlobal(GO,getKindForGlobal(GO,TM),TM);
347}
348
349MCSection *TargetLoweringObjectFile::getSectionForJumpTable(
350constFunction &F,constTargetMachine &TM) const{
351Align Alignment(1);
352returngetSectionForConstant(F.getDataLayout(),
353SectionKind::getReadOnly(),/*C=*/nullptr,
354 Alignment);
355}
356
357boolTargetLoweringObjectFile::shouldPutJumpTableInFunctionSection(
358bool UsesLabelDifference,constFunction &F) const{
359// In PIC mode, we need to emit the jump table to the same section as the
360// function body itself, otherwise the label differences won't make sense.
361// FIXME: Need a better predicate for this: what about custom entries?
362if (UsesLabelDifference)
363returntrue;
364
365// We should also do if the section name is NULL or function is declared
366// in discardable section
367// FIXME: this isn't the right predicate, should be based on the MCSection
368// for the function.
369returnF.isWeakForLinker();
370}
371
372/// Given a mergable constant with the specified size and relocation
373/// information, return a section that it should be placed in.
374MCSection *TargetLoweringObjectFile::getSectionForConstant(
375constDataLayout &DL,SectionKind Kind,constConstant *C,
376Align &Alignment) const{
377if (Kind.isReadOnly() &&ReadOnlySection !=nullptr)
378returnReadOnlySection;
379
380returnDataSection;
381}
382
383MCSection *TargetLoweringObjectFile::getSectionForMachineBasicBlock(
384constFunction &F,constMachineBasicBlock &MBB,
385constTargetMachine &TM) const{
386returnnullptr;
387}
388
389MCSection *TargetLoweringObjectFile::getUniqueSectionForFunction(
390constFunction &F,constTargetMachine &TM) const{
391returnnullptr;
392}
393
394/// getTTypeGlobalReference - Return an MCExpr to use for a
395/// reference to the specified global variable from exception
396/// handling information.
397constMCExpr *TargetLoweringObjectFile::getTTypeGlobalReference(
398constGlobalValue *GV,unsigned Encoding,constTargetMachine &TM,
399MachineModuleInfo *MMI,MCStreamer &Streamer) const{
400constMCSymbolRefExpr *Ref =
401MCSymbolRefExpr::create(TM.getSymbol(GV),getContext());
402
403returngetTTypeReference(Ref, Encoding, Streamer);
404}
405
406constMCExpr *TargetLoweringObjectFile::
407getTTypeReference(constMCSymbolRefExpr *Sym,unsigned Encoding,
408MCStreamer &Streamer) const{
409switch (Encoding & 0x70) {
410default:
411report_fatal_error("We do not support this DWARF encoding yet!");
412casedwarf::DW_EH_PE_absptr:
413// Do nothing special
414returnSym;
415casedwarf::DW_EH_PE_pcrel: {
416// Emit a label to the streamer for the current position. This gives us
417// .-foo addressing.
418MCSymbol *PCSym =getContext().createTempSymbol();
419 Streamer.emitLabel(PCSym);
420constMCExpr *PC =MCSymbolRefExpr::create(PCSym,getContext());
421returnMCBinaryExpr::createSub(Sym, PC,getContext());
422 }
423 }
424}
425
426constMCExpr *TargetLoweringObjectFile::getDebugThreadLocalSymbol(constMCSymbol *Sym) const{
427// FIXME: It's not clear what, if any, default this should have - perhaps a
428// null return could mean 'no location' & we should just do that here.
429returnMCSymbolRefExpr::create(Sym,getContext());
430}
431
432voidTargetLoweringObjectFile::getNameWithPrefix(
433SmallVectorImpl<char> &OutName,constGlobalValue *GV,
434constTargetMachine &TM) const{
435 Mang->getNameWithPrefix(OutName, GV,/*CannotUsePrivateLabel=*/false);
436}
MBB
MachineBasicBlock & MBB
Definition:ARMSLSHardening.cpp:71
DL
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Definition:ARMSLSHardening.cpp:73
From
BlockVerifier::State From
Definition:BlockVerifier.cpp:57
Constants.h
This file contains the declarations for the subclasses of Constant, which represent the different fla...
DataLayout.h
DerivedTypes.h
Dwarf.h
This file contains constants used for implementing Dwarf debug support.
Sym
Symbol * Sym
Definition:ELF_riscv.cpp:479
GlobalVariable.h
Function.h
Module.h
Module.h This file contains the declarations for the Module class.
MCAsmInfo.h
MCContext.h
MCExpr.h
MCStreamer.h
F
#define F(x, y, z)
Definition:MD5.cpp:55
Mangler.h
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
SectionKind.h
isNullOrUndef
static bool isNullOrUndef(const Constant *C)
Definition:TargetLoweringObjectFile.cpp:68
IsNullTerminatedString
static bool IsNullTerminatedString(const Constant *C)
IsNullTerminatedString - Return true if the specified constant (which is known to have a type that is...
Definition:TargetLoweringObjectFile.cpp:104
isSuitableForBSS
static bool isSuitableForBSS(const GlobalVariable *GV)
Definition:TargetLoweringObjectFile.cpp:81
TargetLoweringObjectFile.h
TargetOptions.h
llvm::ArrayType
Class to represent array types.
Definition:DerivedTypes.h:395
llvm::ConstantDataSequential
ConstantDataSequential - A vector or array constant whose element type is a simple 1/2/4/8-byte integ...
Definition:Constants.h:587
llvm::Constant
This is an important base class in LLVM.
Definition:Constant.h:42
llvm::DataLayout
A parsed version of the target data layout string in and methods for querying it.
Definition:DataLayout.h:63
llvm::DataLayout::getPrivateGlobalPrefix
StringRef getPrivateGlobalPrefix() const
Definition:DataLayout.h:285
llvm::Function
Definition:Function.h:63
llvm::GlobalObject
Definition:GlobalObject.h:27
llvm::GlobalObject::hasSection
bool hasSection() const
Check if this global has a custom object file section.
Definition:GlobalObject.h:109
llvm::GlobalValue
Definition:GlobalValue.h:48
llvm::GlobalValue::isDeclarationForLinker
bool isDeclarationForLinker() const
Definition:GlobalValue.h:619
llvm::GlobalValue::getDataLayout
const DataLayout & getDataLayout() const
Get the data layout of the module this global belongs to.
Definition:Globals.cpp:130
llvm::GlobalVariable
Definition:GlobalVariable.h:39
llvm::GlobalVariable::getInitializer
const Constant * getInitializer() const
getInitializer - Return the initializer for this global variable.
Definition:GlobalVariable.h:150
llvm::GlobalVariable::isConstant
bool isConstant() const
If the value is a global constant, its value is immutable throughout the runtime execution of the pro...
Definition:GlobalVariable.h:173
llvm::IntegerType
Class to represent integer types.
Definition:DerivedTypes.h:42
llvm::MCBinaryExpr::createSub
static const MCBinaryExpr * createSub(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
Definition:MCExpr.h:622
llvm::MCContext
Context object for machine code objects.
Definition:MCContext.h:83
llvm::MCContext::createTempSymbol
MCSymbol * createTempSymbol()
Create a temporary symbol with a unique name.
Definition:MCContext.cpp:345
llvm::MCContext::getOrCreateSymbol
MCSymbol * getOrCreateSymbol(const Twine &Name)
Lookup the symbol inside with the specified Name.
Definition:MCContext.cpp:212
llvm::MCExpr
Base class for the full range of assembler expressions which are needed for parsing.
Definition:MCExpr.h:34
llvm::MCObjectFileInfo::initMCObjectFileInfo
void initMCObjectFileInfo(MCContext &MCCtx, bool PIC, bool LargeCodeModel=false)
Definition:MCObjectFileInfo.cpp:1011
llvm::MCObjectFileInfo::ReadOnlySection
MCSection * ReadOnlySection
Section that is readonly and can contain arbitrary initialized data.
Definition:MCObjectFileInfo.h:65
llvm::MCObjectFileInfo::getContext
MCContext & getContext() const
Definition:MCObjectFileInfo.h:252
llvm::MCObjectFileInfo::DataSection
MCSection * DataSection
Section directive for standard data.
Definition:MCObjectFileInfo.h:56
llvm::MCSection
Instances of this class represent a uniqued identifier for a section in the current translation unit.
Definition:MCSection.h:36
llvm::MCStreamer
Streaming machine code generation interface.
Definition:MCStreamer.h:213
llvm::MCStreamer::emitLabel
virtual void emitLabel(MCSymbol *Symbol, SMLoc Loc=SMLoc())
Emit a label for Symbol into the current section.
Definition:MCStreamer.cpp:420
llvm::MCStreamer::emitCGProfileEntry
virtual void emitCGProfileEntry(const MCSymbolRefExpr *From, const MCSymbolRefExpr *To, uint64_t Count)
Definition:MCStreamer.cpp:853
llvm::MCSymbolRefExpr
Represent a reference to a symbol from inside an expression.
Definition:MCExpr.h:192
llvm::MCSymbolRefExpr::VK_None
@ VK_None
Definition:MCExpr.h:195
llvm::MCSymbolRefExpr::create
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
Definition:MCExpr.h:398
llvm::MCSymbol
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition:MCSymbol.h:41
llvm::MDNode
Metadata node.
Definition:Metadata.h:1073
llvm::MDNode::getOperand
const MDOperand & getOperand(unsigned I) const
Definition:Metadata.h:1434
llvm::MDNode::operands
ArrayRef< MDOperand > operands() const
Definition:Metadata.h:1432
llvm::MDOperand
Tracking metadata reference owned by Metadata.
Definition:Metadata.h:895
llvm::MachineBasicBlock
Definition:MachineBasicBlock.h:125
llvm::MachineModuleInfo
This class contains meta information specific to a module.
Definition:MachineModuleInfo.h:82
llvm::Mangler
Definition:Mangler.h:28
llvm::Mangler::getNameWithPrefix
void getNameWithPrefix(raw_ostream &OS, const GlobalValue *GV, bool CannotUsePrivateLabel) const
Print the appropriate prefix and the specified global variable's name.
Definition:Mangler.cpp:121
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition:Module.h:65
llvm::SectionKind
SectionKind - This is a simple POD value that classifies the properties of a section.
Definition:SectionKind.h:22
llvm::SectionKind::getThreadData
static SectionKind getThreadData()
Definition:SectionKind.h:207
llvm::SectionKind::getBSSExtern
static SectionKind getBSSExtern()
Definition:SectionKind.h:211
llvm::SectionKind::getMergeable2ByteCString
static SectionKind getMergeable2ByteCString()
Definition:SectionKind.h:196
llvm::SectionKind::getExclude
static SectionKind getExclude()
Definition:SectionKind.h:189
llvm::SectionKind::getBSSLocal
static SectionKind getBSSLocal()
Definition:SectionKind.h:210
llvm::SectionKind::getMergeableConst4
static SectionKind getMergeableConst4()
Definition:SectionKind.h:202
llvm::SectionKind::getCommon
static SectionKind getCommon()
Definition:SectionKind.h:212
llvm::SectionKind::getText
static SectionKind getText()
Definition:SectionKind.h:190
llvm::SectionKind::getThreadBSSLocal
static SectionKind getThreadBSSLocal()
Definition:SectionKind.h:208
llvm::SectionKind::getReadOnlyWithRel
static SectionKind getReadOnlyWithRel()
Definition:SectionKind.h:214
llvm::SectionKind::getData
static SectionKind getData()
Definition:SectionKind.h:213
llvm::SectionKind::getMergeableConst8
static SectionKind getMergeableConst8()
Definition:SectionKind.h:203
llvm::SectionKind::getBSS
static SectionKind getBSS()
Definition:SectionKind.h:209
llvm::SectionKind::getThreadBSS
static SectionKind getThreadBSS()
Definition:SectionKind.h:206
llvm::SectionKind::getMergeableConst16
static SectionKind getMergeableConst16()
Definition:SectionKind.h:204
llvm::SectionKind::getMergeable4ByteCString
static SectionKind getMergeable4ByteCString()
Definition:SectionKind.h:199
llvm::SectionKind::getMergeable1ByteCString
static SectionKind getMergeable1ByteCString()
Definition:SectionKind.h:193
llvm::SectionKind::getReadOnly
static SectionKind getReadOnly()
Definition:SectionKind.h:192
llvm::SectionKind::getMergeableConst32
static SectionKind getMergeableConst32()
Definition:SectionKind.h:205
llvm::SmallString
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
Definition:SmallString.h:26
llvm::SmallString::append
void append(StringRef RHS)
Append from a StringRef.
Definition:SmallString.h:68
llvm::SmallVectorImpl
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition:SmallVector.h:573
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition:SmallVector.h:1196
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition:StringRef.h:51
llvm::StringRef::empty
constexpr bool empty() const
empty - Check if the string is empty.
Definition:StringRef.h:147
llvm::StringRef::begin
iterator begin() const
Definition:StringRef.h:116
llvm::StringRef::end
iterator end() const
Definition:StringRef.h:118
llvm::TargetLoweringObjectFile::emitCGProfileMetadata
void emitCGProfileMetadata(MCStreamer &Streamer, Module &M) const
Emit Call Graph Profile metadata.
Definition:TargetLoweringObjectFile.cpp:148
llvm::TargetLoweringObjectFile::getNameWithPrefix
virtual void getNameWithPrefix(SmallVectorImpl< char > &OutName, const GlobalValue *GV, const TargetMachine &TM) const
Definition:TargetLoweringObjectFile.cpp:432
llvm::TargetLoweringObjectFile::PersonalityEncoding
unsigned PersonalityEncoding
PersonalityEncoding, LSDAEncoding, TTypeEncoding - Some encoding values for EH.
Definition:TargetLoweringObjectFile.h:57
llvm::TargetLoweringObjectFile::getCallSiteEncoding
unsigned getCallSiteEncoding() const
Definition:TargetLoweringObjectFile.cpp:59
llvm::TargetLoweringObjectFile::getKindForGlobal
static SectionKind getKindForGlobal(const GlobalObject *GO, const TargetMachine &TM)
Classify the specified global variable into a set of target independent categories embodied in Sectio...
Definition:TargetLoweringObjectFile.cpp:199
llvm::TargetLoweringObjectFile::getSectionForJumpTable
virtual MCSection * getSectionForJumpTable(const Function &F, const TargetMachine &TM) const
Definition:TargetLoweringObjectFile.cpp:349
llvm::TargetLoweringObjectFile::shouldPutJumpTableInFunctionSection
virtual bool shouldPutJumpTableInFunctionSection(bool UsesLabelDifference, const Function &F) const
Definition:TargetLoweringObjectFile.cpp:357
llvm::TargetLoweringObjectFile::TM
const TargetMachine * TM
Definition:TargetLoweringObjectFile.h:68
llvm::TargetLoweringObjectFile::getCFIPersonalitySymbol
virtual MCSymbol * getCFIPersonalitySymbol(const GlobalValue *GV, const TargetMachine &TM, MachineModuleInfo *MMI) const
Definition:TargetLoweringObjectFile.cpp:138
llvm::TargetLoweringObjectFile::LSDAEncoding
unsigned LSDAEncoding
Definition:TargetLoweringObjectFile.h:58
llvm::TargetLoweringObjectFile::Initialize
virtual void Initialize(MCContext &ctx, const TargetMachine &TM)
This method must be called before any actual lowering is done.
Definition:TargetLoweringObjectFile.cpp:40
llvm::TargetLoweringObjectFile::SelectSectionForGlobal
virtual MCSection * SelectSectionForGlobal(const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const =0
llvm::TargetLoweringObjectFile::getSectionForConstant
virtual MCSection * getSectionForConstant(const DataLayout &DL, SectionKind Kind, const Constant *C, Align &Alignment) const
Given a constant with the SectionKind, return a section that it should be placed in.
Definition:TargetLoweringObjectFile.cpp:374
llvm::TargetLoweringObjectFile::getSymbolWithGlobalValueBase
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...
Definition:TargetLoweringObjectFile.cpp:127
llvm::TargetLoweringObjectFile::getSectionForMachineBasicBlock
virtual MCSection * getSectionForMachineBasicBlock(const Function &F, const MachineBasicBlock &MBB, const TargetMachine &TM) const
Definition:TargetLoweringObjectFile.cpp:383
llvm::TargetLoweringObjectFile::~TargetLoweringObjectFile
virtual ~TargetLoweringObjectFile()
Definition:TargetLoweringObjectFile.cpp:55
llvm::TargetLoweringObjectFile::getDebugThreadLocalSymbol
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.
Definition:TargetLoweringObjectFile.cpp:426
llvm::TargetLoweringObjectFile::getTTypeGlobalReference
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...
Definition:TargetLoweringObjectFile.cpp:397
llvm::TargetLoweringObjectFile::TTypeEncoding
unsigned TTypeEncoding
Definition:TargetLoweringObjectFile.h:59
llvm::TargetLoweringObjectFile::CallSiteEncoding
unsigned CallSiteEncoding
Definition:TargetLoweringObjectFile.h:60
llvm::TargetLoweringObjectFile::getExplicitSectionGlobal
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...
llvm::TargetLoweringObjectFile::getTTypeReference
const MCExpr * getTTypeReference(const MCSymbolRefExpr *Sym, unsigned Encoding, MCStreamer &Streamer) const
Definition:TargetLoweringObjectFile.cpp:407
llvm::TargetLoweringObjectFile::emitPersonalityValue
virtual void emitPersonalityValue(MCStreamer &Streamer, const DataLayout &TM, const MCSymbol *Sym, const MachineModuleInfo *MMI) const
Definition:TargetLoweringObjectFile.cpp:144
llvm::TargetLoweringObjectFile::getUniqueSectionForFunction
virtual MCSection * getUniqueSectionForFunction(const Function &F, const TargetMachine &TM) const
Definition:TargetLoweringObjectFile.cpp:389
llvm::TargetLoweringObjectFile::SectionForGlobal
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...
Definition:TargetLoweringObjectFile.cpp:320
llvm::TargetMachine
Primary interface to the complete machine description for the target machine.
Definition:TargetMachine.h:77
llvm::TargetMachine::isPositionIndependent
bool isPositionIndependent() const
Definition:TargetMachine.cpp:117
llvm::TargetMachine::getRelocationModel
Reloc::Model getRelocationModel() const
Returns the code generation relocation model.
Definition:TargetMachine.cpp:144
llvm::TargetMachine::Options
TargetOptions Options
Definition:TargetMachine.h:118
llvm::TargetMachine::getSymbol
MCSymbol * getSymbol(const GlobalValue *GV) const
Definition:TargetMachine.cpp:283
llvm::TargetMachine::getCodeModel
CodeModel::Model getCodeModel() const
Returns the code model.
Definition:TargetMachine.h:232
llvm::TargetMachine::getNameWithPrefix
void getNameWithPrefix(SmallVectorImpl< char > &Name, const GlobalValue *GV, Mangler &Mang, bool MayAlwaysUsePrivate=false) const
Definition:TargetMachine.cpp:270
llvm::TargetOptions::NoZerosInBSS
unsigned NoZerosInBSS
NoZerosInBSS - By default some codegens place zero-initialized data to .bss section.
Definition:TargetOptions.h:226
uint64_t
ErrorHandling.h
TargetMachine.h
llvm::CallingConv::C
@ C
The default llvm calling convention, compatible with C.
Definition:CallingConv.h:34
llvm::CodeModel::Large
@ Large
Definition:CodeGen.h:31
llvm::Reloc::Model
Model
Definition:CodeGen.h:25
llvm::Reloc::Static
@ Static
Definition:CodeGen.h:25
llvm::Reloc::RWPI
@ RWPI
Definition:CodeGen.h:25
llvm::Reloc::ROPI
@ ROPI
Definition:CodeGen.h:25
llvm::Reloc::ROPI_RWPI
@ ROPI_RWPI
Definition:CodeGen.h:25
llvm::dwarf::DW_EH_PE_pcrel
@ DW_EH_PE_pcrel
Definition:Dwarf.h:858
llvm::dwarf::DW_EH_PE_absptr
@ DW_EH_PE_absptr
Definition:Dwarf.h:847
llvm::dwarf::DW_EH_PE_udata4
@ DW_EH_PE_udata4
Definition:Dwarf.h:851
llvm::dwarf::DW_EH_PE_uleb128
@ DW_EH_PE_uleb128
Definition:Dwarf.h:849
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition:AddressRanges.h:18
llvm::report_fatal_error
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
Definition:Error.cpp:167
llvm::ModRefInfo::Ref
@ Ref
The access may reference the value stored in memory.
llvm::Align
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition:Alignment.h:39

Generated on Fri Jul 18 2025 14:42:53 for LLVM by doxygen 1.9.6
[8]ページ先頭

©2009-2025 Movatter.jp