81 cl::desc(
"Putting Jump Table in function section"));
86 M.getModuleFlagsMetadata(ModuleFlags);
88 for (
const auto &MFE: ModuleFlags) {
94 if (Key ==
"Objective-C Image Info Version") {
95 Version = mdconst::extract<ConstantInt>(MFE.Val)->getZExtValue();
96 }
else if (Key ==
"Objective-C Garbage Collection" ||
97 Key ==
"Objective-C GC Only" ||
98 Key ==
"Objective-C Is Simulated" ||
99 Key ==
"Objective-C Class Properties" ||
100 Key ==
"Objective-C Image Swift Version") {
101 Flags |= mdconst::extract<ConstantInt>(MFE.Val)->getZExtValue();
102 }
else if (Key ==
"Objective-C Image Info Section") {
103 Section = cast<MDString>(MFE.Val)->getString();
107 else if (Key ==
"Swift ABI Version") {
108 Flags |= (mdconst::extract<ConstantInt>(MFE.Val)->getZExtValue()) << 8;
109 }
else if (Key ==
"Swift Major Version") {
110 Flags |= (mdconst::extract<ConstantInt>(MFE.Val)->getZExtValue()) << 24;
111 }
else if (Key ==
"Swift Minor Version") {
112 Flags |= (mdconst::extract<ConstantInt>(MFE.Val)->getZExtValue()) << 16;
303 if (
auto *GO = dyn_cast<GlobalObject>(GV))
313 if (
NamedMDNode *DependentLibraries = M.getNamedMetadata(
"llvm.dependent-libraries")) {
319 for (
const auto *Operand : DependentLibraries->operands()) {
321 cast<MDString>(cast<MDNode>(Operand)->getOperand(0))->getString());
328 if (
NamedMDNode *LLVMStats = M.getNamedMetadata(
"llvm.stats")) {
331 auto *S =
C.getObjectFileInfo()->getLLVMStatsSection();
333 for (
const auto *Operand : LLVMStats->operands()) {
334 const auto *MD = cast<MDNode>(Operand);
335 assert(MD->getNumOperands() % 2 == 0 &&
336 (
"Operand num should be even for a list of key/value pair"));
337 for (
size_t I = 0;
I < MD->getNumOperands();
I += 2) {
339 auto *Key = cast<MDString>(MD->getOperand(
I));
344 Twine(mdconst::dyn_extract<ConstantInt>(MD->getOperand(
I + 1))
358 if (!Section.empty()) {
373 if (
NamedMDNode *LinkerOptions = M.getNamedMetadata(
"llvm.linker.options")) {
379 for (
const auto *Operand : LinkerOptions->operands()) {
380 if (cast<MDNode>(Operand)->getNumOperands() != 2)
382 for (
const auto &Option : cast<MDNode>(Operand)->operands()) {
383 Streamer.
emitBytes(cast<MDString>(Option)->getString());
406 NameData +=
Sym->getName();
414 unsigned Size =
DL.getPointerSize();
472 Name ==
".llvmbc" ||
Name ==
".llvmcmd")
475 if (!
Name.starts_with(
"."))
return K;
478 if (
Name ==
".bss" ||
Name.starts_with(
".bss.") ||
479 Name.starts_with(
".gnu.linkonce.b.") ||
480 Name.starts_with(
".llvm.linkonce.b.") ||
Name ==
".sbss" ||
481 Name.starts_with(
".sbss.") ||
Name.starts_with(
".gnu.linkonce.sb.") ||
482 Name.starts_with(
".llvm.linkonce.sb."))
485 if (
Name ==
".tdata" ||
Name.starts_with(
".tdata.") ||
486 Name.starts_with(
".gnu.linkonce.td.") ||
487 Name.starts_with(
".llvm.linkonce.td."))
490 if (
Name ==
".tbss" ||
Name.starts_with(
".tbss.") ||
491 Name.starts_with(
".gnu.linkonce.tb.") ||
492 Name.starts_with(
".llvm.linkonce.tb."))
507 if (
Name.starts_with(
".note"))
521 if (
Name ==
".llvm.lto")
524 if (K.isBSS() || K.isThreadBSS())
533 if (!K.isMetadata() && !K.isExclude())
542 if (K.isExecuteOnly()) {
545 else if (
T.isARM() ||
T.isThumb())
552 if (K.isThreadLocal())
555 if (K.isMergeableCString() || K.isMergeableConst())
558 if (K.isMergeableCString())
572 "SelectionKind::NoDeduplicate, '" +
573 C->getName() +
"' cannot be lowered.");
585 auto *OtherGV = dyn_cast<GlobalValue>(VM->getValue());
586 return OtherGV ?
static_cast<const MCSymbolELF *
>(TM.getSymbol(OtherGV))
591 if (Kind.isMergeable1ByteCString())
593 else if (Kind.isMergeable2ByteCString())
595 else if (Kind.isMergeable4ByteCString())
597 else if (Kind.isMergeableConst4())
599 else if (Kind.isMergeableConst8())
601 else if (Kind.isMergeableConst16())
603 else if (Kind.isMergeableConst32())
608 assert(!Kind.isMergeableCString() &&
"unknown string width");
609 assert(!Kind.isMergeableConst() &&
"unknown data width");
618 return IsLarge ?
".ltext" :
".text";
619 if (Kind.isReadOnly())
620 return IsLarge ?
".lrodata" :
".rodata";
622 return IsLarge ?
".lbss" :
".bss";
623 if (Kind.isThreadData())
625 if (Kind.isThreadBSS())
628 return IsLarge ?
".ldata" :
".data";
629 if (Kind.isReadOnlyWithRel())
630 return IsLarge ?
".ldata.rel.ro" :
".data.rel.ro";
637 unsigned EntrySize,
bool UniqueSectionName,
641 if (Kind.isMergeableCString()) {
646 cast<GlobalVariable>(GO));
649 Name += utostr(EntrySize);
652 }
else if (Kind.isMergeableConst()) {
654 Name += utostr(EntrySize);
657 bool HasPrefix =
false;
658 if (
const auto *
F = dyn_cast<Function>(GO)) {
667 "Hotness must be cold");
671 }
else if (std::optional<StringRef> Prefix =
F->getSectionPrefix()) {
675 }
else if (
const auto *GV = dyn_cast<GlobalVariable>(GO)) {
676 if (std::optional<StringRef> Prefix = GV->getSectionPrefix()) {
682 if (UniqueSectionName) {
684 TM.getNameWithPrefix(
Name, GO, Mang,
true);
685 }
else if (HasPrefix)
710 unsigned &EntrySize,
unsigned &NextUniqueID,
711 const bool Retain,
const bool ForceUnique) {
716 return NextUniqueID++;
720 const bool Associated = GO->
getMetadata(LLVMContext::MD_associated);
723 return NextUniqueID++;
727 if (TM.getTargetTriple().isOSSolaris())
732 return NextUniqueID++;
743 if (!SupportsUnique) {
744 Flags &= ~ELF::SHF_MERGE;
750 const bool SeenSectionNameBefore =
754 if (!SymbolMergeable && !SeenSectionNameBefore) {
755 if (TM.getSeparateNamedSections())
756 return NextUniqueID++;
764 const auto PreviousID =
775 GO, Kind, Mang, TM, EntrySize,
false,
nullptr);
776 if (SymbolMergeable &&
783 return NextUniqueID++;
786static std::tuple<StringRef, bool, unsigned>
789 bool IsComdat =
false;
793 Group =
C->getName();
796 if (TM.isLargeGlobalValue(GO))
798 return {Group, IsComdat, Flags};
809 if (Attrs.hasAttribute(
"bss-section") && Kind.isBSS())
810 return Attrs.getAttribute(
"bss-section").getValueAsString();
811 else if (Attrs.hasAttribute(
"rodata-section") && Kind.isReadOnly())
812 return Attrs.getAttribute(
"rodata-section").getValueAsString();
813 else if (Attrs.hasAttribute(
"relro-section") && Kind.isReadOnlyWithRel())
814 return Attrs.getAttribute(
"relro-section").getValueAsString();
815 else if (Attrs.hasAttribute(
"data-section") && Kind.isData())
816 return Attrs.getAttribute(
"data-section").getValueAsString();
826 unsigned &NextUniqueID,
827 bool Retain,
bool ForceUnique) {
839 GO,
SectionName, Kind, TM, Ctx, Mang, Flags, EntrySize, NextUniqueID,
840 Retain, ForceUnique);
845 Group, IsComdat, UniqueID, LinkedToSym);
848 assert(Section->getLinkedToSymbol() == LinkedToSym &&
849 "Associated symbol mismatch between sections");
859 "Symbol '" + GO->
getName() +
"' from module '" +
861 "' required a section with entry-size=" +
864 ": Explicit assignment by pragma or attribute of an incompatible "
865 "symbol to this section?"));
874 NextUniqueID, Used.count(GO),
880 const TargetMachine &TM,
bool EmitUniqueSection,
unsigned Flags,
881 unsigned *NextUniqueID,
const MCSymbolELF *AssociatedSymbol,
890 bool UniqueSectionName =
false;
892 if (EmitUniqueSection) {
893 if (TM.getUniqueSectionNames()) {
894 UniqueSectionName =
true;
896 UniqueID = *NextUniqueID;
901 GO, Kind, Mang, TM, EntrySize, UniqueSectionName, MJTE);
904 if (Kind.isExecuteOnly())
907 EntrySize, Group, IsComdat, UniqueID,
913 const TargetMachine &TM,
bool Retain,
bool EmitUniqueSection,
914 unsigned Flags,
unsigned *NextUniqueID) {
917 EmitUniqueSection =
true;
921 if (TM.getTargetTriple().isOSSolaris()) {
922 EmitUniqueSection =
true;
926 EmitUniqueSection =
true;
932 Ctx, GO, Kind, Mang, TM, EmitUniqueSection, Flags,
933 NextUniqueID, LinkedToSym);
934 assert(Section->getLinkedToSymbol() == LinkedToSym);
944 bool EmitUniqueSection =
false;
953 Used.count(GO), EmitUniqueSection, Flags,
966 Used.count(&
F),
true);
970 true, Flags, &NextUniqueID);
1002 unsigned Flags = LSDA->getFlags();
1005 bool IsComdat =
false;
1008 Group =
C->getName();
1017 LinkedToSym =
static_cast<const MCSymbolELF *
>(&FnSym);
1030 bool UsesLabelDifference,
const Function &
F)
const {
1040 Align &Alignment)
const {
1049 if (Kind.isReadOnly())
1052 assert(Kind.isReadOnlyWithRel() &&
"Unknown section kind");
1061 if (SectionSuffix.
empty())
1066 return Context.getELFSection(
".rodata.cst4." + SectionSuffix +
".",
1070 return Context.getELFSection(
".rodata.cst8." + SectionSuffix +
".",
1074 return Context.getELFSection(
".rodata.cst16." + SectionSuffix +
".",
1078 return Context.getELFSection(
".rodata.cst32." + SectionSuffix +
".",
1081 if (Kind.isReadOnly())
1082 return Context.getELFSection(
".rodata." + SectionSuffix +
".",
1085 assert(Kind.isReadOnlyWithRel() &&
"Unknown section kind");
1086 return Context.getELFSection(
".data.rel.ro." + SectionSuffix +
".",
1105 if (FunctionSectionName ==
".text" ||
1111 Name += FunctionName;
1113 Name +=
".text.eh.";
1114 Name += FunctionName;
1116 Name += FunctionSectionName;
1118 if (!
Name.ends_with(
"."))
1122 UniqueID = NextUniqueID++;
1128 Name = FunctionSectionName;
1129 UniqueID = NextUniqueID++;
1133 std::string GroupName;
1134 if (
F.hasComdat()) {
1136 GroupName =
F.getComdat()->getName().str();
1140 F.hasComdat(), UniqueID,
nullptr);
1144 bool IsCtor,
unsigned Priority,
1157 Name =
".init_array";
1160 Name =
".fini_array";
1162 if (Priority != 65535) {
1164 Name += utostr(Priority);
1173 if (Priority != 65535)
1182 unsigned Priority,
const MCSymbol *KeySym)
const {
1188 unsigned Priority,
const MCSymbol *KeySym)
const {
1195 std::optional<int64_t> PCRelativeOffset)
const {
1203 Addend += *PCRelativeOffset;
1224 std::optional<int64_t> PCRelativeOffset,
const TargetMachine &TM)
const {
1245 UseInitArray = UseInitArray_;
1247 if (!UseInitArray) {
1295 unsigned Priority,
const MCSymbol *KeySym)
const {
1309 unsigned VersionVal = 0;
1310 unsigned ImageInfoFlags = 0;
1317 if (SectionVal.
empty())
1321 unsigned TAA = 0, StubSize = 0;
1324 SectionVal, Segment, Section, TAA, TAAParsed, StubSize)) {
1327 "': " +
toString(std::move(E)) +
".");
1335 getOrCreateSymbol(
StringRef(
"L_OBJC_IMAGE_INFO")));
1343 if (
auto *LinkerOptions = M.getNamedMetadata(
"llvm.linker.options")) {
1344 for (
const auto *Option : LinkerOptions->operands()) {
1346 for (
const auto &Piece : cast<MDNode>(Option)->operands())
1347 StrOptions.
push_back(std::string(cast<MDString>(Piece)->getString()));
1359 "' cannot be lowered.");
1369 unsigned TAA = 0, StubSize = 0;
1375 SectionName, Segment, Section, TAA, TAAParsed, StubSize)) {
1378 "' has an invalid section specifier '" +
1397 "' section type or attributes does not match previous"
1398 " section specifier");
1418 if (Kind.isReadOnly())
1420 if (Kind.isReadOnlyWithRel())
1426 if (Kind.isMergeable1ByteCString() &&
1428 cast<GlobalVariable>(GO)) <
Align(32))
1436 cast<GlobalVariable>(GO)) <
Align(32))
1442 if (Kind.isMergeableConst4())
1444 if (Kind.isMergeableConst8())
1446 if (Kind.isMergeableConst16())
1452 if (Kind.isReadOnly())
1457 if (Kind.isReadOnlyWithRel())
1462 if (Kind.isBSSExtern())
1467 if (Kind.isBSSLocal())
1476 Align &Alignment)
const {
1479 if (Kind.isData() || Kind.isReadOnlyWithRel())
1482 if (Kind.isMergeableConst4())
1484 if (Kind.isMergeableConst8())
1486 if (Kind.isMergeableConst16())
1634 bool CannotUsePrivateLabel =
true;
1638 CannotUsePrivateLabel =
1656 else if (K.isExclude())
1659 else if (K.isText())
1670 else if (K.isThreadLocal())
1675 else if (K.isReadOnly() || K.isReadOnlyWithRel())
1679 else if (K.isWriteable())
1690 assert(
C &&
"expected GV to have a Comdat!");
1696 "' does not exist.");
1700 "' is not a key for its COMDAT.");
1708 if (
const auto *GA = dyn_cast<GlobalAlias>(ComdatKey))
1710 if (ComdatKey == GV) {
1711 switch (
C->getSelectionKind()) {
1741 Name ==
".llvmbc" ||
Name ==
".llvmcmd")
1756 COMDATSymName =
Sym->getName();
1772 if (Kind.isThreadLocal())
1774 if (Kind.isReadOnly() || Kind.isReadOnlyWithRel())
1783 bool EmitUniquedSection;
1785 EmitUniquedSection = TM.getFunctionSections();
1787 EmitUniquedSection = TM.getDataSections();
1789 if ((EmitUniquedSection && !Kind.isCommon()) || GO->
hasComdat()) {
1805 if (EmitUniquedSection)
1806 UniqueID = NextUniqueID++;
1812 if (
const auto *
F = dyn_cast<Function>(GO))
1813 if (std::optional<StringRef> Prefix =
F->getSectionPrefix())
1819 if (
getContext().getTargetTriple().isOSCygMing())
1835 if (Kind.isThreadLocal())
1838 if (Kind.isReadOnly() || Kind.isReadOnlyWithRel())
1844 if (Kind.isBSS() || Kind.isCommon())
1853 bool CannotUsePrivateLabel =
false;
1855 ((isa<Function>(GV) && TM.getFunctionSections()) ||
1856 (isa<GlobalVariable>(GV) && TM.getDataSections())))
1857 CannotUsePrivateLabel =
true;
1867 bool EmitUniqueSection = TM.getFunctionSections() ||
C;
1868 if (!EmitUniqueSection)
1872 if (
F.hasPrivateLinkage())
1882 unsigned UniqueID = NextUniqueID++;
1890 bool UsesLabelDifference,
const Function &
F)
const {
1899 UsesLabelDifference,
F);
1911 if (!Section.empty()) {
1927 if (
NamedMDNode *LinkerOptions = M.getNamedMetadata(
"llvm.linker.options")) {
1933 for (
const auto *Option : LinkerOptions->operands()) {
1934 for (
const auto &Piece : cast<MDNode>(Option)->operands()) {
1937 Directive.append(std::string(cast<MDString>(Piece)->getString()));
1950 if (!Flags.empty()) {
1958 if (
const auto *LU = M.getNamedGlobal(
"llvm.used")) {
1959 assert(LU->hasInitializer() &&
"expected llvm.used to have an initializer");
1960 assert(isa<ArrayType>(LU->getValueType()) &&
1961 "expected llvm.used to be an array type");
1962 if (
const auto *
A = cast<ConstantArray>(LU->getInitializer())) {
1963 for (
const Value *
Op :
A->operands()) {
1964 const auto *GV = cast<GlobalValue>(
Op->stripPointerCasts());
1968 if (GV->hasLocalLinkage())
1976 if (!Flags.empty()) {
1990 const Triple &
T = TM.getTargetTriple();
1991 if (
T.isWindowsMSVCEnvironment() ||
T.isWindowsItaniumEnvironment()) {
2013 if (
T.isWindowsMSVCEnvironment() ||
T.isWindowsItaniumEnvironment()) {
2015 if (Priority == 65535)
2029 char LastLetter =
'T';
2030 bool AddPrioritySuffix = Priority != 200 && Priority != 400;
2033 else if (Priority < 400)
2035 else if (Priority == 400)
2038 OS <<
".CRT$X" << (IsCtor ?
"C" :
"T") << LastLetter;
2039 if (AddPrioritySuffix)
2046 std::string
Name = IsCtor ?
".ctors" :
".dtors";
2047 if (Priority != 65535)
2058 unsigned Priority,
const MCSymbol *KeySym)
const {
2065 unsigned Priority,
const MCSymbol *KeySym)
const {
2073 std::optional<int64_t> PCRelativeOffset,
const TargetMachine &TM)
const {
2074 const Triple &
T = TM.getTargetTriple();
2075 if (
T.isOSCygMing())
2091 if (!isa<GlobalObject>(
LHS) || !isa<GlobalVariable>(
RHS) ||
2092 LHS->isThreadLocal() ||
RHS->isThreadLocal() ||
2093 RHS->
getName() !=
"__ImageBase" || !
RHS->hasExternalLinkage() ||
2094 cast<GlobalVariable>(
RHS)->hasInitializer() ||
RHS->hasSection())
2107 std::string HexString =
toString(AI, 16,
false);
2109 unsigned Size = HexString.size();
2110 assert(Width >=
Size &&
"hex string is too large!");
2111 HexString.insert(HexString.begin(), Width -
Size,
'0');
2117 Type *Ty =
C->getType();
2118 if (isa<UndefValue>(
C)) {
2120 }
else if (
const auto *CFP = dyn_cast<ConstantFP>(
C)) {
2122 }
else if (
const auto *CI = dyn_cast<ConstantInt>(
C)) {
2125 unsigned NumElements;
2126 if (
auto *VTy = dyn_cast<VectorType>(Ty))
2127 NumElements = cast<FixedVectorType>(VTy)->getNumElements();
2130 std::string HexString;
2131 for (
int I = NumElements - 1, E = -1;
I != E; --
I)
2139 Align &Alignment)
const {
2140 if (Kind.isMergeableConst() &&
C &&
2141 getContext().getAsmInfo()->hasCOFFComdatConstants()) {
2149 std::string COMDATSymName;
2150 if (Kind.isMergeableConst4()) {
2151 if (Alignment <= 4) {
2153 Alignment =
Align(4);
2155 }
else if (Kind.isMergeableConst8()) {
2156 if (Alignment <= 8) {
2158 Alignment =
Align(8);
2160 }
else if (Kind.isMergeableConst16()) {
2162 if (Alignment <= 16) {
2164 Alignment =
Align(16);
2166 }
else if (Kind.isMergeableConst32()) {
2167 if (Alignment <= 32) {
2169 Alignment =
Align(32);
2173 if (!COMDATSymName.empty())
2194 "SelectionKind::Any, '" +
C->getName() +
"' cannot be "
2203 if (K.isThreadLocal())
2206 if (K.isMergeableCString())
2221 if (
auto *GO = dyn_cast<GlobalObject>(GV))
2229 if (isa<Function>(GO)) {
2244 Name ==
".llvmbc" ||
Name ==
".llvmcmd")
2249 Group =
C->getName();
2263 unsigned *NextUniqueID,
bool Retain) {
2266 Group =
C->getName();
2269 bool UniqueSectionNames = TM.getUniqueSectionNames();
2272 if (
const auto *
F = dyn_cast<Function>(GO)) {
2273 const auto &OptionalPrefix =
F->getSectionPrefix();
2278 if (EmitUniqueSection && UniqueSectionNames) {
2279 Name.push_back(
'.');
2280 TM.getNameWithPrefix(
Name, GO, Mang,
true);
2283 if (EmitUniqueSection && !UniqueSectionNames) {
2284 UniqueID = *NextUniqueID;
2295 if (Kind.isCommon())
2300 bool EmitUniqueSection =
false;
2306 bool Retain = Used.count(GO);
2307 EmitUniqueSection |= Retain;
2310 EmitUniqueSection, &NextUniqueID, Retain);
2314 bool UsesLabelDifference,
const Function &
F)
const {
2330 unsigned Priority,
const MCSymbol *KeySym)
const {
2331 return Priority == UINT16_MAX ?
2338 unsigned Priority,
const MCSymbol *KeySym)
const {
2351 if (!
F.hasPersonalityFn() || !
F.needsUnwindTableEntry())
2355 dyn_cast<GlobalValue>(
F.getPersonalityFn()->stripPointerCasts());
2356 assert(Per &&
"Personality routine is not a GlobalValue type.");
2366 if (!
F.hasStackProtectorFnAttr())
2394 if (
const GlobalObject *GO = dyn_cast<GlobalObject>(GV)) {
2395 if (GO->isDeclarationForLinker())
2398 ->getQualNameSymbol();
2401 if (GVar->hasAttribute(
"toc-data"))
2404 ->getQualNameSymbol();
2410 ->getQualNameSymbol();
2415 ->getQualNameSymbol();
2431 if (GVar->hasAttribute(
"toc-data"))
2440 else if (Kind.isData() || Kind.isBSS())
2442 else if (Kind.isReadOnlyWithRel())
2445 else if (Kind.isReadOnly())
2458 "Tried to get ER section for a defined global.");
2478 if (GVar->hasAttribute(
"toc-data"))
2491 if (GVar->hasAttribute(
"toc-data")) {
2505 if (Kind.isBSSLocal() || GO->
hasCommonLinkage() || Kind.isThreadBSSLocal()) {
2515 if (Kind.isText()) {
2519 ->getRepresentedCsect();
2527 "ReadOnlyPointers is supported only if data sections is turned on");
2540 if (Kind.isData() || Kind.isReadOnlyWithRel() || Kind.isBSS()) {
2551 if (Kind.isReadOnly()) {
2566 if (Kind.isThreadLocal()) {
2581 assert (!
F.getComdat() &&
"Comdat not supported on XCOFF.");
2596 bool UsesLabelDifference,
const Function &
F)
const {
2604 Align &Alignment)
const {
2606 if (Alignment >
Align(16))
2609 if (Alignment ==
Align(8)) {
2614 if (Alignment ==
Align(16)) {
2642 unsigned Priority,
const MCSymbol *KeySym)
const {
2647 unsigned Priority,
const MCSymbol *KeySym)
const {
2653 assert(!isa<GlobalIFunc>(GV) &&
"GlobalIFunc is not supported on AIX.");
2671 "There is no mapping that implements AppendingLinkage for XCOFF.");
2678 assert((isa<Function>(Func) ||
2679 (isa<GlobalAlias>(Func) &&
2680 isa_and_nonnull<Function>(
2681 cast<GlobalAlias>(Func)->getAliaseeObject()))) &&
2682 "Func must be a function or an alias which has a function as base "
2694 Func->isDeclarationForLinker()) &&
2695 isa<Function>(Func)) {
2725 if (XSym->getSymbolTableName() ==
"_$TLSML")
2731 if (XSym->isEHInfo())
2735 if (!XSym->hasPerSymbolCodeModel())
2759 LSDA->getCsectProp());
2773 FileName = FileName.
substr(1, FileName.
size() - 2);
2779 RootSD->
setName(DefaultRootSDName);
2780 ADAPR->
setName(DefaultADAPRName);
2798 std::string
Name =
".gcc_exception_table." +
F.getName().str();
2818 if (Kind.isBSS() || Kind.isData()) {
2828 if (
auto *
F = dyn_cast<Function>(GO))
2829 Alignment =
F->getAlign();
2830 else if (
auto *V = dyn_cast<GlobalVariable>(GO))
2831 Alignment = V->getAlign();
2837 GOFF::SDAttr{GOFF::ESD_TA_Unspecified, SDBindingScope});
2844 return getContext().getGOFFSection(Kind, Symbol->getName(),
2846 GOFF::ESD_LT_XPLink,
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
amdgpu AMDGPU DAG DAG Pattern Instruction Selection
static bool isThumb(const MCSubtargetInfo &STI)
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)
static const Function * getParent(const Value *V)
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
COFFYAML::WeakExternalCharacteristics Characteristics
#define LLVM_LIFETIME_BOUND
This file contains the declarations for the subclasses of Constant, which represent the different fla...
This file contains constants used for implementing Dwarf debug support.
Module.h This file contains the declarations for the Module class.
This file declares the MCSectionGOFF class, which contains all of the necessary machine code sections...
This file contains the MCSymbolGOFF class.
This file defines the SmallString class.
This file defines the SmallVector class.
static bool canUsePrivateLabel(const MCAsmInfo &AsmInfo, const MCSection &Section)
static MCSection * selectExplicitSectionGlobal(const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM, MCContext &Ctx, Mangler &Mang, unsigned &NextUniqueID, bool Retain, bool ForceUnique)
static int getSelectionForCOFF(const GlobalValue *GV)
static MCSectionCOFF * getCOFFStaticStructorSection(MCContext &Ctx, const Triple &T, bool IsCtor, unsigned Priority, const MCSymbol *KeySym, MCSectionCOFF *Default)
static unsigned getEntrySizeForKind(SectionKind Kind)
static void GetObjCImageInfo(Module &M, unsigned &Version, unsigned &Flags, StringRef &Section)
static const GlobalValue * getComdatGVForCOFF(const GlobalValue *GV)
static unsigned getCOFFSectionFlags(SectionKind K, const TargetMachine &TM)
static StringRef handlePragmaClangSection(const GlobalObject *GO, SectionKind Kind)
static unsigned getELFSectionType(StringRef Name, SectionKind K)
static bool hasPrefix(StringRef SectionName, StringRef Prefix)
static MCSectionWasm * selectWasmSectionForGlobal(MCContext &Ctx, const GlobalObject *GO, SectionKind Kind, Mangler &Mang, const TargetMachine &TM, bool EmitUniqueSection, unsigned *NextUniqueID, bool Retain)
static const MCSymbolELF * getLinkedToSymbol(const GlobalObject *GO, const TargetMachine &TM)
static unsigned calcUniqueIDUpdateFlagsAndSize(const GlobalObject *GO, StringRef SectionName, SectionKind Kind, const TargetMachine &TM, MCContext &Ctx, Mangler &Mang, unsigned &Flags, unsigned &EntrySize, unsigned &NextUniqueID, const bool Retain, const bool ForceUnique)
Calculate an appropriate unique ID for a section, and update Flags, EntrySize and NextUniqueID where ...
static SectionKind getELFKindForNamedSection(StringRef Name, SectionKind K)
static const Comdat * getWasmComdat(const GlobalValue *GV)
static MCSectionELF * getStaticStructorSection(MCContext &Ctx, bool UseInitArray, bool IsCtor, unsigned Priority, const MCSymbol *KeySym)
static SmallString< 128 > getELFSectionNameForGlobal(const GlobalObject *GO, SectionKind Kind, Mangler &Mang, const TargetMachine &TM, unsigned EntrySize, bool UniqueSectionName, const MachineJumpTableEntry *JTE)
static unsigned getWasmSectionFlags(SectionKind K, bool Retain)
static void checkMachOComdat(const GlobalValue *GV)
static std::string APIntToHexString(const APInt &AI)
static unsigned getELFSectionFlags(SectionKind K, const Triple &T)
static cl::opt< bool > JumpTableInFunctionSection("jumptable-in-function-section", cl::Hidden, cl::init(false), cl::desc("Putting Jump Table in function section"))
static StringRef getSectionPrefixForGlobal(SectionKind Kind, bool IsLarge)
Return the section prefix name used by options FunctionsSections and DataSections.
static std::string scalarConstantToHexString(const Constant *C)
static StringRef getCOFFSectionNameForUniqueGlobal(SectionKind Kind)
static const Comdat * getELFComdat(const GlobalValue *GV)
static MCSectionELF * selectELFSectionForGlobal(MCContext &Ctx, const GlobalObject *GO, SectionKind Kind, Mangler &Mang, const TargetMachine &TM, bool EmitUniqueSection, unsigned Flags, unsigned *NextUniqueID, const MCSymbolELF *AssociatedSymbol, const MachineJumpTableEntry *MJTE=nullptr)
static std::tuple< StringRef, bool, unsigned > getGlobalObjectInfo(const GlobalObject *GO, const TargetMachine &TM)
Class for arbitrary precision integers.
unsigned getBitWidth() const
Return the number of bits in the APInt.
static APInt getZero(unsigned numBits)
Get the '0' value for the specified bit-width.
@ Largest
The linker will choose the largest COMDAT.
@ SameSize
The data referenced by the COMDAT must be the same size.
@ Any
The linker may choose any COMDAT.
@ NoDeduplicate
No deduplication is performed.
@ ExactMatch
The data referenced by the COMDAT must be the same.
This is an important base class in LLVM.
This class represents an Operation in the Expression.
A parsed version of the target data layout string in and methods for querying it.
LLVM_ABI Align getPreferredAlign(const GlobalVariable *GV) const
Returns the preferred alignment of the specified global.
StringRef getPrivateGlobalPrefix() const
This is the base abstract class for diagnostic reporting in the backend.
Interface for custom diagnostic printing.
Lightweight error class with error context and mandatory checking.
StringRef getSection() const
Get the custom section of this global if it has one.
bool hasSection() const
Check if this global has a custom object file section.
MDNode * getMetadata(unsigned KindID) const
Get the current metadata attachments for the given kind, if any.
bool hasExternalLinkage() const
bool isThreadLocal() const
If the value is "Thread Local", its value isn't shared by the threads.
LinkageTypes getLinkage() const
bool hasLocalLinkage() const
bool hasDefaultVisibility() const
bool hasPrivateLinkage() const
LLVM_ABI const Comdat * getComdat() const
ThreadLocalMode getThreadLocalMode() const
bool isDeclarationForLinker() const
Module * getParent()
Get the module that this global value is contained inside of...
LLVM_ABI const GlobalObject * getAliaseeObject() const
LLVM_ABI const DataLayout & getDataLayout() const
Get the data layout of the module this global belongs to.
bool hasCommonLinkage() const
static bool isWeakForLinker(LinkageTypes Linkage)
Whether the definition of this global may be replaced at link time.
@ PrivateLinkage
Like Internal, but omit from symbol table.
@ CommonLinkage
Tentative definitions.
@ InternalLinkage
Rename collisions when linking (static functions).
@ LinkOnceAnyLinkage
Keep one copy of function when linking (inline)
@ WeakODRLinkage
Same, but only replaced by something equivalent.
@ ExternalLinkage
Externally visible function.
@ WeakAnyLinkage
Keep one copy of named function when linking (weak)
@ AppendingLinkage
Special purpose, only applies to global arrays.
@ AvailableExternallyLinkage
Available for inspection, not emission.
@ ExternalWeakLinkage
ExternalWeak linkage description.
@ LinkOnceODRLinkage
Same, but only replaced by something equivalent.
AttributeSet getAttributes() const
Return the attribute set for this global.
bool hasImplicitSection() const
Check if section name is present.
LLVM_ABI void diagnose(const DiagnosticInfo &DI)
Report a message to the currently installed diagnostic handler.
static bool isSectionAtomizableBySymbols(const MCSection &Section)
True if the section is atomized using the symbols in it.
This class is intended to be used as a base class for asm properties and features specific to the tar...
bool useIntegratedAssembler() const
Return true if assembly (inline or otherwise) should be parsed.
bool binutilsIsAtLeast(int Major, int Minor) const
ExceptionHandling getExceptionHandlingType() const
static const MCBinaryExpr * createAdd(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx, SMLoc Loc=SMLoc())
static const MCBinaryExpr * createSub(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
static LLVM_ABI const MCConstantExpr * create(int64_t Value, MCContext &Ctx, bool PrintInHex=false, unsigned SizeInBytes=0)
Context object for machine code objects.
LLVM_ABI MCSectionMachO * getMachOSection(StringRef Segment, StringRef Section, unsigned TypeAndAttributes, unsigned Reserved2, SectionKind K, const char *BeginSymName=nullptr)
Return the MCSection for the specified mach-o section.
LLVM_ABI MCSectionCOFF * getCOFFSection(StringRef Section, unsigned Characteristics, StringRef COMDATSymName, int Selection, unsigned UniqueID=MCSection::NonUniqueID)
MCSectionWasm * getWasmSection(const Twine &Section, SectionKind K, unsigned Flags=0)
LLVM_ABI MCSectionELF * getELFNamedSection(const Twine &Prefix, const Twine &Suffix, unsigned Type, unsigned Flags, unsigned EntrySize=0)
Get a section with the provided group identifier.
MCSectionELF * getELFSection(const Twine &Section, unsigned Type, unsigned Flags)
LLVM_ABI MCSectionXCOFF * getXCOFFSection(StringRef Section, SectionKind K, std::optional< XCOFF::CsectProperties > CsectProp=std::nullopt, bool MultiSymbolsAllowed=false, std::optional< XCOFF::DwarfSectionSubtypeFlags > DwarfSubtypeFlags=std::nullopt)
LLVM_ABI bool isELFGenericMergeableSection(StringRef Name)
LLVM_ABI std::optional< unsigned > getELFUniqueIDForEntsize(StringRef SectionName, unsigned Flags, unsigned EntrySize)
Return the unique ID of the section with the given name, flags and entry size, if it exists.
const MCAsmInfo * getAsmInfo() const
LLVM_ABI MCSymbol * getOrCreateSymbol(const Twine &Name)
Lookup the symbol inside with the specified Name.
LLVM_ABI MCSectionCOFF * getAssociativeCOFFSection(MCSectionCOFF *Sec, const MCSymbol *KeySym, unsigned UniqueID=MCSection::NonUniqueID)
Gets or creates a section equivalent to Sec that is associated with the section containing KeySym.
LLVM_ABI bool isELFImplicitMergeableSectionNamePrefix(StringRef Name)
Base class for the full range of assembler expressions which are needed for parsing.
MCSection * TLSBSSSection
Section directive for Thread Local uninitialized data.
MCSection * MergeableConst16Section
MCSection * MergeableConst4Section
MCSection * TextSection
Section directive for standard text.
MCSection * ConstDataCoalSection
MCSection * ConstTextCoalSection
MCSection * TLSDataSection
Section directive for Thread Local data. ELF, MachO, COFF, and Wasm.
MCSection * MergeableConst8Section
MCSection * LSDASection
If exception handling is supported by the target, this is the section the Language Specific Data Area...
MCSection * ReadOnly16Section
MCSection * FourByteConstantSection
MCSection * ReadOnly8Section
MCSection * DataBSSSection
MCSection * getDrectveSection() const
MCSection * TextCoalSection
MCSection * DataRelROSection
MCSection * CStringSection
bool isPositionIndependent() const
MCSection * DataCoalSection
MCSection * UStringSection
MCSection * MergeableConst32Section
MCSection * SixteenByteConstantSection
MCSection * DataCommonSection
MCSection * ReadOnlySection
Section that is readonly and can contain arbitrary initialized data.
MCSection * BSSSection
Section that is default initialized to zero.
MCSection * EightByteConstantSection
MCSection * ConstDataSection
MCContext & getContext() const
MCSection * DataSection
Section directive for standard data.
This represents a section on Windows.
This represents a section on linux, lots of unix variants and some bare metal systems.
void setName(StringRef SectionName)
This represents a section on a Mach-O system (used by Mac OS X).
static Error ParseSectionSpecifier(StringRef Spec, StringRef &Segment, StringRef &Section, unsigned &TAA, bool &TAAParsed, unsigned &StubSize)
Parse the section specifier indicated by "Spec".
unsigned getTypeAndAttributes() const
unsigned getStubSize() const
This represents a section on wasm.
MCSymbolXCOFF * getQualNameSymbol() const
Instances of this class represent a uniqued identifier for a section in the current translation unit.
static constexpr unsigned NonUniqueID
void setBeginSymbol(MCSymbol *Sym)
StringRef getName() const
static const MCSpecifierExpr * create(const MCExpr *Expr, Spec S, MCContext &Ctx, SMLoc Loc=SMLoc())
Streaming machine code generation interface.
virtual void addBlankLine()
Emit a blank line to a .s file to pretty it up.
virtual bool emitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute)=0
Add the given Attribute to Symbol.
virtual void emitELFSize(MCSymbol *Symbol, const MCExpr *Value)
Emit an ELF .size directive.
void emitSymbolValue(const MCSymbol *Sym, unsigned Size, bool IsSectionRelative=false)
Special case of EmitValue that avoids the client having to pass in a MCExpr for MCSymbols.
virtual void emitLabel(MCSymbol *Symbol, SMLoc Loc=SMLoc())
Emit a label for Symbol into the current section.
virtual void emitValueToAlignment(Align Alignment, int64_t Fill=0, uint8_t FillLen=1, unsigned MaxBytesToEmit=0)
Emit some number of copies of Value until the byte alignment ByteAlignment is reached.
unsigned emitULEB128IntValue(uint64_t Value, unsigned PadTo=0)
Special case of EmitULEB128Value that avoids the client having to pass in a MCExpr for constant integ...
virtual void emitLinkerOptions(ArrayRef< std::string > Kind)
Emit the given list Options of strings as linker options into the output.
virtual void switchSection(MCSection *Section, uint32_t Subsec=0)
Set the current section where code is being emitted to Section.
void emitInt32(uint64_t Value)
void emitInt8(uint64_t Value)
virtual void emitBytes(StringRef Data)
Emit the bytes in Data into the output.
void setADA(MCSectionGOFF *AssociatedDataArea)
void setLDAttributes(GOFF::LDAttr Attr)
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx, SMLoc Loc=SMLoc())
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
StringRef getName() const
getName - Get the symbol name.
int64_t getConstant() const
const MCSymbol * getSubSym() const
const MDOperand & getOperand(unsigned I) const
LLVM_ABI MCSymbol * getSymbol() const
Return the MCSymbol for this basic block.
MBBSectionID getSectionID() const
Returns the section ID of this basic block.
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
bool isBeginSection() const
Returns true if this block begins any section.
unsigned getFunctionNumber() const
getFunctionNumber - Return a unique ID for the current function.
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
MCContext & getContext() const
Function & getFunction()
Return the LLVM function that this machine code represents.
const std::vector< LandingPadInfo > & getLandingPads() const
Return a reference to the landing pad info for the current function.
MCSection * getSection() const
Returns the Section this function belongs to.
MachineModuleInfoELF - This is a MachineModuleInfoImpl implementation for ELF targets.
StubValueTy & getGVStubEntry(MCSymbol *Sym)
PointerIntPair< MCSymbol *, 1, bool > StubValueTy
MachineModuleInfoMachO - This is a MachineModuleInfoImpl implementation for MachO targets.
StubValueTy & getGVStubEntry(MCSymbol *Sym)
This class contains meta information specific to a module.
const Module * getModule() const
Ty & getObjFileInfo()
Keep track of various per-module pieces of information for backends that would like to do so.
LLVM_ABI void getNameWithPrefix(raw_ostream &OS, const GlobalValue *GV, bool CannotUsePrivateLabel) const
Print the appropriate prefix and the specified global variable's name.
A Module instance is used to store all the information related to an LLVM module.
@ Require
Adds a requirement that another module flag be present and have a specified value after linking is pe...
const std::string & getSourceFileName() const
Get the module's original source file name.
GlobalValue * getNamedValue(StringRef Name) const
Return the global value in the module with the specified name, of arbitrary type.
const DataLayout & getDataLayout() const
Get the data layout for the module's target platform.
PointerIntPair - This class implements a pair of a pointer and small integer.
PointerTy getPointer() const
SectionKind - This is a simple POD value that classifies the properties of a section.
static SectionKind getThreadData()
static SectionKind getMetadata()
bool isThreadBSSLocal() const
static SectionKind getText()
static SectionKind getData()
static SectionKind getBSS()
static SectionKind getThreadBSS()
static SectionKind getReadOnly()
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
constexpr StringRef substr(size_t Start, size_t N=npos) const
Return a reference to the substring from [Start, Start + N).
bool starts_with(StringRef Prefix) const
Check if this string starts with the given Prefix.
constexpr bool empty() const
empty - Check if the string is empty.
constexpr size_t size() const
size - Get the string size.
bool ends_with(StringRef Suffix) const
Check if this string ends with the given Suffix.
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...
MCSection * getSectionForConstant(const DataLayout &DL, SectionKind Kind, const Constant *C, Align &Alignment) const override
Given a mergeable constant with the specified size and relocation information, return a section that ...
void Initialize(MCContext &Ctx, const TargetMachine &TM) override
This method must be called before any actual lowering is done.
void emitModuleMetadata(MCStreamer &Streamer, Module &M) const override
Emit Obj-C garbage collection and linker options.
MCSection * SelectSectionForGlobal(const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const override
MCSection * getStaticCtorSection(unsigned Priority, const MCSymbol *KeySym) const override
void emitLinkerDirectives(MCStreamer &Streamer, Module &M) const override
Process linker options metadata and emit platform-specific bits.
const MCExpr * lowerRelativeReference(const GlobalValue *LHS, const GlobalValue *RHS, int64_t Addend, std::optional< int64_t > PCRelativeOffset, const TargetMachine &TM) const override
bool shouldPutJumpTableInFunctionSection(bool UsesLabelDifference, const Function &F) const override
void getNameWithPrefix(SmallVectorImpl< char > &OutName, const GlobalValue *GV, const TargetMachine &TM) const override
MCSection * getStaticDtorSection(unsigned Priority, const MCSymbol *KeySym) const override
MCSection * getSectionForJumpTable(const Function &F, const TargetMachine &TM) const override
MCSection * getUniqueSectionForFunction(const Function &F, const TargetMachine &TM) const override
void Initialize(MCContext &Ctx, const TargetMachine &TM) override
This method must be called before any actual lowering is done.
MCSection * getSectionForConstant(const DataLayout &DL, SectionKind Kind, const Constant *C, Align &Alignment) const override
Given a constant with the SectionKind, return a section that it should be placed in.
MCSection * getStaticCtorSection(unsigned Priority, const MCSymbol *KeySym) const override
MCSection * getSectionForJumpTable(const Function &F, const TargetMachine &TM) const override
void emitModuleMetadata(MCStreamer &Streamer, Module &M) const override
Emit Obj-C garbage collection and linker options.
void emitLinkerDirectives(MCStreamer &Streamer, Module &M) const override
Process linker options metadata and emit platform-specific bits.
MCSymbol * getCFIPersonalitySymbol(const GlobalValue *GV, const TargetMachine &TM, MachineModuleInfo *MMI) const override
MCSection * getStaticDtorSection(unsigned Priority, const MCSymbol *KeySym) const override
void emitPersonalityValue(MCStreamer &Streamer, const DataLayout &DL, const MCSymbol *Sym, const MachineModuleInfo *MMI) const override
const MCExpr * getTTypeGlobalReference(const GlobalValue *GV, unsigned Encoding, const TargetMachine &TM, MachineModuleInfo *MMI, MCStreamer &Streamer) const override
Return an MCExpr to use for a reference to the specified type info global variable from exception han...
void getModuleMetadata(Module &M) override
Get the module-level metadata that the platform cares about.
MCSection * SelectSectionForGlobal(const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const override
uint16_t PLTRelativeSpecifier
const MCExpr * lowerSymbolDifference(const MCSymbol *LHS, const MCSymbol *RHS, int64_t Addend, std::optional< int64_t > PCRelativeOffset) const
const MCExpr * lowerDSOLocalEquivalent(const MCSymbol *LHS, const MCSymbol *RHS, int64_t Addend, std::optional< int64_t > PCRelativeOffset, const TargetMachine &TM) const override
MCSection * getSectionForCommandLines() const override
If supported, return the section to use for the llvm.commandline metadata.
MCSection * getSectionForLSDA(const Function &F, const MCSymbol &FnSym, const TargetMachine &TM) const override
virtual void emitPersonalityValueImpl(MCStreamer &Streamer, const DataLayout &DL, const MCSymbol *Sym, const MachineModuleInfo *MMI) const
bool shouldPutJumpTableInFunctionSection(bool UsesLabelDifference, const Function &F) const override
void InitializeELF(bool UseInitArray_)
MCSection * getSectionForMachineBasicBlock(const Function &F, const MachineBasicBlock &MBB, const TargetMachine &TM) const override
Returns a unique section for the given machine basic block.
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...
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...
MCSection * getSectionForLSDA(const Function &F, const MCSymbol &FnSym, const TargetMachine &TM) const override
TargetLoweringObjectFileGOFF()
void getModuleMetadata(Module &M) override
Get the module-level metadata that the platform cares about.
MCSection * SelectSectionForGlobal(const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const override
MCSection * getSectionForConstant(const DataLayout &DL, SectionKind Kind, const Constant *C, Align &Alignment) const override
Given a constant with the SectionKind, return a section that it should be placed in.
void getNameWithPrefix(SmallVectorImpl< char > &OutName, const GlobalValue *GV, const TargetMachine &TM) const override
MCSymbol * getCFIPersonalitySymbol(const GlobalValue *GV, const TargetMachine &TM, MachineModuleInfo *MMI) const override
MCSection * SelectSectionForGlobal(const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const override
void emitLinkerDirectives(MCStreamer &Streamer, Module &M) const override
Process linker options metadata and emit platform-specific bits.
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...
const MCExpr * getIndirectSymViaGOTPCRel(const GlobalValue *GV, const MCSymbol *Sym, const MCValue &MV, int64_t Offset, MachineModuleInfo *MMI, MCStreamer &Streamer) const override
Get MachO PC relative GOT entry relocation.
void emitModuleMetadata(MCStreamer &Streamer, Module &M) const override
Emit the module flags that specify the garbage collection information.
void Initialize(MCContext &Ctx, const TargetMachine &TM) override
This method must be called before any actual lowering is done.
MCSection * getSectionForCommandLines() const override
If supported, return the section to use for the llvm.commandline metadata.
MCSection * getStaticDtorSection(unsigned Priority, const MCSymbol *KeySym) const override
TargetLoweringObjectFileMachO()
const MCExpr * getTTypeGlobalReference(const GlobalValue *GV, unsigned Encoding, const TargetMachine &TM, MachineModuleInfo *MMI, MCStreamer &Streamer) const override
The mach-o version of this method defaults to returning a stub reference.
void getModuleMetadata(Module &M) override
Get the module-level metadata that the platform cares about.
MCSection * getStaticCtorSection(unsigned Priority, const MCSymbol *KeySym) const override
bool shouldPutJumpTableInFunctionSection(bool UsesLabelDifference, const Function &F) const override
MCSection * getStaticDtorSection(unsigned Priority, const MCSymbol *KeySym) const override
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...
MCSection * SelectSectionForGlobal(const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const override
static bool ShouldSetSSPCanaryBitInTB(const MachineFunction *MF)
void Initialize(MCContext &Ctx, const TargetMachine &TM) override
This method must be called before any actual lowering is done.
MCSection * getSectionForTOCEntry(const MCSymbol *Sym, const TargetMachine &TM) const override
On targets that support TOC entries, return a section for the entry given the symbol it refers to.
MCSection * getSectionForExternalReference(const GlobalObject *GO, const TargetMachine &TM) const override
For external functions, this will always return a function descriptor csect.
MCSymbol * getFunctionEntryPointSymbol(const GlobalValue *Func, const TargetMachine &TM) const override
If supported, return the function entry point symbol.
bool shouldPutJumpTableInFunctionSection(bool UsesLabelDifference, const Function &F) const override
MCSection * getSectionForJumpTable(const Function &F, const TargetMachine &TM) const override
static MCSymbol * getEHInfoTableSymbol(const MachineFunction *MF)
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...
MCSection * getStaticCtorSection(unsigned Priority, const MCSymbol *KeySym) const override
static XCOFF::StorageClass getStorageClassForGlobal(const GlobalValue *GV)
MCSection * getSectionForConstant(const DataLayout &DL, SectionKind Kind, const Constant *C, Align &Alignment) const override
Given a constant with the SectionKind, return a section that it should be placed in.
MCSymbol * getTargetSymbol(const GlobalValue *GV, const TargetMachine &TM) const override
For functions, this will always return a function descriptor symbol.
MCSection * getSectionForFunctionDescriptor(const Function *F, const TargetMachine &TM) const override
On targets that use separate function descriptor symbols, return a section for the descriptor given i...
static bool ShouldEmitEHBlock(const MachineFunction *MF)
MCSection * SelectSectionForGlobal(const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const override
MCSection * getStaticDtorSection(unsigned Priority, const MCSymbol *KeySym) const override
MCSection * getSectionForLSDA(const Function &F, const MCSymbol &FnSym, const TargetMachine &TM) const override
For functions, this will return the LSDA section.
void emitCGProfileMetadata(MCStreamer &Streamer, Module &M) const
Emit Call Graph Profile metadata.
virtual void getNameWithPrefix(SmallVectorImpl< char > &OutName, const GlobalValue *GV, const TargetMachine &TM) const
MCSection * StaticDtorSection
This section contains the static destructor pointer list.
unsigned PersonalityEncoding
PersonalityEncoding, LSDAEncoding, TTypeEncoding - Some encoding values for EH.
Mangler & getMangler() const
bool SupportIndirectSymViaGOTPCRel
static SectionKind getKindForGlobal(const GlobalObject *GO, const TargetMachine &TM)
Classify the specified global variable into a set of target independent categories embodied in Sectio...
virtual bool shouldPutJumpTableInFunctionSection(bool UsesLabelDifference, const Function &F) const
bool SupportDebugThreadLocalLocation
virtual void Initialize(MCContext &ctx, const TargetMachine &TM)
This method must be called before any actual lowering is done.
unsigned getPersonalityEncoding() const
MCSection * StaticCtorSection
This section contains the static constructor pointer list.
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.
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...
uint32_t PLTPCRelativeSpecifier
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...
unsigned CallSiteEncoding
const MCExpr * getTTypeReference(const MCSymbolRefExpr *Sym, unsigned Encoding, MCStreamer &Streamer) const
void emitPseudoProbeDescMetadata(MCStreamer &Streamer, Module &M) const
Emit pseudo_probe_desc metadata.
MCSection * SectionForGlobal(const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const
This method computes the appropriate section to emit the specified global variable or function defini...
Primary interface to the complete machine description for the target machine.
const Triple & getTargetTriple() const
bool getUniqueBasicBlockSectionNames() const
Return true if unique basic block section names must be generated.
bool getUniqueSectionNames() const
bool getEnableStaticDataPartitioning() const
Reloc::Model getRelocationModel() const
Returns the code generation relocation model.
MCSymbol * getSymbol(const GlobalValue *GV) const
bool getDataSections() const
Return true if data objects should be emitted into their own section, corresponds to -fdata-sections.
CodeModel::Model getCodeModel() const
Returns the code model.
bool getFunctionSections() const
Return true if functions should be emitted into their own section, corresponding to -ffunction-sectio...
const MCAsmInfo * getMCAsmInfo() const
Return target specific asm information.
unsigned XCOFFReadOnlyPointers
When set to true, const objects with relocatable address values are put into the RO data section.
unsigned UseInitArray
UseInitArray - Use .init_array instead of .ctors for static constructors.
Triple - Helper class for working with autoconf configuration names.
ArchType getArch() const
Get the parsed architecture type of this triple.
EnvironmentType getEnvironment() const
Get the parsed environment type of this triple.
LLVM_ABI bool isArch32Bit() const
Test whether the architecture is 32-bit.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
LLVM_ABI std::string str() const
Return the twine contents as a std::string.
Twine concat(const Twine &Suffix) const
The instances of the Type class are immutable: once they are created, they are never changed.
LLVM_ABI TypeSize getPrimitiveSizeInBits() const LLVM_READONLY
Return the basic size of this type if it is a primitive type.
LLVM_ABI unsigned getPointerAddressSpace() const
Get the address space of this pointer or pointer vector type.
LLVM_ABI uint64_t getArrayNumElements() const
LLVM Value Representation.
Type * getType() const
All values are typed, get the type of this value.
LLVM_ABI LLVMContext & getContext() const
All values hold a context through their type.
LLVM_ABI StringRef getName() const
Return a constant reference to the value's name.
A raw_ostream that writes to an std::string.
A raw_ostream that writes to an SmallVector or SmallString.
This file contains the declaration of the Comdat class, which represents a single COMDAT in LLVM.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ IMAGE_SCN_CNT_UNINITIALIZED_DATA
@ IMAGE_SCN_MEM_DISCARDABLE
@ IMAGE_SCN_CNT_INITIALIZED_DATA
@ IMAGE_COMDAT_SELECT_NODUPLICATES
@ IMAGE_COMDAT_SELECT_LARGEST
@ IMAGE_COMDAT_SELECT_SAME_SIZE
@ IMAGE_COMDAT_SELECT_ASSOCIATIVE
@ IMAGE_COMDAT_SELECT_EXACT_MATCH
@ IMAGE_COMDAT_SELECT_ANY
@ C
The default llvm calling convention, compatible with C.
@ SHT_LLVM_DEPENDENT_LIBRARIES
@ SHT_LLVM_LINKER_OPTIONS
constexpr StringLiteral CLASS_WSA
@ S_MOD_TERM_FUNC_POINTERS
S_MOD_TERM_FUNC_POINTERS - Section with only function pointers for termination.
@ S_MOD_INIT_FUNC_POINTERS
S_MOD_INIT_FUNC_POINTERS - Section with only function pointers for initialization.
StorageMappingClass
Storage Mapping Class definitions.
@ XMC_TE
Symbol mapped at the end of TOC.
@ XMC_DS
Descriptor csect.
@ XMC_TL
Initialized thread-local variable.
@ XMC_RO
Read Only Constant.
@ XMC_UA
Unclassified - Treated as Read Write.
@ XMC_TD
Scalar data item in the TOC.
@ XMC_UL
Uninitialized thread-local variable.
@ XMC_BS
BSS class (uninitialized static internal)
@ XMC_TC
General TOC item.
@ XTY_CM
Common csect definition. For uninitialized storage.
@ XTY_SD
Csect definition for initialized storage.
@ XTY_ER
External reference.
initializer< Ty > init(const Ty &Val)
LLVM_ABI StringRef stem(StringRef path LLVM_LIFETIME_BOUND, Style style=Style::native)
Get stem.
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI std::string getInstrProfSectionName(InstrProfSectKind IPSK, Triple::ObjectFormatType OF, bool AddSegmentInfo=true)
Return the name of the profile section corresponding to IPSK.
bool isNoOpWithoutInvoke(EHPersonality Pers)
Return true if this personality may be safely removed if there are no invoke instructions remaining i...
OutputIt transform(R &&Range, OutputIt d_first, UnaryFunction F)
Wrapper function around std::transform to apply a function to a range and store the result elsewhere.
std::string encodeBase64(InputBytes const &Bytes)
LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)
LLVM_ABI EHPersonality classifyEHPersonality(const Value *Pers)
See if the given exception handling personality function is one that we understand.
LLVM_ABI void emitLinkerFlagsForUsedCOFF(raw_ostream &OS, const GlobalValue *GV, const Triple &T, Mangler &M)
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
DiagnosticSeverity
Defines the different supported severity of a diagnostic.
LLVM_ABI void emitLinkerFlagsForGlobalCOFF(raw_ostream &OS, const GlobalValue *GV, const Triple &TT, Mangler &Mangler)
const char * toString(DWARFSectionKind Kind)
unsigned Log2(Align A)
Returns the log2 of the alignment.
cl::opt< std::string > BBSectionsColdTextPrefix
@ Default
The result values are uniform if and only if all operands are uniform.
@ MCSA_ELF_TypeObject
.type _foo, STT_OBJECT # aka @object
@ MCSA_Hidden
.hidden (ELF)
LLVM_ABI GlobalVariable * collectUsedGlobalVariables(const Module &M, SmallVectorImpl< GlobalValue * > &Vec, bool CompilerUsed)
Given "llvm.used" or "llvm.compiler.used" as a global name, collect the initializer elements of that ...
This struct is a compact representation of a valid (non-zero power of two) alignment.
uint64_t value() const
This is a hole in the type system and should not be abused.
LLVM_ABI static const MBBSectionID ExceptionSectionID
LLVM_ABI static const MBBSectionID ColdSectionID
MachineJumpTableEntry - One jump table in the jump table info.
MachineFunctionDataHotness Hotness
The hotness of MJTE is inferred from the hotness of the source basic block(s) that reference it.
This struct is a compact representation of a valid (power of two) or undefined (0) alignment.