LLVM  14.0.0git
HexagonTargetObjectFile.cpp
Go to the documentation of this file.
1 //===-- HexagonTargetObjectFile.cpp ---------------------------------------===//
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 contains the declarations of the HexagonTargetAsmInfo properties.
10 //
11 //===----------------------------------------------------------------------===//
12 
14 #include "llvm/ADT/SmallString.h"
15 #include "llvm/ADT/StringRef.h"
16 #include "llvm/ADT/Twine.h"
17 #include "llvm/BinaryFormat/ELF.h"
18 #include "llvm/IR/DataLayout.h"
19 #include "llvm/IR/DerivedTypes.h"
20 #include "llvm/IR/GlobalObject.h"
21 #include "llvm/IR/GlobalValue.h"
22 #include "llvm/IR/GlobalVariable.h"
23 #include "llvm/IR/Module.h"
24 #include "llvm/IR/Type.h"
25 #include "llvm/MC/MCContext.h"
26 #include "llvm/MC/SectionKind.h"
27 #include "llvm/Support/Casting.h"
29 #include "llvm/Support/Debug.h"
32 
33 #define DEBUG_TYPE "hexagon-sdata"
34 
35 using namespace llvm;
36 
37 static cl::opt<unsigned> SmallDataThreshold("hexagon-small-data-threshold",
38  cl::init(8), cl::Hidden,
39  cl::desc("The maximum size of an object in the sdata section"));
40 
41 static cl::opt<bool> NoSmallDataSorting("mno-sort-sda", cl::init(false),
42  cl::Hidden, cl::desc("Disable small data sections sorting"));
43 
44 static cl::opt<bool> StaticsInSData("hexagon-statics-in-small-data",
46  cl::desc("Allow static variables in .sdata"));
47 
48 static cl::opt<bool> TraceGVPlacement("trace-gv-placement",
49  cl::Hidden, cl::init(false),
50  cl::desc("Trace global value placement"));
51 
52 static cl::opt<bool>
53  EmitJtInText("hexagon-emit-jt-text", cl::Hidden, cl::init(false),
54  cl::desc("Emit hexagon jump tables in function section"));
55 
56 static cl::opt<bool>
57  EmitLutInText("hexagon-emit-lut-text", cl::Hidden, cl::init(false),
58  cl::desc("Emit hexagon lookup tables in function section"));
59 
60 // TraceGVPlacement controls messages for all builds. For builds with assertions
61 // (debug or release), messages are also controlled by the usual debug flags
62 // (e.g. -debug and -debug-only=globallayout)
63 #define TRACE_TO(s, X) s << X
64 #ifdef NDEBUG
65 #define TRACE(X) \
66  do { \
67  if (TraceGVPlacement) { \
68  TRACE_TO(errs(), X); \
69  } \
70  } while (false)
71 #else
72 #define TRACE(X) \
73  do { \
74  if (TraceGVPlacement) { \
75  TRACE_TO(errs(), X); \
76  } else { \
77  LLVM_DEBUG(TRACE_TO(dbgs(), X)); \
78  } \
79  } while (false)
80 #endif
81 
82 // Returns true if the section name is such that the symbol will be put
83 // in a small data section.
84 // For instance, global variables with section attributes such as ".sdata"
85 // ".sdata.*", ".sbss", and ".sbss.*" will go into small data.
86 static bool isSmallDataSection(StringRef Sec) {
87  // sectionName is either ".sdata" or ".sbss". Looking for an exact match
88  // obviates the need for checks for section names such as ".sdatafoo".
89  if (Sec.equals(".sdata") || Sec.equals(".sbss") || Sec.equals(".scommon"))
90  return true;
91  // If either ".sdata." or ".sbss." is a substring of the section name
92  // then put the symbol in small data.
93  return Sec.contains(".sdata.") || Sec.contains(".sbss.") ||
94  Sec.contains(".scommon.");
95 }
96 
97 static const char *getSectionSuffixForSize(unsigned Size) {
98  switch (Size) {
99  default:
100  return "";
101  case 1:
102  return ".1";
103  case 2:
104  return ".2";
105  case 4:
106  return ".4";
107  case 8:
108  return ".8";
109  }
110 }
111 
113  const TargetMachine &TM) {
115 
116  SmallDataSection =
120  SmallBSSSection =
124 }
125 
127  const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const {
128  TRACE("[SelectSectionForGlobal] GO(" << GO->getName() << ") ");
129  TRACE("input section(" << GO->getSection() << ") ");
130 
131  TRACE((GO->hasPrivateLinkage() ? "private_linkage " : "")
132  << (GO->hasLocalLinkage() ? "local_linkage " : "")
133  << (GO->hasInternalLinkage() ? "internal " : "")
134  << (GO->hasExternalLinkage() ? "external " : "")
135  << (GO->hasCommonLinkage() ? "common_linkage " : "")
136  << (GO->hasCommonLinkage() ? "common " : "" )
137  << (Kind.isCommon() ? "kind_common " : "" )
138  << (Kind.isBSS() ? "kind_bss " : "" )
139  << (Kind.isBSSLocal() ? "kind_bss_local " : "" ));
140 
141  // If the lookup table is used by more than one function, do not place
142  // it in text section.
143  if (EmitLutInText && GO->getName().startswith("switch.table")) {
144  if (const Function *Fn = getLutUsedFunction(GO))
145  return selectSectionForLookupTable(GO, TM, Fn);
146  }
147 
148  if (isGlobalInSmallSection(GO, TM))
149  return selectSmallSectionForGlobal(GO, Kind, TM);
150 
151  if (Kind.isCommon()) {
152  // This is purely for LTO+Linker Script because commons don't really have a
153  // section. However, the BitcodeSectionWriter pass will query for the
154  // sections of commons (and the linker expects us to know their section) so
155  // we'll return one here.
156  return BSSSection;
157  }
158 
159  TRACE("default_ELF_section\n");
160  // Otherwise, we work the same as ELF.
162 }
163 
165  const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const {
166  TRACE("[getExplicitSectionGlobal] GO(" << GO->getName() << ") from("
167  << GO->getSection() << ") ");
168  TRACE((GO->hasPrivateLinkage() ? "private_linkage " : "")
169  << (GO->hasLocalLinkage() ? "local_linkage " : "")
170  << (GO->hasInternalLinkage() ? "internal " : "")
171  << (GO->hasExternalLinkage() ? "external " : "")
172  << (GO->hasCommonLinkage() ? "common_linkage " : "")
173  << (GO->hasCommonLinkage() ? "common " : "" )
174  << (Kind.isCommon() ? "kind_common " : "" )
175  << (Kind.isBSS() ? "kind_bss " : "" )
176  << (Kind.isBSSLocal() ? "kind_bss_local " : "" ));
177 
178  if (GO->hasSection()) {
179  StringRef Section = GO->getSection();
180  if (Section.contains(".access.text.group"))
183  if (Section.contains(".access.data.group"))
186  }
187 
188  if (isGlobalInSmallSection(GO, TM))
189  return selectSmallSectionForGlobal(GO, Kind, TM);
190 
191  // Otherwise, we work the same as ELF.
192  TRACE("default_ELF_section\n");
194 }
195 
196 /// Return true if this global value should be placed into small data/bss
197 /// section.
199  const TargetMachine &TM) const {
200  bool HaveSData = isSmallDataEnabled(TM);
201  if (!HaveSData)
202  LLVM_DEBUG(dbgs() << "Small-data allocation is disabled, but symbols "
203  "may have explicit section assignments...\n");
204  // Only global variables, not functions.
205  LLVM_DEBUG(dbgs() << "Checking if value is in small-data, -G"
206  << SmallDataThreshold << ": \"" << GO->getName() << "\": ");
207  const GlobalVariable *GVar = dyn_cast<GlobalVariable>(GO);
208  if (!GVar) {
209  LLVM_DEBUG(dbgs() << "no, not a global variable\n");
210  return false;
211  }
212 
213  // Globals with external linkage that have an original section set must be
214  // emitted to that section, regardless of whether we would put them into
215  // small data or not. This is how we can support mixing -G0/-G8 in LTO.
216  if (GVar->hasSection()) {
217  bool IsSmall = isSmallDataSection(GVar->getSection());
218  LLVM_DEBUG(dbgs() << (IsSmall ? "yes" : "no")
219  << ", has section: " << GVar->getSection() << '\n');
220  return IsSmall;
221  }
222 
223  // If sdata is disabled, stop the checks here.
224  if (!HaveSData) {
225  LLVM_DEBUG(dbgs() << "no, small-data allocation is disabled\n");
226  return false;
227  }
228 
229  if (GVar->isConstant()) {
230  LLVM_DEBUG(dbgs() << "no, is a constant\n");
231  return false;
232  }
233 
234  bool IsLocal = GVar->hasLocalLinkage();
235  if (!StaticsInSData && IsLocal) {
236  LLVM_DEBUG(dbgs() << "no, is static\n");
237  return false;
238  }
239 
240  Type *GType = GVar->getValueType();
241  if (isa<ArrayType>(GType)) {
242  LLVM_DEBUG(dbgs() << "no, is an array\n");
243  return false;
244  }
245 
246  // If the type is a struct with no body provided, treat is conservatively.
247  // There cannot be actual definitions of object of such a type in this CU
248  // (only references), so assuming that they are not in sdata is safe. If
249  // these objects end up in the sdata, the references will still be valid.
250  if (StructType *ST = dyn_cast<StructType>(GType)) {
251  if (ST->isOpaque()) {
252  LLVM_DEBUG(dbgs() << "no, has opaque type\n");
253  return false;
254  }
255  }
256 
257  unsigned Size = GVar->getParent()->getDataLayout().getTypeAllocSize(GType);
258  if (Size == 0) {
259  LLVM_DEBUG(dbgs() << "no, has size 0\n");
260  return false;
261  }
262  if (Size > SmallDataThreshold) {
263  LLVM_DEBUG(dbgs() << "no, size exceeds sdata threshold: " << Size << '\n');
264  return false;
265  }
266 
267  LLVM_DEBUG(dbgs() << "yes\n");
268  return true;
269 }
270 
272  const {
274 }
275 
277  return SmallDataThreshold;
278 }
279 
281  bool UsesLabelDifference, const Function &F) const {
282  return EmitJtInText;
283 }
284 
285 /// Descends any type down to "elementary" components,
286 /// discovering the smallest addressable one.
287 /// If zero is returned, declaration will not be modified.
288 unsigned HexagonTargetObjectFile::getSmallestAddressableSize(const Type *Ty,
289  const GlobalValue *GV, const TargetMachine &TM) const {
290  // Assign the smallest element access size to the highest
291  // value which assembler can handle.
292  unsigned SmallestElement = 8;
293 
294  if (!Ty)
295  return 0;
296  switch (Ty->getTypeID()) {
297  case Type::StructTyID: {
298  const StructType *STy = cast<const StructType>(Ty);
299  for (auto &E : STy->elements()) {
300  unsigned AtomicSize = getSmallestAddressableSize(E, GV, TM);
301  if (AtomicSize < SmallestElement)
302  SmallestElement = AtomicSize;
303  }
304  return (STy->getNumElements() == 0) ? 0 : SmallestElement;
305  }
306  case Type::ArrayTyID: {
307  const ArrayType *ATy = cast<const ArrayType>(Ty);
308  return getSmallestAddressableSize(ATy->getElementType(), GV, TM);
309  }
312  const VectorType *PTy = cast<const VectorType>(Ty);
313  return getSmallestAddressableSize(PTy->getElementType(), GV, TM);
314  }
315  case Type::PointerTyID:
316  case Type::HalfTyID:
317  case Type::FloatTyID:
318  case Type::DoubleTyID:
319  case Type::IntegerTyID: {
320  const DataLayout &DL = GV->getParent()->getDataLayout();
321  // It is unfortunate that DL's function take non-const Type*.
322  return DL.getTypeAllocSize(const_cast<Type*>(Ty));
323  }
324  case Type::FunctionTyID:
325  case Type::VoidTyID:
326  case Type::BFloatTyID:
327  case Type::X86_FP80TyID:
328  case Type::FP128TyID:
329  case Type::PPC_FP128TyID:
330  case Type::LabelTyID:
331  case Type::MetadataTyID:
332  case Type::X86_MMXTyID:
333  case Type::X86_AMXTyID:
334  case Type::TokenTyID:
335  return 0;
336  }
337 
338  return 0;
339 }
340 
341 MCSection *HexagonTargetObjectFile::selectSmallSectionForGlobal(
342  const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const {
343  const Type *GTy = GO->getValueType();
344  unsigned Size = getSmallestAddressableSize(GTy, GO, TM);
345 
346  // If we have -ffunction-section or -fdata-section then we should emit the
347  // global value to a unique section specifically for it... even for sdata.
348  bool EmitUniquedSection = TM.getDataSections();
349 
350  TRACE("Small data. Size(" << Size << ")");
351  // Handle Small Section classification here.
352  if (Kind.isBSS() || Kind.isBSSLocal()) {
353  // If -mno-sort-sda is not set, find out smallest accessible entity in
354  // declaration and add it to the section name string.
355  // Note. It does not track the actual usage of the value, only its de-
356  // claration. Also, compiler adds explicit pad fields to some struct
357  // declarations - they are currently counted towards smallest addres-
358  // sable entity.
359  if (NoSmallDataSorting) {
360  TRACE(" default sbss\n");
361  return SmallBSSSection;
362  }
363 
364  StringRef Prefix(".sbss");
367 
368  if (EmitUniquedSection) {
369  Name.append(".");
370  Name.append(GO->getName());
371  }
372  TRACE(" unique sbss(" << Name << ")\n");
375  }
376 
377  if (Kind.isCommon()) {
378  // This is purely for LTO+Linker Script because commons don't really have a
379  // section. However, the BitcodeSectionWriter pass will query for the
380  // sections of commons (and the linker expects us to know their section) so
381  // we'll return one here.
382  if (NoSmallDataSorting)
383  return BSSSection;
384 
385  Twine Name = Twine(".scommon") + getSectionSuffixForSize(Size);
386  TRACE(" small COMMON (" << Name << ")\n");
387 
391  }
392 
393  // We could have changed sdata object to a constant... in this
394  // case the Kind could be wrong for it.
395  if (Kind.isMergeableConst()) {
396  TRACE(" const_object_as_data ");
397  const GlobalVariable *GVar = dyn_cast<GlobalVariable>(GO);
398  if (GVar->hasSection() && isSmallDataSection(GVar->getSection()))
400  }
401 
402  if (Kind.isData()) {
403  if (NoSmallDataSorting) {
404  TRACE(" default sdata\n");
405  return SmallDataSection;
406  }
407 
408  StringRef Prefix(".sdata");
411 
412  if (EmitUniquedSection) {
413  Name.append(".");
414  Name.append(GO->getName());
415  }
416  TRACE(" unique sdata(" << Name << ")\n");
419  }
420 
421  TRACE("default ELF section\n");
422  // Otherwise, we work the same as ELF.
424 }
425 
426 // Return the function that uses the lookup table. If there are more
427 // than one live function that uses this look table, bail out and place
428 // the lookup table in default section.
429 const Function *
431  const Function *ReturnFn = nullptr;
432  for (auto U : GO->users()) {
433  // validate each instance of user to be a live function.
434  auto *I = dyn_cast<Instruction>(U);
435  if (!I)
436  continue;
437  auto *Bb = I->getParent();
438  if (!Bb)
439  continue;
440  auto *UserFn = Bb->getParent();
441  if (!ReturnFn)
442  ReturnFn = UserFn;
443  else if (ReturnFn != UserFn)
444  return nullptr;
445  }
446  return ReturnFn;
447 }
448 
449 MCSection *HexagonTargetObjectFile::selectSectionForLookupTable(
450  const GlobalObject *GO, const TargetMachine &TM, const Function *Fn) const {
451 
453  // If the function has explicit section, place the lookup table in this
454  // explicit section.
455  if (Fn->hasSection())
456  return getExplicitSectionGlobal(Fn, Kind, TM);
457 
458  const auto *FuncObj = dyn_cast<GlobalObject>(Fn);
459  return SelectSectionForGlobal(FuncObj, Kind, TM);
460 }
llvm::Check::Size
@ Size
Definition: FileCheck.h:73
llvm::Type::ArrayTyID
@ ArrayTyID
Arrays.
Definition: Type.h:75
llvm::StringRef::startswith
LLVM_NODISCARD bool startswith(StringRef Prefix) const
Check if this string starts with the given Prefix.
Definition: StringRef.h:285
llvm::Type::FloatTyID
@ FloatTyID
32-bit floating point type
Definition: Type.h:58
llvm::Type::DoubleTyID
@ DoubleTyID
64-bit floating point type
Definition: Type.h:59
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AllocatorList.h:23
llvm::GlobalValue::hasCommonLinkage
bool hasCommonLinkage() const
Definition: GlobalValue.h:455
llvm::DataLayout
A parsed version of the target data layout string in and methods for querying it.
Definition: DataLayout.h:113
llvm::TargetLoweringObjectFileELF::SelectSectionForGlobal
MCSection * SelectSectionForGlobal(const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const override
Definition: TargetLoweringObjectFileImpl.cpp:874
llvm::GlobalValue::hasExternalLinkage
bool hasExternalLinkage() const
Definition: GlobalValue.h:434
llvm::cl::Prefix
@ Prefix
Definition: CommandLine.h:164
getSectionSuffixForSize
static const char * getSectionSuffixForSize(unsigned Size)
Definition: HexagonTargetObjectFile.cpp:97
llvm::MCContext
Context object for machine code objects.
Definition: MCContext.h:72
llvm::Function
Definition: Function.h:62
llvm::Type::VoidTyID
@ VoidTyID
type with no size
Definition: Type.h:63
StringRef.h
llvm::GlobalObject::getSection
StringRef getSection() const
Get the custom section of this global if it has one.
Definition: GlobalObject.h:112
llvm::TargetLoweringObjectFileELF::getExplicitSectionGlobal
MCSection * getExplicitSectionGlobal(const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const override
Targets should implement this method to assign a section to globals with an explicit section specfied...
Definition: TargetLoweringObjectFileImpl.cpp:806
llvm::GlobalVariable
Definition: GlobalVariable.h:40
llvm::Type::X86_AMXTyID
@ X86_AMXTyID
AMX vectors (8192 bits, X86 specific)
Definition: Type.h:67
llvm::Type::getTypeID
TypeID getTypeID() const
Return the type id for the type.
Definition: Type.h:135
llvm::cl::Hidden
@ Hidden
Definition: CommandLine.h:143
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
Module.h
llvm::HexagonTargetObjectFile::isGlobalInSmallSection
bool isGlobalInSmallSection(const GlobalObject *GO, const TargetMachine &TM) const
Return true if this global value should be placed into small data/bss section.
Definition: HexagonTargetObjectFile.cpp:198
EmitJtInText
static cl::opt< bool > EmitJtInText("hexagon-emit-jt-text", cl::Hidden, cl::init(false), cl::desc("Emit hexagon jump tables in function section"))
GlobalObject.h
llvm::VectorType::getElementType
Type * getElementType() const
Definition: DerivedTypes.h:422
llvm::ArrayType
Class to represent array types.
Definition: DerivedTypes.h:357
llvm::MCObjectFileInfo::getContext
MCContext & getContext() const
Definition: MCObjectFileInfo.h:235
llvm::ELF::SHF_EXECINSTR
@ SHF_EXECINSTR
Definition: ELF.h:997
LLVM_DEBUG
#define LLVM_DEBUG(X)
Definition: Debug.h:101
F
#define F(x, y, z)
Definition: MD5.cpp:56
TRACE
#define TRACE(X)
Definition: HexagonTargetObjectFile.cpp:72
llvm::dbgs
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition: Debug.cpp:163
llvm::ARMBuildAttrs::Section
@ Section
Legacy Tags.
Definition: ARMBuildAttributes.h:78
CommandLine.h
llvm::Type::MetadataTyID
@ MetadataTyID
Metadata.
Definition: Type.h:65
NoSmallDataSorting
static cl::opt< bool > NoSmallDataSorting("mno-sort-sda", cl::init(false), cl::Hidden, cl::desc("Disable small data sections sorting"))
GlobalValue.h
ELF.h
llvm::Type::FunctionTyID
@ FunctionTyID
Functions.
Definition: Type.h:72
TargetMachine.h
SmallString.h
E
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
Twine.h
llvm::GlobalObject
Definition: GlobalObject.h:28
MCContext.h
llvm::GlobalValue::hasPrivateLinkage
bool hasPrivateLinkage() const
Definition: GlobalValue.h:450
llvm::MCContext::getELFSection
MCSectionELF * getELFSection(const Twine &Section, unsigned Type, unsigned Flags)
Definition: MCContext.h:540
llvm::HexagonTargetObjectFile::Initialize
void Initialize(MCContext &Ctx, const TargetMachine &TM) override
This method must be called before any actual lowering is done.
Definition: HexagonTargetObjectFile.cpp:112
llvm::StringRef::contains
LLVM_NODISCARD bool contains(StringRef Other) const
Return true if the given string is a substring of *this, and false otherwise.
Definition: StringRef.h:461
llvm::HexagonTargetObjectFile::getSmallDataSize
unsigned getSmallDataSize() const
Definition: HexagonTargetObjectFile.cpp:276
llvm::GlobalValue::hasInternalLinkage
bool hasInternalLinkage() const
Definition: GlobalValue.h:449
llvm::Type::PointerTyID
@ PointerTyID
Pointers.
Definition: Type.h:73
llvm::SectionKind::getText
static SectionKind getText()
Definition: SectionKind.h:183
llvm::Type::BFloatTyID
@ BFloatTyID
16-bit floating point type (7-bit significand)
Definition: Type.h:57
llvm::lltok::Kind
Kind
Definition: LLToken.h:18
Type.h
isSmallDataSection
static bool isSmallDataSection(StringRef Sec)
Definition: HexagonTargetObjectFile.cpp:86
llvm::StringRef::equals
LLVM_NODISCARD bool equals(StringRef RHS) const
equals - Check for string equality, this is more efficient than compare() when the relative ordering ...
Definition: StringRef.h:186
llvm::SmallString< 128 >
llvm::TargetMachine::isPositionIndependent
bool isPositionIndependent() const
Definition: TargetMachine.cpp:44
llvm::HexagonTargetObjectFile::shouldPutJumpTableInFunctionSection
bool shouldPutJumpTableInFunctionSection(bool UsesLabelDifference, const Function &F) const override
Definition: HexagonTargetObjectFile.cpp:280
llvm::TargetLoweringObjectFile::TM
const TargetMachine * TM
Definition: TargetLoweringObjectFile.h:67
llvm::cl::ZeroOrMore
@ ZeroOrMore
Definition: CommandLine.h:120
llvm::VectorType
Base class of all SIMD vector types.
Definition: DerivedTypes.h:389
llvm::cl::opt
Definition: CommandLine.h:1432
llvm::GlobalObject::hasSection
bool hasSection() const
Check if this global has a custom object file section.
Definition: GlobalObject.h:104
llvm::GlobalValue
Definition: GlobalValue.h:44
llvm::GlobalValue::getParent
Module * getParent()
Get the module that this global value is contained inside of...
Definition: GlobalValue.h:578
llvm::Type::X86_MMXTyID
@ X86_MMXTyID
MMX vectors (64 bits, X86 specific)
Definition: Type.h:66
llvm::ARM_MB::ST
@ ST
Definition: ARMBaseInfo.h:73
llvm::ELF::SHT_PROGBITS
@ SHT_PROGBITS
Definition: ELF.h:916
llvm::ELF::SHF_ALLOC
@ SHF_ALLOC
Definition: ELF.h:994
I
#define I(x, y, z)
Definition: MD5.cpp:59
llvm::cl::init
initializer< Ty > init(const Ty &Val)
Definition: CommandLine.h:441
llvm::TargetMachine
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:80
llvm::GlobalValue::hasLocalLinkage
bool hasLocalLinkage() const
Definition: GlobalValue.h:451
llvm::Type::FP128TyID
@ FP128TyID
128-bit floating point type (112-bit significand)
Definition: Type.h:61
TraceGVPlacement
static cl::opt< bool > TraceGVPlacement("trace-gv-placement", cl::Hidden, cl::init(false), cl::desc("Trace global value placement"))
DataLayout.h
llvm::StructType
Class to represent struct types.
Definition: DerivedTypes.h:213
llvm::Type::PPC_FP128TyID
@ PPC_FP128TyID
128-bit floating point type (two 64-bits, PowerPC)
Definition: Type.h:62
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:57
DL
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Definition: AArch64SLSHardening.cpp:76
EmitLutInText
static cl::opt< bool > EmitLutInText("hexagon-emit-lut-text", cl::Hidden, cl::init(false), cl::desc("Emit hexagon lookup tables in function section"))
llvm::MCSection
Instances of this class represent a uniqued identifier for a section in the current translation unit.
Definition: MCSection.h:39
HexagonTargetObjectFile.h
llvm::Value::getName
StringRef getName() const
Return a constant reference to the value's name.
Definition: Value.cpp:309
SmallDataThreshold
static cl::opt< unsigned > SmallDataThreshold("hexagon-small-data-threshold", cl::init(8), cl::Hidden, cl::desc("The maximum size of an object in the sdata section"))
llvm::StructType::getNumElements
unsigned getNumElements() const
Random access to the elements.
Definition: DerivedTypes.h:327
llvm::HexagonTargetObjectFile::getExplicitSectionGlobal
MCSection * getExplicitSectionGlobal(const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const override
Targets should implement this method to assign a section to globals with an explicit section specfied...
Definition: HexagonTargetObjectFile.cpp:164
llvm::Type::IntegerTyID
@ IntegerTyID
Arbitrary bit width integers.
Definition: Type.h:71
llvm::SectionKind::getData
static SectionKind getData()
Definition: SectionKind.h:206
llvm::Twine
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:83
llvm::HexagonTargetObjectFile::isSmallDataEnabled
bool isSmallDataEnabled(const TargetMachine &TM) const
Definition: HexagonTargetObjectFile.cpp:271
llvm::SectionKind
SectionKind - This is a simple POD value that classifies the properties of a section.
Definition: SectionKind.h:22
llvm::GraphProgram::Name
Name
Definition: GraphWriter.h:52
StaticsInSData
static cl::opt< bool > StaticsInSData("hexagon-statics-in-small-data", cl::init(false), cl::Hidden, cl::ZeroOrMore, cl::desc("Allow static variables in .sdata"))
llvm::StructType::elements
ArrayRef< Type * > elements() const
Definition: DerivedTypes.h:319
llvm::Type::FixedVectorTyID
@ FixedVectorTyID
Fixed width SIMD vector type.
Definition: Type.h:76
GlobalVariable.h
Casting.h
llvm::Type::TokenTyID
@ TokenTyID
Tokens.
Definition: Type.h:68
llvm::TargetLoweringObjectFileELF::Initialize
void Initialize(MCContext &Ctx, const TargetMachine &TM) override
This method must be called before any actual lowering is done.
Definition: TargetLoweringObjectFileImpl.cpp:116
SectionKind.h
llvm::Type::LabelTyID
@ LabelTyID
Labels.
Definition: Type.h:64
llvm::Type::StructTyID
@ StructTyID
Structures.
Definition: Type.h:74
llvm::HexagonTargetObjectFile::getLutUsedFunction
const Function * getLutUsedFunction(const GlobalObject *GO) const
Definition: HexagonTargetObjectFile.cpp:430
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::MCObjectFileInfo::BSSSection
MCSection * BSSSection
Section that is default initialized to zero.
Definition: MCObjectFileInfo.h:61
llvm::Type::ScalableVectorTyID
@ ScalableVectorTyID
Scalable SIMD vector type.
Definition: Type.h:77
llvm::Module::getDataLayout
const DataLayout & getDataLayout() const
Get the data layout for the module's target platform.
Definition: Module.cpp:401
DerivedTypes.h
llvm::GlobalValue::getValueType
Type * getValueType() const
Definition: GlobalValue.h:273
TM
const char LLVMTargetMachineRef TM
Definition: PassBuilderBindings.cpp:47
llvm::ELF::SHF_WRITE
@ SHF_WRITE
Definition: ELF.h:991
llvm::ELF::SHF_HEX_GPREL
@ SHF_HEX_GPREL
Definition: ELF.h:1058
llvm::HexagonTargetObjectFile::SelectSectionForGlobal
MCSection * SelectSectionForGlobal(const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const override
Definition: HexagonTargetObjectFile.cpp:126
llvm::cl::desc
Definition: CommandLine.h:412
raw_ostream.h
llvm::ELF::SHT_NOBITS
@ SHT_NOBITS
Definition: ELF.h:923
Debug.h
llvm::Type::HalfTyID
@ HalfTyID
16-bit floating point type
Definition: Type.h:56
llvm::Value::users
iterator_range< user_iterator > users()
Definition: Value.h:421
llvm::Type::X86_FP80TyID
@ X86_FP80TyID
80-bit floating point type (X87)
Definition: Type.h:60
llvm::ArrayType::getElementType
Type * getElementType() const
Definition: DerivedTypes.h:370
llvm::TargetMachine::getDataSections
bool getDataSections() const
Return true if data objects should be emitted into their own section, corresponds to -fdata-sections.
Definition: TargetMachine.h:276
llvm::DataLayout::getTypeAllocSize
TypeSize getTypeAllocSize(Type *Ty) const
Returns the offset in bytes between successive objects of the specified type, including alignment pad...
Definition: DataLayout.h:503