LLVM  13.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/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/MCSymbol.h"
28 #include "llvm/MC/SectionKind.h"
33 using 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  // `Initialize` can be called more than once.
45  delete Mang;
46  Mang = new Mangler();
49 
50  // Reset various EH DWARF encodings.
53 
54  this->TM = &TM;
55 }
56 
58  delete Mang;
59 }
60 
62  // If target does not have LEB128 directives, we would need the
63  // call site encoding to be udata4 so that the alternative path
64  // for not having LEB128 directives could work.
65  if (!getContext().getAsmInfo()->hasLEB128Directives())
67  return CallSiteEncoding;
68 }
69 
70 static bool isNullOrUndef(const Constant *C) {
71  // Check that the constant isn't all zeros or undefs.
72  if (C->isNullValue() || isa<UndefValue>(C))
73  return true;
74  if (!isa<ConstantAggregate>(C))
75  return false;
76  for (auto Operand : C->operand_values()) {
77  if (!isNullOrUndef(cast<Constant>(Operand)))
78  return false;
79  }
80  return true;
81 }
82 
83 static bool isSuitableForBSS(const GlobalVariable *GV) {
84  const Constant *C = GV->getInitializer();
85 
86  // Must have zero initializer.
87  if (!isNullOrUndef(C))
88  return false;
89 
90  // Leave constant zeros in readonly constant sections, so they can be shared.
91  if (GV->isConstant())
92  return false;
93 
94  // If the global has an explicit section specified, don't put it in BSS.
95  if (GV->hasSection())
96  return false;
97 
98  // Otherwise, put it in BSS!
99  return true;
100 }
101 
102 /// IsNullTerminatedString - Return true if the specified constant (which is
103 /// known to have a type that is an array of 1/2/4 byte elements) ends with a
104 /// nul value and contains no other nuls in it. Note that this is more general
105 /// than ConstantDataSequential::isString because we allow 2 & 4 byte strings.
106 static bool IsNullTerminatedString(const Constant *C) {
107  // First check: is we have constant array terminated with zero
108  if (const ConstantDataSequential *CDS = dyn_cast<ConstantDataSequential>(C)) {
109  unsigned NumElts = CDS->getNumElements();
110  assert(NumElts != 0 && "Can't have an empty CDS");
111 
112  if (CDS->getElementAsInteger(NumElts-1) != 0)
113  return false; // Not null terminated.
114 
115  // Verify that the null doesn't occur anywhere else in the string.
116  for (unsigned i = 0; i != NumElts-1; ++i)
117  if (CDS->getElementAsInteger(i) == 0)
118  return false;
119  return true;
120  }
121 
122  // Another possibility: [1 x i8] zeroinitializer
123  if (isa<ConstantAggregateZero>(C))
124  return cast<ArrayType>(C->getType())->getNumElements() == 1;
125 
126  return false;
127 }
128 
130  const GlobalValue *GV, StringRef Suffix, const TargetMachine &TM) const {
131  assert(!Suffix.empty());
132 
133  SmallString<60> NameStr;
134  NameStr += GV->getParent()->getDataLayout().getPrivateGlobalPrefix();
135  TM.getNameWithPrefix(NameStr, GV, *Mang);
136  NameStr.append(Suffix.begin(), Suffix.end());
137  return getContext().getOrCreateSymbol(NameStr);
138 }
139 
141  const GlobalValue *GV, const TargetMachine &TM,
142  MachineModuleInfo *MMI) const {
143  return TM.getSymbol(GV);
144 }
145 
147  const DataLayout &,
148  const MCSymbol *Sym) const {
149 }
150 
152  Module &M) const {
153  MCContext &C = getContext();
155  M.getModuleFlagsMetadata(ModuleFlags);
156 
157  MDNode *CFGProfile = nullptr;
158 
159  for (const auto &MFE : ModuleFlags) {
160  StringRef Key = MFE.Key->getString();
161  if (Key == "CG Profile") {
162  CFGProfile = cast<MDNode>(MFE.Val);
163  break;
164  }
165  }
166 
167  if (!CFGProfile)
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 : CFGProfile->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(
195  }
196 }
197 
198 /// getKindForGlobal - This is a top-level target-independent classifier for
199 /// a global object. Given a global variable and information from the TM, this
200 /// function classifies the global in a target independent manner. This function
201 /// may be overridden by the target implementation.
203  const TargetMachine &TM){
205  "Can only be used for global definitions");
206 
207  // Functions are classified as text sections.
208  if (isa<Function>(GO))
209  return SectionKind::getText();
210 
211  // Basic blocks are classified as text sections.
212  if (isa<BasicBlock>(GO))
213  return SectionKind::getText();
214 
215  // Global variables require more detailed analysis.
216  const auto *GVar = cast<GlobalVariable>(GO);
217 
218  // Handle thread-local data first.
219  if (GVar->isThreadLocal()) {
220  if (isSuitableForBSS(GVar) && !TM.Options.NoZerosInBSS) {
221  // Zero-initialized TLS variables with local linkage always get classified
222  // as ThreadBSSLocal.
223  if (GVar->hasLocalLinkage()) {
225  }
226  return SectionKind::getThreadBSS();
227  }
229  }
230 
231  // Variables with common linkage always get classified as common.
232  if (GVar->hasCommonLinkage())
233  return SectionKind::getCommon();
234 
235  // Most non-mergeable zero data can be put in the BSS section unless otherwise
236  // specified.
237  if (isSuitableForBSS(GVar) && !TM.Options.NoZerosInBSS) {
238  if (GVar->hasLocalLinkage())
239  return SectionKind::getBSSLocal();
240  else if (GVar->hasExternalLinkage())
241  return SectionKind::getBSSExtern();
242  return SectionKind::getBSS();
243  }
244 
245  // If the global is marked constant, we can put it into a mergable section,
246  // a mergable string section, or general .data if it contains relocations.
247  if (GVar->isConstant()) {
248  // If the initializer for the global contains something that requires a
249  // relocation, then we may have to drop this into a writable data section
250  // even though it is marked const.
251  const Constant *C = GVar->getInitializer();
252  if (!C->needsRelocation()) {
253  // If the global is required to have a unique address, it can't be put
254  // into a mergable section: just drop it into the general read-only
255  // section instead.
256  if (!GVar->hasGlobalUnnamedAddr())
257  return SectionKind::getReadOnly();
258 
259  // If initializer is a null-terminated string, put it in a "cstring"
260  // section of the right width.
261  if (ArrayType *ATy = dyn_cast<ArrayType>(C->getType())) {
262  if (IntegerType *ITy =
263  dyn_cast<IntegerType>(ATy->getElementType())) {
264  if ((ITy->getBitWidth() == 8 || ITy->getBitWidth() == 16 ||
265  ITy->getBitWidth() == 32) &&
267  if (ITy->getBitWidth() == 8)
269  if (ITy->getBitWidth() == 16)
271 
272  assert(ITy->getBitWidth() == 32 && "Unknown width");
274  }
275  }
276  }
277 
278  // Otherwise, just drop it into a mergable constant section. If we have
279  // a section for this size, use it, otherwise use the arbitrary sized
280  // mergable section.
281  switch (
282  GVar->getParent()->getDataLayout().getTypeAllocSize(C->getType())) {
283  case 4: return SectionKind::getMergeableConst4();
284  case 8: return SectionKind::getMergeableConst8();
285  case 16: return SectionKind::getMergeableConst16();
286  case 32: return SectionKind::getMergeableConst32();
287  default:
288  return SectionKind::getReadOnly();
289  }
290 
291  } else {
292  // In static, ROPI and RWPI relocation models, the linker will resolve
293  // all addresses, so the relocation entries will actually be constants by
294  // the time the app starts up. However, we can't put this into a
295  // mergable section, because the linker doesn't take relocations into
296  // consideration when it tries to merge entries in the section.
297  Reloc::Model ReloModel = TM.getRelocationModel();
298  if (ReloModel == Reloc::Static || ReloModel == Reloc::ROPI ||
299  ReloModel == Reloc::RWPI || ReloModel == Reloc::ROPI_RWPI ||
300  !C->needsDynamicRelocation())
301  return SectionKind::getReadOnly();
302 
303  // Otherwise, the dynamic linker needs to fix it up, put it in the
304  // writable data.rel section.
306  }
307  }
308 
309  // Okay, this isn't a constant.
310  return SectionKind::getData();
311 }
312 
313 /// This method computes the appropriate section to emit the specified global
314 /// variable or function definition. This should not be passed external (or
315 /// available externally) globals.
317  const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const {
318  // Select section name.
319  if (GO->hasSection())
320  return getExplicitSectionGlobal(GO, Kind, TM);
321 
322  if (auto *GVar = dyn_cast<GlobalVariable>(GO)) {
323  auto Attrs = GVar->getAttributes();
324  if ((Attrs.hasAttribute("bss-section") && Kind.isBSS()) ||
325  (Attrs.hasAttribute("data-section") && Kind.isData()) ||
326  (Attrs.hasAttribute("relro-section") && Kind.isReadOnlyWithRel()) ||
327  (Attrs.hasAttribute("rodata-section") && Kind.isReadOnly())) {
328  return getExplicitSectionGlobal(GO, Kind, TM);
329  }
330  }
331 
332  if (auto *F = dyn_cast<Function>(GO)) {
333  if (F->hasFnAttribute("implicit-section-name"))
334  return getExplicitSectionGlobal(GO, Kind, TM);
335  }
336 
337  // Use default section depending on the 'type' of global
338  return SelectSectionForGlobal(GO, Kind, TM);
339 }
340 
341 /// This method computes the appropriate section to emit the specified global
342 /// variable or function definition. This should not be passed external (or
343 /// available externally) globals.
344 MCSection *
346  const TargetMachine &TM) const {
347  return SectionForGlobal(GO, getKindForGlobal(GO, TM), TM);
348 }
349 
351  const Function &F, const TargetMachine &TM) const {
352  Align Alignment(1);
353  return getSectionForConstant(F.getParent()->getDataLayout(),
354  SectionKind::getReadOnly(), /*C=*/nullptr,
355  Alignment);
356 }
357 
359  bool UsesLabelDifference, const Function &F) const {
360  // In PIC mode, we need to emit the jump table to the same section as the
361  // function body itself, otherwise the label differences won't make sense.
362  // FIXME: Need a better predicate for this: what about custom entries?
363  if (UsesLabelDifference)
364  return true;
365 
366  // We should also do if the section name is NULL or function is declared
367  // in discardable section
368  // FIXME: this isn't the right predicate, should be based on the MCSection
369  // for the function.
370  return F.isWeakForLinker();
371 }
372 
373 /// Given a mergable constant with the specified size and relocation
374 /// information, return a section that it should be placed in.
376  const DataLayout &DL, SectionKind Kind, const Constant *C,
377  Align &Alignment) const {
378  if (Kind.isReadOnly() && ReadOnlySection != nullptr)
379  return ReadOnlySection;
380 
381  return DataSection;
382 }
383 
385  const Function &F, const MachineBasicBlock &MBB,
386  const TargetMachine &TM) const {
387  return nullptr;
388 }
389 
391  const Function &F, const TargetMachine &TM) const {
392  return nullptr;
393 }
394 
395 /// getTTypeGlobalReference - Return an MCExpr to use for a
396 /// reference to the specified global variable from exception
397 /// handling information.
399  const GlobalValue *GV, unsigned Encoding, const TargetMachine &TM,
400  MachineModuleInfo *MMI, MCStreamer &Streamer) const {
401  const MCSymbolRefExpr *Ref =
403 
404  return getTTypeReference(Ref, Encoding, Streamer);
405 }
406 
408 getTTypeReference(const MCSymbolRefExpr *Sym, unsigned Encoding,
409  MCStreamer &Streamer) const {
410  switch (Encoding & 0x70) {
411  default:
412  report_fatal_error("We do not support this DWARF encoding yet!");
414  // Do nothing special
415  return Sym;
416  case dwarf::DW_EH_PE_pcrel: {
417  // Emit a label to the streamer for the current position. This gives us
418  // .-foo addressing.
419  MCSymbol *PCSym = getContext().createTempSymbol();
420  Streamer.emitLabel(PCSym);
421  const MCExpr *PC = MCSymbolRefExpr::create(PCSym, getContext());
422  return MCBinaryExpr::createSub(Sym, PC, getContext());
423  }
424  }
425 }
426 
428  // FIXME: It's not clear what, if any, default this should have - perhaps a
429  // null return could mean 'no location' & we should just do that here.
430  return MCSymbolRefExpr::create(Sym, getContext());
431 }
432 
434  SmallVectorImpl<char> &OutName, const GlobalValue *GV,
435  const TargetMachine &TM) const {
436  Mang->getNameWithPrefix(OutName, GV, /*CannotUsePrivateLabel=*/false);
437 }
i
i
Definition: README.txt:29
isSuitableForBSS
static bool isSuitableForBSS(const GlobalVariable *GV)
Definition: TargetLoweringObjectFile.cpp:83
Attrs
Function Attrs
Definition: README_ALTIVEC.txt:215
llvm::SectionKind::getReadOnlyWithRel
static SectionKind getReadOnlyWithRel()
Definition: SectionKind.h:207
llvm::SectionKind::getMergeable2ByteCString
static SectionKind getMergeable2ByteCString()
Definition: SectionKind.h:189
llvm
Definition: AllocatorList.h:23
llvm::SectionKind::getBSSExtern
static SectionKind getBSSExtern()
Definition: SectionKind.h:204
llvm::MCSymbol
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:41
M
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
Definition: README.txt:252
llvm::StringRef::empty
LLVM_NODISCARD bool empty() const
empty - Check if the string is empty.
Definition: StringRef.h:156
llvm::SystemZISD::TM
@ TM
Definition: SystemZISelLowering.h:65
llvm::DataLayout
A parsed version of the target data layout string in and methods for querying it.
Definition: DataLayout.h:112
llvm::TargetOptions::NoZerosInBSS
unsigned NoZerosInBSS
NoZerosInBSS - By default some codegens place zero-initialized data to .bss section.
Definition: TargetOptions.h:199
llvm::TargetLoweringObjectFile::getNameWithPrefix
virtual void getNameWithPrefix(SmallVectorImpl< char > &OutName, const GlobalValue *GV, const TargetMachine &TM) const
Definition: TargetLoweringObjectFile.cpp:433
llvm::MCObjectFileInfo::ReadOnlySection
MCSection * ReadOnlySection
Section that is readonly and can contain arbitrary initialized data.
Definition: MCObjectFileInfo.h:67
llvm::MCContext
Context object for machine code objects.
Definition: MCContext.h:71
llvm::Function
Definition: Function.h:61
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:129
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1168
llvm::SectionKind::getThreadBSSLocal
static SectionKind getThreadBSSLocal()
Definition: SectionKind.h:201
ErrorHandling.h
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:316
llvm::GlobalVariable
Definition: GlobalVariable.h:40
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:427
llvm::TargetMachine::getRelocationModel
Reloc::Model getRelocationModel() const
Returns the code generation relocation model.
Definition: TargetMachine.cpp:70
Module.h
llvm::SectionKind::getMergeableConst16
static SectionKind getMergeableConst16()
Definition: SectionKind.h:197
llvm::Reloc::ROPI_RWPI
@ ROPI_RWPI
Definition: CodeGen.h:22
llvm::ArrayType
Class to represent array types.
Definition: DerivedTypes.h:359
llvm::Mangler
Definition: Mangler.h:27
llvm::MCObjectFileInfo::getContext
MCContext & getContext() const
Definition: MCObjectFileInfo.h:232
llvm::TargetLoweringObjectFile::CallSiteEncoding
unsigned CallSiteEncoding
Definition: TargetLoweringObjectFile.h:58
F
#define F(x, y, z)
Definition: MD5.cpp:56
llvm::MDNode::operands
op_range operands() const
Definition: Metadata.h:1100
llvm::Reloc::Model
Model
Definition: CodeGen.h:22
llvm::SectionKind::getReadOnly
static SectionKind getReadOnly()
Definition: SectionKind.h:185
llvm::MCStreamer
Streaming machine code generation interface.
Definition: MCStreamer.h:197
llvm::SectionKind::getBSSLocal
static SectionKind getBSSLocal()
Definition: SectionKind.h:203
llvm::MCContext::getOrCreateSymbol
MCSymbol * getOrCreateSymbol(const Twine &Name)
Lookup the symbol inside with the specified Name.
Definition: MCContext.cpp:187
llvm::SectionKind::getThreadBSS
static SectionKind getThreadBSS()
Definition: SectionKind.h:199
llvm::ConstantDataSequential
ConstantDataSequential - A vector or array constant whose element type is a simple 1/2/4/8-byte integ...
Definition: Constants.h:568
TargetMachine.h
llvm::ModRefInfo::Ref
@ Ref
The access may reference the value stored in memory.
Constants.h
E
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
C
(vector float) vec_cmpeq(*A, *B) C
Definition: README_ALTIVEC.txt:86
llvm::GlobalObject
Definition: GlobalObject.h:28
MCContext.h
llvm::MCStreamer::emitLabel
virtual void emitLabel(MCSymbol *Symbol, SMLoc Loc=SMLoc())
Emit a label for Symbol into the current section.
Definition: MCStreamer.cpp:413
MCSymbol.h
llvm::AMDGPU::PALMD::Key
Key
PAL metadata keys.
Definition: AMDGPUMetadata.h:481
llvm::SectionKind::getBSS
static SectionKind getBSS()
Definition: SectionKind.h:202
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:114
llvm::IntegerType
Class to represent integer types.
Definition: DerivedTypes.h:40
llvm::MachineModuleInfo
This class contains meta information specific to a module.
Definition: MachineModuleInfo.h:78
llvm::report_fatal_error
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
Definition: Error.cpp:140
llvm::TargetLoweringObjectFile::emitCGProfileMetadata
void emitCGProfileMetadata(MCStreamer &Streamer, Module &M) const
Emit Call Graph Profile metadata.
Definition: TargetLoweringObjectFile.cpp:151
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:42
llvm::TargetMachine::getSymbol
MCSymbol * getSymbol(const GlobalValue *GV) const
Definition: TargetMachine.cpp:219
llvm::SectionKind::getText
static SectionKind getText()
Definition: SectionKind.h:183
llvm::Align
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition: Alignment.h:39
llvm::TargetLoweringObjectFile::getSectionForJumpTable
virtual MCSection * getSectionForJumpTable(const Function &F, const TargetMachine &TM) const
Definition: TargetLoweringObjectFile.cpp:350
llvm::lltok::Kind
Kind
Definition: LLToken.h:18
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:202
llvm::MachineBasicBlock
Definition: MachineBasicBlock.h:95
llvm::SmallString
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
Definition: SmallString.h:25
llvm::TargetMachine::isPositionIndependent
bool isPositionIndependent() const
Definition: TargetMachine.cpp:44
llvm::TargetLoweringObjectFile::emitPersonalityValue
virtual void emitPersonalityValue(MCStreamer &Streamer, const DataLayout &TM, const MCSymbol *Sym) const
Definition: TargetLoweringObjectFile.cpp:146
llvm::dwarf::DW_EH_PE_udata4
@ DW_EH_PE_udata4
Definition: Dwarf.h:436
llvm::MCStreamer::emitCGProfileEntry
virtual void emitCGProfileEntry(const MCSymbolRefExpr *From, const MCSymbolRefExpr *To, uint64_t Count)
Definition: MCStreamer.cpp:782
llvm::TargetLoweringObjectFile::TM
const TargetMachine * TM
Definition: TargetLoweringObjectFile.h:66
llvm::Function::getAttributes
AttributeList getAttributes() const
Return the attribute list for this Function.
Definition: Function.h:249
llvm::TargetLoweringObjectFile::getCallSiteEncoding
unsigned getCallSiteEncoding() const
Definition: TargetLoweringObjectFile.cpp:61
llvm::SmallString::append
void append(StringRef RHS)
Append from a StringRef.
Definition: SmallString.h:67
llvm::SectionKind::getCommon
static SectionKind getCommon()
Definition: SectionKind.h:205
llvm::GlobalObject::hasSection
bool hasSection() const
Check if this global has a custom object file section.
Definition: GlobalObject.h:104
llvm::SectionKind::getMergeable1ByteCString
static SectionKind getMergeable1ByteCString()
Definition: SectionKind.h:186
llvm::GlobalValue
Definition: GlobalValue.h:44
llvm::GlobalVariable::getInitializer
const Constant * getInitializer() const
getInitializer - Return the initializer for this global variable.
Definition: GlobalVariable.h:136
llvm::Constant
This is an important base class in LLVM.
Definition: Constant.h:41
llvm::TargetLoweringObjectFile::SelectSectionForGlobal
virtual MCSection * SelectSectionForGlobal(const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const =0
llvm::dwarf::DW_EH_PE_pcrel
@ DW_EH_PE_pcrel
Definition: Dwarf.h:443
llvm::StringRef::end
iterator end() const
Definition: StringRef.h:133
llvm::GlobalValue::getParent
Module * getParent()
Get the module that this global value is contained inside of...
Definition: GlobalValue.h:572
llvm::SectionKind::getMergeable4ByteCString
static SectionKind getMergeable4ByteCString()
Definition: SectionKind.h:192
llvm::TargetMachine::Options
TargetOptions Options
Definition: TargetMachine.h:115
llvm::TargetLoweringObjectFile::getTTypeReference
const MCExpr * getTTypeReference(const MCSymbolRefExpr *Sym, unsigned Encoding, MCStreamer &Streamer) const
Definition: TargetLoweringObjectFile.cpp:408
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::TargetMachine
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:77
llvm::MCBinaryExpr::createSub
static const MCBinaryExpr * createSub(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
Definition: MCExpr.h:608
llvm::Function::hasAttribute
bool hasAttribute(unsigned i, Attribute::AttrKind Kind) const
check if an attributes is in the list of attributes.
Definition: Function.h:444
llvm::Reloc::ROPI
@ ROPI
Definition: CodeGen.h:22
llvm::SectionKind::getThreadData
static SectionKind getThreadData()
Definition: SectionKind.h:200
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:67
llvm::MDNode
Metadata node.
Definition: Metadata.h:897
llvm::MCSymbolRefExpr
Represent a reference to a symbol from inside an expression.
Definition: MCExpr.h:192
llvm::MCObjectFileInfo::initMCObjectFileInfo
void initMCObjectFileInfo(MCContext &MCCtx, bool PIC, bool LargeCodeModel=false)
Definition: MCObjectFileInfo.cpp:962
llvm::TargetLoweringObjectFile::shouldPutJumpTableInFunctionSection
virtual bool shouldPutJumpTableInFunctionSection(bool UsesLabelDifference, const Function &F) const
Definition: TargetLoweringObjectFile.cpp:358
Mangler.h
llvm::TargetLoweringObjectFile::~TargetLoweringObjectFile
virtual ~TargetLoweringObjectFile()
Definition: TargetLoweringObjectFile.cpp:57
TargetOptions.h
llvm::Reloc::RWPI
@ RWPI
Definition: CodeGen.h:22
llvm::dwarf::DW_EH_PE_uleb128
@ DW_EH_PE_uleb128
Definition: Dwarf.h:434
MCAsmInfo.h
DataLayout.h
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:57
Dwarf.h
TargetLoweringObjectFile.h
llvm::Reloc::Static
@ Static
Definition: CodeGen.h:22
DL
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Definition: AArch64SLSHardening.cpp:76
llvm::MCSection
Instances of this class represent a uniqued identifier for a section in the current translation unit.
Definition: MCSection.h:39
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:106
llvm::TargetLoweringObjectFile::getSectionForMachineBasicBlock
virtual MCSection * getSectionForMachineBasicBlock(const Function &F, const MachineBasicBlock &MBB, const TargetMachine &TM) const
Definition: TargetLoweringObjectFile.cpp:384
llvm::MCContext::createTempSymbol
MCSymbol * createTempSymbol()
Create a temporary symbol with a unique name.
Definition: MCContext.cpp:297
llvm::TargetLoweringObjectFile::PersonalityEncoding
unsigned PersonalityEncoding
PersonalityEncoding, LSDAEncoding, TTypeEncoding - Some encoding values for EH.
Definition: TargetLoweringObjectFile.h:55
llvm::TargetLoweringObjectFile::getUniqueSectionForFunction
virtual MCSection * getUniqueSectionForFunction(const Function &F, const TargetMachine &TM) const
Definition: TargetLoweringObjectFile.cpp:390
llvm::SectionKind::getData
static SectionKind getData()
Definition: SectionKind.h:206
MBB
MachineBasicBlock & MBB
Definition: AArch64SLSHardening.cpp:74
llvm::dwarf::DW_EH_PE_absptr
@ DW_EH_PE_absptr
Definition: Dwarf.h:432
llvm::SectionKind::getMergeableConst8
static SectionKind getMergeableConst8()
Definition: SectionKind.h:196
llvm::SectionKind
SectionKind - This is a simple POD value that classifies the properties of a section.
Definition: SectionKind.h:22
llvm::TargetMachine::getNameWithPrefix
void getNameWithPrefix(SmallVectorImpl< char > &Name, const GlobalValue *GV, Mangler &Mang, bool MayAlwaysUsePrivate=false) const
Definition: TargetMachine.cpp:206
llvm::MCObjectFileInfo::DataSection
MCSection * DataSection
Section directive for standard data.
Definition: MCObjectFileInfo.h:58
llvm::DataLayout::getPrivateGlobalPrefix
StringRef getPrivateGlobalPrefix() const
Definition: DataLayout.h:330
GlobalVariable.h
isNullOrUndef
static bool isNullOrUndef(const Constant *C)
Definition: TargetLoweringObjectFile.cpp:70
Function.h
llvm::TargetMachine::getCodeModel
CodeModel::Model getCodeModel() const
Returns the code model.
Definition: TargetMachine.cpp:74
llvm::MCSymbolRefExpr::create
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
Definition: MCExpr.h:384
SectionKind.h
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:375
llvm::CodeModel::Large
@ Large
Definition: CodeGen.h:28
llvm::TargetLoweringObjectFile::LSDAEncoding
unsigned LSDAEncoding
Definition: TargetLoweringObjectFile.h:56
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:153
llvm::SectionKind::getMergeableConst4
static SectionKind getMergeableConst4()
Definition: SectionKind.h:195
MCStreamer.h
llvm::TargetLoweringObjectFile::getCFIPersonalitySymbol
virtual MCSymbol * getCFIPersonalitySymbol(const GlobalValue *GV, const TargetMachine &TM, MachineModuleInfo *MMI) const
Definition: TargetLoweringObjectFile.cpp:140
llvm::GlobalValue::isDeclarationForLinker
bool isDeclarationForLinker() const
Definition: GlobalValue.h:534
llvm::SmallVectorImpl< char >
llvm::Module::getDataLayout
const DataLayout & getDataLayout() const
Get the data layout for the module's target platform.
Definition: Module.cpp:397
DerivedTypes.h
llvm::TargetLoweringObjectFile::TTypeEncoding
unsigned TTypeEncoding
Definition: TargetLoweringObjectFile.h:57
llvm::MCSymbolRefExpr::VK_None
@ VK_None
Definition: MCExpr.h:195
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...
From
BlockVerifier::State From
Definition: BlockVerifier.cpp:55
llvm::SectionKind::getMergeableConst32
static SectionKind getMergeableConst32()
Definition: SectionKind.h:198
raw_ostream.h
llvm::StringRef::begin
iterator begin() const
Definition: StringRef.h:131
MCExpr.h
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:398
llvm::MCExpr
Base class for the full range of assembler expressions which are needed for parsing.
Definition: MCExpr.h:35
llvm::MDOperand
Tracking metadata reference owned by Metadata.
Definition: Metadata.h:744