Go to the documentation of this file.
71 using namespace dwarf;
76 M.getModuleFlagsMetadata(ModuleFlags);
78 for (
const auto &MFE: ModuleFlags) {
84 if (
Key ==
"Objective-C Image Info Version") {
85 Version = mdconst::extract<ConstantInt>(MFE.Val)->getZExtValue();
86 }
else if (
Key ==
"Objective-C Garbage Collection" ||
87 Key ==
"Objective-C GC Only" ||
88 Key ==
"Objective-C Is Simulated" ||
89 Key ==
"Objective-C Class Properties" ||
90 Key ==
"Objective-C Image Swift Version") {
91 Flags |= mdconst::extract<ConstantInt>(MFE.Val)->getZExtValue();
92 }
else if (
Key ==
"Objective-C Image Info Section") {
93 Section = cast<MDString>(MFE.Val)->getString();
97 else if (
Key ==
"Swift ABI Version") {
98 Flags |= (mdconst::extract<ConstantInt>(MFE.Val)->getZExtValue()) << 8;
99 }
else if (
Key ==
"Swift Major Version") {
100 Flags |= (mdconst::extract<ConstantInt>(MFE.Val)->getZExtValue()) << 24;
101 }
else if (
Key ==
"Swift Minor Version") {
102 Flags |= (mdconst::extract<ConstantInt>(MFE.Val)->getZExtValue()) << 16;
112 SupportDSOLocalEquivalentLowering =
true;
134 PersonalityEncoding = isPositionIndependent()
139 LSDAEncoding = isPositionIndependent()
142 TTypeEncoding = isPositionIndependent()
148 if (isPositionIndependent()) {
159 PersonalityEncoding =
172 if (isPositionIndependent()) {
184 if (isPositionIndependent()) {
243 if (isPositionIndependent()) {
267 if (isPositionIndependent()) {
280 if (isPositionIndependent()) {
301 if (
auto *GO = dyn_cast<GlobalObject>(GV))
307 auto &
C = getContext();
309 if (
NamedMDNode *LinkerOptions =
M.getNamedMetadata(
"llvm.linker.options")) {
315 for (
const auto *Operand : LinkerOptions->operands()) {
316 if (cast<MDNode>(Operand)->getNumOperands() != 2)
318 for (
const auto &
Option : cast<MDNode>(Operand)->operands()) {
325 if (
NamedMDNode *DependentLibraries =
M.getNamedMetadata(
"llvm.dependent-libraries")) {
331 for (
const auto *Operand : DependentLibraries->operands()) {
333 cast<MDString>(cast<MDNode>(Operand)->getOperand(0))->getString());
345 for (
const auto *Operand : FuncInfo->operands()) {
346 const auto *MD = cast<MDNode>(Operand);
347 auto *GUID = mdconst::dyn_extract<ConstantInt>(MD->getOperand(0));
348 auto *Hash = mdconst::dyn_extract<ConstantInt>(MD->getOperand(1));
349 auto *
Name = cast<MDString>(MD->getOperand(2));
350 auto *
S =
C.getObjectFileInfo()->getPseudoProbeDescSection(
354 Streamer.
emitInt64(GUID->getZExtValue());
355 Streamer.
emitInt64(Hash->getZExtValue());
366 if (!Section.empty()) {
375 emitCGProfileMetadata(Streamer,
M);
381 unsigned Encoding = getPersonalityEncoding();
383 return getContext().getOrCreateSymbol(
StringRef(
"DW.ref.") +
384 TM.getSymbol(GV)->getName());
386 return TM.getSymbol(GV);
395 cast<MCSymbolELF>(getContext().getOrCreateSymbol(NameData));
399 MCSection *Sec = getContext().getELFNamedSection(
".data", Label->getName(),
401 unsigned Size =
DL.getPointerSize();
418 MCSymbol *SSym = getSymbolWithGlobalValueBase(GV,
".DW.stub",
TM);
449 Name ==
".llvmbc" ||
Name ==
".llvmcmd")
452 if (
Name.startswith(
".llvm.offloading"))
455 if (
Name.empty() ||
Name[0] !=
'.')
return K;
458 if (
Name ==
".bss" ||
459 Name.startswith(
".bss.") ||
460 Name.startswith(
".gnu.linkonce.b.") ||
461 Name.startswith(
".llvm.linkonce.b.") ||
463 Name.startswith(
".sbss.") ||
464 Name.startswith(
".gnu.linkonce.sb.") ||
465 Name.startswith(
".llvm.linkonce.sb."))
468 if (
Name ==
".tdata" ||
469 Name.startswith(
".tdata.") ||
470 Name.startswith(
".gnu.linkonce.td.") ||
471 Name.startswith(
".llvm.linkonce.td."))
474 if (
Name ==
".tbss" ||
475 Name.startswith(
".tbss.") ||
476 Name.startswith(
".gnu.linkonce.tb.") ||
477 Name.startswith(
".llvm.linkonce.tb."))
492 if (
Name.startswith(
".note"))
548 "SelectionKind::NoDeduplicate, '" +
549 C->getName() +
"' cannot be lowered.");
564 auto *VM = dyn_cast<ValueAsMetadata>(
Op);
568 auto *OtherGV = dyn_cast<GlobalValue>(VM->getValue());
569 return OtherGV ? dyn_cast<MCSymbolELF>(
TM.getSymbol(OtherGV)) :
nullptr;
573 if (
Kind.isMergeable1ByteCString())
575 else if (
Kind.isMergeable2ByteCString())
577 else if (
Kind.isMergeable4ByteCString())
579 else if (
Kind.isMergeableConst4())
581 else if (
Kind.isMergeableConst8())
583 else if (
Kind.isMergeableConst16())
585 else if (
Kind.isMergeableConst32())
590 assert(!
Kind.isMergeableCString() &&
"unknown string width");
591 assert(!
Kind.isMergeableConst() &&
"unknown data width");
601 if (
Kind.isReadOnly())
605 if (
Kind.isThreadData())
607 if (
Kind.isThreadBSS())
611 if (
Kind.isReadOnlyWithRel())
612 return ".data.rel.ro";
619 unsigned EntrySize,
bool UniqueSectionName) {
621 if (
Kind.isMergeableCString()) {
626 cast<GlobalVariable>(GO));
628 std::string SizeSpec =
".rodata.str" + utostr(EntrySize) +
".";
629 Name = SizeSpec + utostr(Alignment.value());
630 }
else if (
Kind.isMergeableConst()) {
631 Name =
".rodata.cst";
632 Name += utostr(EntrySize);
637 bool HasPrefix =
false;
638 if (
const auto *
F = dyn_cast<Function>(GO)) {
645 if (UniqueSectionName) {
647 TM.getNameWithPrefix(
Name, GO, Mang,
true);
648 }
else if (HasPrefix)
660 LoweringDiagnosticInfo(
const Twine &DiagMsg,
673 unsigned &EntrySize,
unsigned &NextUniqueID,
674 const bool Retain,
const bool ForceUnique) {
679 return NextUniqueID++;
683 const bool Associated = GO->
getMetadata(LLVMContext::MD_associated);
686 return NextUniqueID++;
690 if (
TM.getTargetTriple().isOSSolaris())
695 return NextUniqueID++;
706 if (!SupportsUnique) {
713 const bool SeenSectionNameBefore =
717 if (!SymbolMergeable && !SeenSectionNameBefore)
723 const auto PreviousID =
734 if (SymbolMergeable &&
741 return NextUniqueID++;
747 bool Retain,
bool ForceUnique) {
756 if (
Attrs.hasAttribute(
"bss-section") &&
Kind.isBSS()) {
758 }
else if (
Attrs.hasAttribute(
"rodata-section") &&
Kind.isReadOnly()) {
760 }
else if (
Attrs.hasAttribute(
"relro-section") &&
Kind.isReadOnlyWithRel()) {
762 }
else if (
Attrs.hasAttribute(
"data-section") &&
Kind.isData()) {
766 const Function *
F = dyn_cast<Function>(GO);
767 if (
F &&
F->hasFnAttribute(
"implicit-section-name")) {
768 SectionName =
F->getFnAttribute(
"implicit-section-name").getValueAsString();
775 bool IsComdat =
false;
778 Group =
C->getName();
786 Retain, ForceUnique);
791 Group, IsComdat, UniqueID, LinkedToSym);
794 assert(Section->getLinkedToSymbol() == LinkedToSym &&
795 "Associated symbol mismatch between sections");
805 "Symbol '" + GO->
getName() +
"' from module '" +
807 "' required a section with entry-size=" +
810 ": Explicit assignment by pragma or attribute of an incompatible "
811 "symbol to this section?"));
820 NextUniqueID, Used.count(GO),
827 unsigned *NextUniqueID,
const MCSymbolELF *AssociatedSymbol) {
830 bool IsComdat =
false;
833 Group =
C->getName();
840 bool UniqueSectionName =
false;
842 if (EmitUniqueSection) {
843 if (
TM.getUniqueSectionNames()) {
844 UniqueSectionName =
true;
846 UniqueID = *NextUniqueID;
851 GO,
Kind, Mang,
TM, EntrySize, UniqueSectionName);
854 if (
Kind.isExecuteOnly())
857 EntrySize, Group, IsComdat, UniqueID,
864 unsigned Flags,
unsigned *NextUniqueID) {
867 EmitUniqueSection =
true;
871 if (
TM.getTargetTriple().isOSSolaris()) {
872 EmitUniqueSection =
true;
876 EmitUniqueSection =
true;
882 Ctx, GO,
Kind, Mang,
TM, EmitUniqueSection, Flags,
883 NextUniqueID, LinkedToSym);
884 assert(Section->getLinkedToSymbol() == LinkedToSym);
894 bool EmitUniqueSection =
false;
897 EmitUniqueSection =
TM.getFunctionSections();
899 EmitUniqueSection =
TM.getDataSections();
903 Used.count(GO), EmitUniqueSection, Flags,
913 if (
F.hasSection() ||
F.hasFnAttribute(
"implicit-section-name"))
915 &
F,
Kind,
TM, getContext(), getMangler(), NextUniqueID,
916 Used.count(&
F),
true);
919 getContext(), &
F,
Kind, getMangler(),
TM, Used.count(&
F),
920 true, Flags, &NextUniqueID);
928 bool EmitUniqueSection =
TM.getFunctionSections() ||
C;
929 if (!EmitUniqueSection)
930 return ReadOnlySection;
933 getMangler(),
TM, EmitUniqueSection,
942 if (!LSDASection || (!
F.hasComdat() && !
TM.getFunctionSections()))
945 const auto *LSDA = cast<MCSectionELF>(LSDASection);
946 unsigned Flags = LSDA->getFlags();
949 bool IsComdat =
false;
952 Group =
C->getName();
957 if (
TM.getFunctionSections() &&
958 (getContext().getAsmInfo()->useIntegratedAssembler() &&
959 getContext().getAsmInfo()->binutilsIsAtLeast(2, 36))) {
961 LinkedToSym = cast<MCSymbolELF>(&FnSym);
966 return getContext().getELFSection(
967 (
TM.getUniqueSectionNames() ? LSDA->getName() +
"." +
F.getName()
974 bool UsesLabelDifference,
const Function &
F)
const {
984 Align &Alignment)
const {
985 if (
Kind.isMergeableConst4() && MergeableConst4Section)
986 return MergeableConst4Section;
987 if (
Kind.isMergeableConst8() && MergeableConst8Section)
988 return MergeableConst8Section;
989 if (
Kind.isMergeableConst16() && MergeableConst16Section)
990 return MergeableConst16Section;
991 if (
Kind.isMergeableConst32() && MergeableConst32Section)
992 return MergeableConst32Section;
993 if (
Kind.isReadOnly())
994 return ReadOnlySection;
996 assert(
Kind.isReadOnlyWithRel() &&
"Unknown section kind");
997 return DataRelROSection;
1017 Name +=
".text.eh.";
1021 if (
TM.getUniqueBasicBlockSectionNames()) {
1022 if (!
Name.endswith(
"."))
1026 UniqueID = NextUniqueID++;
1031 std::string GroupName;
1032 if (
F.hasComdat()) {
1034 GroupName =
F.getComdat()->getName().str();
1038 F.hasComdat(), UniqueID,
nullptr);
1042 bool IsCtor,
unsigned Priority,
1055 Name =
".init_array";
1058 Name =
".fini_array";
1060 if (Priority != 65535) {
1062 Name += utostr(Priority);
1071 if (Priority != 65535)
1080 unsigned Priority,
const MCSymbol *KeySym)
const {
1086 unsigned Priority,
const MCSymbol *KeySym)
const {
1096 if (!
LHS->hasGlobalUnnamedAddr() || !
LHS->getValueType()->isFunctionTy())
1102 RHS->isThreadLocal())
1113 assert(supportDSOLocalEquivalentLowering());
1118 if (GV->isDSOLocal() || GV->isImplicitDSOLocal())
1135 UseInitArray = UseInitArray_;
1137 if (!UseInitArray) {
1157 SupportIndirectSymViaGOTPCRel =
true;
1177 PersonalityEncoding =
1185 unsigned Priority,
const MCSymbol *KeySym)
const {
1188 if (
TM->Options.LowerGlobalDtorsViaCxaAtExit)
1190 return StaticDtorSection;
1196 if (
auto *LinkerOptions =
M.getNamedMetadata(
"llvm.linker.options")) {
1197 for (
const auto *
Option : LinkerOptions->operands()) {
1199 for (
const auto &Piece : cast<MDNode>(
Option)->operands())
1200 StrOptions.push_back(std::string(cast<MDString>(Piece)->getString()));
1205 unsigned VersionVal = 0;
1206 unsigned ImageInfoFlags = 0;
1210 emitCGProfileMetadata(Streamer,
M);
1213 if (SectionVal.
empty())
1217 unsigned TAA = 0, StubSize = 0;
1220 SectionVal, Segment, Section, TAA, TAAParsed, StubSize)) {
1231 getOrCreateSymbol(
StringRef(
"L_OBJC_IMAGE_INFO")));
1243 "' cannot be lowered.");
1251 const Function *
F = dyn_cast<Function>(GO);
1252 if (
F &&
F->hasFnAttribute(
"implicit-section-name")) {
1253 SectionName =
F->getFnAttribute(
"implicit-section-name").getValueAsString();
1258 unsigned TAA = 0, StubSize = 0;
1264 SectionName, Segment, Section, TAA, TAAParsed, StubSize)) {
1267 "' has an invalid section specifier '" +
1273 getContext().getMachOSection(Segment, Section, TAA, StubSize,
Kind);
1278 TAA =
S->getTypeAndAttributes();
1283 if (
S->getTypeAndAttributes() != TAA ||
S->getStubSize() != StubSize) {
1286 "' section type or attributes does not match previous"
1287 " section specifier");
1298 if (
Kind.isThreadBSS())
return TLSBSSSection;
1299 if (
Kind.isThreadData())
return TLSDataSection;
1307 if (
Kind.isReadOnly())
1308 return ConstTextCoalSection;
1309 if (
Kind.isReadOnlyWithRel())
1310 return ConstDataCoalSection;
1311 return DataCoalSection;
1315 if (
Kind.isMergeable1ByteCString() &&
1317 cast<GlobalVariable>(GO)) <
Align(32))
1318 return CStringSection;
1325 cast<GlobalVariable>(GO)) <
Align(32))
1326 return UStringSection;
1331 if (
Kind.isMergeableConst4())
1332 return FourByteConstantSection;
1333 if (
Kind.isMergeableConst8())
1334 return EightByteConstantSection;
1335 if (
Kind.isMergeableConst16())
1336 return SixteenByteConstantSection;
1341 if (
Kind.isReadOnly())
1342 return ReadOnlySection;
1346 if (
Kind.isReadOnlyWithRel())
1347 return ConstDataSection;
1351 if (
Kind.isBSSExtern())
1352 return DataCommonSection;
1356 if (
Kind.isBSSLocal())
1357 return DataBSSSection;
1365 Align &Alignment)
const {
1368 if (
Kind.isData() ||
Kind.isReadOnlyWithRel())
1369 return ConstDataSection;
1371 if (
Kind.isMergeableConst4())
1372 return FourByteConstantSection;
1373 if (
Kind.isMergeableConst8())
1374 return EightByteConstantSection;
1375 if (
Kind.isMergeableConst16())
1376 return SixteenByteConstantSection;
1377 return ReadOnlySection;
1389 MCSymbol *SSym = getSymbolWithGlobalValueBase(GV,
"$non_lazy_ptr",
TM);
1415 MCSymbol *SSym = getSymbolWithGlobalValueBase(GV,
"$non_lazy_ptr",
TM);
1520 bool CannotUsePrivateLabel =
true;
1523 const MCSection *TheSection = SectionForGlobal(GO, GOKind,
TM);
1524 CannotUsePrivateLabel =
1527 getMangler().getNameWithPrefix(OutName, GV, CannotUsePrivateLabel);
1576 assert(
C &&
"expected GV to have a Comdat!");
1582 "' does not exist.");
1586 "' is not a key for its COMDAT.");
1594 if (
const auto *GA = dyn_cast<GlobalAlias>(ComdatKey))
1596 if (ComdatKey == GV) {
1597 switch (
C->getSelectionKind()) {
1632 COMDATSymName = Sym->
getName();
1648 if (
Kind.isThreadLocal())
1650 if (
Kind.isReadOnly() ||
Kind.isReadOnlyWithRel())
1659 bool EmitUniquedSection;
1661 EmitUniquedSection =
TM.getFunctionSections();
1663 EmitUniquedSection =
TM.getDataSections();
1665 if ((EmitUniquedSection && !
Kind.isCommon()) || GO->
hasComdat()) {
1681 if (EmitUniquedSection)
1682 UniqueID = NextUniqueID++;
1688 if (
const auto *
F = dyn_cast<Function>(GO))
1695 if (getContext().getTargetTriple().isWindowsGNUEnvironment())
1702 getMangler().getNameWithPrefix(TmpData, GO,
true);
1711 if (
Kind.isThreadLocal())
1712 return TLSDataSection;
1714 if (
Kind.isReadOnly() ||
Kind.isReadOnlyWithRel())
1715 return ReadOnlySection;
1720 if (
Kind.isBSS() ||
Kind.isCommon())
1729 bool CannotUsePrivateLabel =
false;
1731 ((isa<Function>(GV) &&
TM.getFunctionSections()) ||
1732 (isa<GlobalVariable>(GV) &&
TM.getDataSections())))
1733 CannotUsePrivateLabel =
true;
1735 getMangler().getNameWithPrefix(OutName, GV, CannotUsePrivateLabel);
1743 bool EmitUniqueSection =
TM.getFunctionSections() ||
C;
1744 if (!EmitUniqueSection)
1745 return ReadOnlySection;
1748 if (
F.hasPrivateLinkage())
1749 return ReadOnlySection;
1758 unsigned UniqueID = NextUniqueID++;
1760 return getContext().getCOFFSection(
1767 emitLinkerDirectives(Streamer,
M);
1774 if (!Section.empty()) {
1775 auto &
C = getContext();
1776 auto *
S =
C.getCOFFSection(Section,
1787 emitCGProfileMetadata(Streamer,
M);
1790 void TargetLoweringObjectFileCOFF::emitLinkerDirectives(
1792 if (
NamedMDNode *LinkerOptions =
M.getNamedMetadata(
"llvm.linker.options")) {
1798 for (
const auto *
Option : LinkerOptions->operands()) {
1799 for (
const auto &Piece : cast<MDNode>(
Option)->operands()) {
1802 Directive.append(std::string(cast<MDString>(Piece)->getString()));
1815 if (!Flags.empty()) {
1823 if (
const auto *LU =
M.getNamedGlobal(
"llvm.used")) {
1824 assert(LU->hasInitializer() &&
"expected llvm.used to have an initializer");
1825 assert(isa<ArrayType>(LU->getValueType()) &&
1826 "expected llvm.used to be an array type");
1827 if (
const auto *A = cast<ConstantArray>(LU->getInitializer())) {
1828 for (
const Value *
Op :
A->operands()) {
1829 const auto *GV = cast<GlobalValue>(
Op->stripPointerCasts());
1833 if (GV->hasLocalLinkage())
1841 if (!Flags.empty()) {
1856 if (
T.isWindowsMSVCEnvironment() ||
T.isWindowsItaniumEnvironment()) {
1882 if (
T.isWindowsMSVCEnvironment() ||
T.isWindowsItaniumEnvironment()) {
1884 if (Priority == 65535)
1895 OS <<
".CRT$X" << (IsCtor ?
"C" :
"T") <<
1896 (Priority < 200 ?
'A' :
'T') <<
format(
"%05u", Priority);
1903 std::string
Name = IsCtor ?
".ctors" :
".dtors";
1904 if (Priority != 65535)
1916 unsigned Priority,
const MCSymbol *KeySym)
const {
1918 getContext(), getContext().getTargetTriple(),
true, Priority, KeySym,
1919 cast<MCSectionCOFF>(StaticCtorSection));
1923 unsigned Priority,
const MCSymbol *KeySym)
const {
1925 getContext(), getContext().getTargetTriple(),
false, Priority, KeySym,
1926 cast<MCSectionCOFF>(StaticDtorSection));
1933 if (
T.isOSCygMing())
1949 if (!isa<GlobalObject>(
LHS) || !isa<GlobalVariable>(
RHS) ||
1950 LHS->isThreadLocal() ||
RHS->isThreadLocal() ||
1951 RHS->
getName() !=
"__ImageBase" || !
RHS->hasExternalLinkage() ||
1952 cast<GlobalVariable>(
RHS)->hasInitializer() ||
RHS->hasSection())
1962 std::string HexString =
toString(AI, 16,
false);
1964 unsigned Size = HexString.size();
1965 assert(
Width >= Size &&
"hex string is too large!");
1966 HexString.insert(HexString.begin(),
Width - Size,
'0');
1972 Type *Ty =
C->getType();
1973 if (isa<UndefValue>(
C)) {
1975 }
else if (
const auto *CFP = dyn_cast<ConstantFP>(
C)) {
1977 }
else if (
const auto *CI = dyn_cast<ConstantInt>(
C)) {
1980 unsigned NumElements;
1981 if (
auto *VTy = dyn_cast<VectorType>(Ty))
1982 NumElements = cast<FixedVectorType>(VTy)->getNumElements();
1985 std::string HexString;
1986 for (
int I = NumElements - 1,
E = -1;
I !=
E; --
I)
1994 Align &Alignment)
const {
1995 if (
Kind.isMergeableConst() &&
C &&
1996 getContext().getAsmInfo()->hasCOFFComdatConstants()) {
2004 std::string COMDATSymName;
2005 if (
Kind.isMergeableConst4()) {
2006 if (Alignment <= 4) {
2008 Alignment =
Align(4);
2010 }
else if (
Kind.isMergeableConst8()) {
2011 if (Alignment <= 8) {
2013 Alignment =
Align(8);
2015 }
else if (
Kind.isMergeableConst16()) {
2017 if (Alignment <= 16) {
2019 Alignment =
Align(16);
2021 }
else if (
Kind.isMergeableConst32()) {
2022 if (Alignment <= 32) {
2024 Alignment =
Align(32);
2028 if (!COMDATSymName.empty())
2049 "SelectionKind::Any, '" +
C->getName() +
"' cannot be "
2073 if (isa<Function>(GO)) {
2074 return SelectSectionForGlobal(GO,
Kind,
TM);
2084 if (
Name ==
".llvmcmd" ||
Name ==
".llvmbc")
2089 Group =
C->getName();
2101 const TargetMachine &
TM,
bool EmitUniqueSection,
unsigned *NextUniqueID) {
2104 Group =
C->getName();
2107 bool UniqueSectionNames =
TM.getUniqueSectionNames();
2110 if (
const auto *
F = dyn_cast<Function>(GO)) {
2111 const auto &OptionalPrefix =
F->getSectionPrefix();
2116 if (EmitUniqueSection && UniqueSectionNames) {
2117 Name.push_back(
'.');
2118 TM.getNameWithPrefix(
Name, GO, Mang,
true);
2121 if (EmitUniqueSection && !UniqueSectionNames) {
2122 UniqueID = *NextUniqueID;
2133 if (
Kind.isCommon())
2138 bool EmitUniqueSection =
false;
2140 EmitUniqueSection =
TM.getFunctionSections();
2142 EmitUniqueSection =
TM.getDataSections();
2146 EmitUniqueSection, &NextUniqueID);
2150 bool UsesLabelDifference,
const Function &
F)
const {
2161 if (!
LHS->hasGlobalUnnamedAddr() || !
LHS->getValueType()->isFunctionTy())
2167 RHS->isThreadLocal())
2186 unsigned Priority,
const MCSymbol *KeySym)
const {
2187 return Priority == UINT16_MAX ?
2189 getContext().getWasmSection(
".init_array." + utostr(Priority),
2194 unsigned Priority,
const MCSymbol *KeySym)
const {
2207 if (!
F.hasPersonalityFn() || !
F.needsUnwindTableEntry())
2211 dyn_cast<GlobalValue>(
F.getPersonalityFn()->stripPointerCasts());
2212 assert(Per &&
"Personality routine is not a GlobalValue type.");
2222 if (!
F.hasStackProtectorFnAttr())
2247 if (
const GlobalObject *GO = dyn_cast<GlobalObject>(GV)) {
2249 if (GVar->hasAttribute(
"toc-data"))
2250 return cast<MCSectionXCOFF>(
2252 ->getQualNameSymbol();
2254 if (GO->isDeclarationForLinker())
2255 return cast<MCSectionXCOFF>(getSectionForExternalReference(GO,
TM))
2256 ->getQualNameSymbol();
2260 return cast<MCSectionXCOFF>(
2261 getSectionForFunctionDescriptor(cast<Function>(GO),
TM))
2262 ->getQualNameSymbol();
2263 if ((
TM.getDataSections() && !GO->hasSection()) || GO->hasCommonLinkage() ||
2265 return cast<MCSectionXCOFF>(SectionForGlobal(GO, GOKind,
TM))
2266 ->getQualNameSymbol();
2282 if (GVar->hasAttribute(
"toc-data"))
2283 return getContext().getXCOFFSection(
2291 else if (
Kind.isData() ||
Kind.isReadOnlyWithRel() ||
Kind.isBSS())
2293 else if (
Kind.isReadOnly())
2298 return getContext().getXCOFFSection(
2306 "Tried to get ER section for a defined global.");
2309 getNameWithPrefix(
Name, GO,
TM);
2317 return getContext().getXCOFFSection(
2326 if (GVar->hasAttribute(
"toc-data")) {
2328 getNameWithPrefix(
Name, GO,
TM);
2329 return getContext().getXCOFFSection(
2340 getNameWithPrefix(
Name, GO,
TM);
2344 return getContext().getXCOFFSection(
2348 if (
Kind.isMergeableCString()) {
2350 cast<GlobalVariable>(GO));
2353 std::string SizeSpec =
".rodata.str" + utostr(EntrySize) +
".";
2355 Name = SizeSpec + utostr(Alignment.value());
2357 if (
TM.getDataSections())
2358 getNameWithPrefix(
Name, GO,
TM);
2360 return getContext().getXCOFFSection(
2362 !
TM.getDataSections());
2365 if (
Kind.isText()) {
2366 if (
TM.getFunctionSections()) {
2367 return cast<MCSymbolXCOFF>(getFunctionEntryPointSymbol(GO,
TM))
2368 ->getRepresentedCsect();
2380 if (
Kind.isData() ||
Kind.isReadOnlyWithRel() ||
Kind.isBSS()) {
2381 if (
TM.getDataSections()) {
2383 getNameWithPrefix(
Name, GO,
TM);
2384 return getContext().getXCOFFSection(
2391 if (
Kind.isReadOnly()) {
2392 if (
TM.getDataSections()) {
2394 getNameWithPrefix(
Name, GO,
TM);
2395 return getContext().getXCOFFSection(
2399 return ReadOnlySection;
2406 if (
Kind.isThreadLocal()) {
2407 if (
TM.getDataSections()) {
2409 getNameWithPrefix(
Name, GO,
TM);
2410 return getContext().getXCOFFSection(
2413 return TLSDataSection;
2421 assert (!
F.getComdat() &&
"Comdat not supported on XCOFF.");
2423 if (!
TM.getFunctionSections())
2424 return ReadOnlySection;
2429 getNameWithPrefix(NameStr, &
F,
TM);
2430 return getContext().getXCOFFSection(
2436 bool UsesLabelDifference,
const Function &
F)
const {
2444 Align &Alignment)
const {
2446 if (Alignment >
Align(16))
2449 if (Alignment ==
Align(8)) {
2450 assert(ReadOnly8Section &&
"Section should always be initialized.");
2451 return ReadOnly8Section;
2454 if (Alignment ==
Align(16)) {
2455 assert(ReadOnly16Section &&
"Section should always be initialized.");
2456 return ReadOnly16Section;
2459 return ReadOnlySection;
2469 PersonalityEncoding = 0;
2475 unsigned Priority,
const MCSymbol *KeySym)
const {
2480 unsigned Priority,
const MCSymbol *KeySym)
const {
2493 assert(!isa<GlobalIFunc>(GV) &&
"GlobalIFunc is not supported on AIX.");
2511 "There is no mapping that implements AppendingLinkage for XCOFF.");
2518 assert((isa<Function>(Func) ||
2519 (isa<GlobalAlias>(Func) &&
2520 isa_and_nonnull<Function>(
2521 cast<GlobalAlias>(Func)->getAliaseeObject()))) &&
2522 "Func must be a function or an alias which has a function as base "
2526 NameStr.push_back(
'.');
2527 getNameWithPrefix(NameStr, Func,
TM);
2533 if (((
TM.getFunctionSections() && !Func->hasSection()) ||
2534 Func->isDeclaration()) &&
2535 isa<Function>(Func)) {
2542 ->getQualNameSymbol();
2545 return getContext().getOrCreateSymbol(NameStr);
2551 getNameWithPrefix(NameStr,
F,
TM);
2552 return getContext().getXCOFFSection(
2561 return getContext().getXCOFFSection(
2570 auto *LSDA = cast<MCSectionXCOFF>(LSDASection);
2571 if (
TM.getFunctionSections()) {
2577 LSDA = getContext().getXCOFFSection(NameStr, LSDA->getKind(),
2578 LSDA->getCsectProp());
2589 return SelectSectionForGlobal(GO,
Kind,
TM);
2599 return getContext().getObjectFileInfo()->getTextSection();
@ IMAGE_COMDAT_SELECT_EXACT_MATCH
MCSection * getSectionForLSDA(const Function &F, const MCSymbol &FnSym, const TargetMachine &TM) const override
static SectionKind getExclude()
@ XTY_ER
External reference.
bool isThreadLocal() const
This is an optimization pass for GlobalISel generic memory operations.
static MCSectionCOFF * getCOFFStaticStructorSection(MCContext &Ctx, const Triple &T, bool IsCtor, unsigned Priority, const MCSymbol *KeySym, MCSectionCOFF *Default)
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 ...
@ IMAGE_SCN_CNT_UNINITIALIZED_DATA
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
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
static MCSectionELF * selectELFSectionForGlobal(MCContext &Ctx, const GlobalObject *GO, SectionKind Kind, Mangler &Mang, const TargetMachine &TM, bool EmitUniqueSection, unsigned Flags, unsigned *NextUniqueID, const MCSymbolELF *AssociatedSymbol)
static SectionKind getMetadata()
bool hasCommonLinkage() const
A parsed version of the target data layout string in and methods for querying it.
TargetLoweringObjectFileELF()
MCSection * SelectSectionForGlobal(const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const override
@ LinkOnceAnyLinkage
Keep one copy of function when linking (inline)
static void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)
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.
Align getPreferredAlign(const GlobalVariable *GV) const
Returns the preferred alignment of the specified global.
@ ExactMatch
The data referenced by the COMDAT must be the same.
@ SHT_LLVM_DEPENDENT_LIBRARIES
const MCContext & getContext() const
bool hasExternalLinkage() const
cl::opt< std::string > BBSectionsColdTextPrefix
bool useIntegratedAssembler() const
Return true if assembly (inline or otherwise) should be parsed.
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.
static unsigned getELFSectionType(StringRef Name, SectionKind K)
LinkageTypes getLinkage() const
@ IMAGE_COMDAT_SELECT_NODUPLICATES
@ XMC_TD
Scalar data item in the TOC.
Context object for machine code objects.
static SmallString< 128 > getELFSectionNameForGlobal(const GlobalObject *GO, SectionKind Kind, Mangler &Mang, const TargetMachine &TM, unsigned EntrySize, bool UniqueSectionName)
MCSection * getStaticCtorSection(unsigned Priority, const MCSymbol *KeySym) const override
virtual void emitELFSize(MCSymbol *Symbol, const MCExpr *Value)
Emit an ELF .size directive.
void emitModuleMetadata(MCStreamer &Streamer, Module &M) const override
Emit Obj-C garbage collection and linker options.
@ MCSA_ELF_TypeObject
.type _foo, STT_OBJECT # aka @object
void emitInt64(uint64_t Value)
@ XMC_TE
Symbol mapped at the end of TOC.
A raw_ostream that writes to an std::string.
StringRef getSection() const
Get the custom section of this global if it has one.
static const MCConstantExpr * create(int64_t Value, MCContext &Ctx, bool PrintInHex=false, unsigned SizeInBytes=0)
This class is intended to be used as a base class for asm properties and features specific to the tar...
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...
@ NoDeduplicate
No deduplication is performed.
void emitInt8(uint64_t Value)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
@ IMAGE_SCN_MEM_DISCARDABLE
MCSection * SelectSectionForGlobal(const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) 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...
unsigned getPointerAddressSpace() const
Get the address space of this pointer or pointer vector type.
static bool hasPrefix(StringRef SectionName, StringRef Prefix)
MDNode * getMetadata(unsigned KindID) const
Get the current metadata attachments for the given kind, if any.
TargetLoweringObjectFileMachO()
unsigned getFunctionNumber() const
getFunctionNumber - Return a unique ID for the current function.
static void checkMachOComdat(const GlobalValue *GV)
Triple - Helper class for working with autoconf configuration names.
void InitializeELF(bool UseInitArray_)
PointerIntPair< MCSymbol *, 1, bool > StubValueTy
@ XMC_UA
Unclassified - Treated as Read Write.
MCSection * getSectionForJumpTable(const Function &F, const TargetMachine &TM) const override
static MCSymbol * getEHInfoTableSymbol(const MachineFunction *MF)
The instances of the Type class are immutable: once they are created, they are never changed.
unsigned getBitWidth() const
Return the number of bits in the APInt.
void emitInt32(uint64_t Value)
@ XMC_TC
General TOC item.
bool isMergeableConst() const
@ IMAGE_COMDAT_SELECT_ASSOCIATIVE
virtual void AddBlankLine()
AddBlankLine - Emit a blank line to a .s file to pretty it up.
@ Largest
The linker will choose the largest COMDAT.
virtual void emitLinkerOptions(ArrayRef< std::string > Kind)
Emit the given list Options of strings as linker options into the output.
StubValueTy & getGVStubEntry(MCSymbol *Sym)
MCSection * getSectionForExternalReference(const GlobalObject *GO, const TargetMachine &TM) const override
For external functions, this will always return a function descriptor csect.
This represents a section on linux, lots of unix variants and some bare metal systems.
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.
static bool ShouldEmitEHBlock(const MachineFunction *MF)
static SectionKind getELFKindForNamedSection(StringRef Name, SectionKind K)
static APInt getZero(unsigned numBits)
Get the '0' value for the specified bit-width.
MCSection * getSectionForJumpTable(const Function &F, const TargetMachine &TM) const override
@ S_MOD_TERM_FUNC_POINTERS
S_MOD_TERM_FUNC_POINTERS - Section with only function pointers for termination.
bool isELFImplicitMergeableSectionNamePrefix(StringRef Name)
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 ...
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.
bool isBeginSection() const
Returns true if this block begins any section.
void getNameWithPrefix(SmallVectorImpl< char > &OutName, const GlobalValue *GV, const TargetMachine &TM) const override
EHPersonality classifyEHPersonality(const Value *Pers)
See if the given exception handling personality function is one that we understand.
void Initialize(MCContext &Ctx, const TargetMachine &TM) override
This method must be called before any actual lowering is done.
static SectionKind getReadOnly()
MCSymbol * getSymbol() const
Return the MCSymbol for this basic block.
MCSection * getStaticCtorSection(unsigned Priority, const MCSymbol *KeySym) const override
static unsigned getELFSectionFlags(SectionKind K)
Streaming machine code generation interface.
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.
@ IMAGE_SCN_CNT_INITIALIZED_DATA
MCSymbol * getOrCreateSymbol(const Twine &Name)
Lookup the symbol inside with the specified Name.
bool shouldPutJumpTableInFunctionSection(bool UsesLabelDifference, const Function &F) const override
static SectionKind getThreadBSS()
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...
@ XMC_RO
Read Only Constant.
bool isELFGenericMergeableSection(StringRef Name)
@ IMAGE_COMDAT_SELECT_SAME_SIZE
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This represents a section on wasm.
MCSection * getStaticCtorSection(unsigned Priority, const MCSymbol *KeySym) const override
unsigned UseInitArray
UseInitArray - Use .init_array instead of .ctors for static constructors.
(vector float) vec_cmpeq(*A, *B) C
const MCExpr * lowerRelativeReference(const GlobalValue *LHS, const GlobalValue *RHS, const TargetMachine &TM) const override
static std::string scalarConstantToHexString(const Constant *C)
static Error ParseSectionSpecifier(StringRef Spec, StringRef &Segment, StringRef &Section, unsigned &TAA, bool &TAAParsed, unsigned &StubSize)
Parse the section specifier indicated by "Spec".
virtual void emitLabel(MCSymbol *Symbol, SMLoc Loc=SMLoc())
Emit a label for Symbol into the current section.
MCSection * getStaticDtorSection(unsigned Priority, const MCSymbol *KeySym) const override
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.
bool hasPrivateLinkage() const
MCSectionELF * getELFSection(const Twine &Section, unsigned Type, unsigned Flags)
constexpr const char * PseudoProbeDescMetadataName
static SectionKind getBSS()
@ Any
The linker may choose any COMDAT.
void getModuleMetadata(Module &M) override
Get the module-level metadata that the platform cares about.
static void GetObjCImageInfo(Module &M, unsigned &Version, unsigned &Flags, StringRef &Section)
This class contains meta information specific to a module.
DiagnosticSeverity
Defines the different supported severity of a diagnostic.
void getNameWithPrefix(SmallVectorImpl< char > &OutName, const GlobalValue *GV, const TargetMachine &TM) const override
bool isNoOpWithoutInvoke(EHPersonality Pers)
Return true if this personality may be safely removed if there are no invoke instructions remaining i...
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
@ SHT_LLVM_LINKER_OPTIONS
MCSection * SelectSectionForGlobal(const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const override
const MCSymbol & getSymbol() const
int64_t getConstant() const
virtual void Initialize(MCContext &ctx, const TargetMachine &TM)
This method must be called before any actual lowering is done.
@ SameSize
The data referenced by the COMDAT must be the same size.
@ MCSA_Hidden
.hidden (ELF)
StringRef getName() const
getName - Get the symbol name.
static bool isThumb(const MCSubtargetInfo &STI)
This is the base abstract class for diagnostic reporting in the backend.
static SectionKind getText()
@ XTY_SD
Csect definition for initialized storage.
Interface for custom diagnostic printing.
@ InternalLinkage
Rename collisions when linking (static functions).
This struct is a compact representation of a valid (non-zero power of two) alignment.
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.
ArchType getArch() const
Get the parsed architecture type of this triple.
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...
MCSectionCOFF * getAssociativeCOFFSection(MCSectionCOFF *Sec, const MCSymbol *KeySym, unsigned UniqueID=GenericSectionID)
Gets or creates a section equivalent to Sec that is associated with the section containing KeySym.
static const MCSymbolELF * getLinkedToSymbol(const GlobalObject *GO, const TargetMachine &TM)
MCSectionWasm * getWasmSection(const Twine &Section, SectionKind K, unsigned Flags=0)
static SectionKind getKindForGlobal(const GlobalObject *GO, const TargetMachine &TM)
Classify the specified global variable into a set of target independent categories embodied in Sectio...
static StringRef getCOFFSectionNameForUniqueGlobal(SectionKind Kind)
void emitPersonalityValue(MCStreamer &Streamer, const DataLayout &DL, const MCSymbol *Sym) const override
StorageMappingClass
Storage Mapping Class definitions.
void emitModuleMetadata(MCStreamer &Streamer, Module &M) const override
Emit Obj-C garbage collection and linker options.
static unsigned getCOFFSectionFlags(SectionKind K, const TargetMachine &TM)
const MDOperand & getOperand(unsigned I) const
PointerTy getPointer() const
MachineModuleInfo & getMMI() const
bool isThreadBSSLocal() const
MCSection * getStaticDtorSection(unsigned Priority, const MCSymbol *KeySym) const override
bool hasSection() const
Check if this global has a custom object file section.
virtual bool isSectionAtomizableBySymbols(const MCSection &Section) const
True if the section is atomized using the symbols in it.
This is an important base class in LLVM.
constexpr LLVM_NODISCARD bool empty() const
empty - Check if the string is empty.
static bool isWeakForLinker(LinkageTypes Linkage)
Whether the definition of this global may be replaced at link time.
@ S_MOD_INIT_FUNC_POINTERS
S_MOD_INIT_FUNC_POINTERS - Section with only function pointers for initialization.
static unsigned getEntrySizeForKind(SectionKind Kind)
const MCAsmInfo * getAsmInfo() const
Module * getParent()
Get the module that this global value is contained inside of...
@ XTY_CM
Common csect definition. For uninitialized storage.
bool hasImplicitSection() const
Check if section name is present.
bool isArch32Bit() const
Test whether the architecture is 32-bit.
@ XMC_TL
Initialized thread-local variable.
@ WeakAnyLinkage
Keep one copy of named function when linking (weak)
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
GlobalValue * getGlobalValue() const
bool shouldPutJumpTableInFunctionSection(bool UsesLabelDifference, const Function &F) const override
void Initialize(MCContext &Ctx, const TargetMachine &TM) override
This method must be called before any actual lowering is done.
bool isMergeableCString() const
MCSymbol * getTargetSymbol(const GlobalValue *GV, const TargetMachine &TM) const override
For functions, this will always return a function descriptor symbol.
static constexpr unsigned NonUniqueID
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
const static MBBSectionID ExceptionSectionID
const MCExpr * getTTypeReference(const MCSymbolRefExpr *Sym, unsigned Encoding, MCStreamer &Streamer) const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Primary interface to the complete machine description for the target machine.
This represents a section on Windows.
uint64_t getArrayNumElements() const
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 * getStaticDtorSection(unsigned Priority, const MCSymbol *KeySym) const override
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
bool hasLocalLinkage() const
static const MCBinaryExpr * createSub(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
bool isThreadLocal() const
If the value is "Thread Local", its value isn't shared by the threads.
const std::vector< LandingPadInfo > & getLandingPads() const
Return a reference to the landing pad info for the current function.
static std::string APIntToHexString(const APInt &AI)
void emitModuleMetadata(MCStreamer &Streamer, Module &M) const override
Emit the module flags that specify the garbage collection information.
static SectionKind getThreadData()
A Module instance is used to store all the information related to an LLVM module.
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.
const MCExpr * lowerDSOLocalEquivalent(const DSOLocalEquivalent *Equiv, const TargetMachine &TM) const override
@ IMAGE_COMDAT_SELECT_LARGEST
MCSection * SelectSectionForGlobal(const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const override
Class for arbitrary precision integers.
void Initialize(MCContext &Ctx, const TargetMachine &TM) override
This method must be called before any actual lowering is done.
MCSymbol * getFunctionEntryPointSymbol(const GlobalValue *Func, const TargetMachine &TM) const override
If supported, return the function entry point symbol.
@ AppendingLinkage
Special purpose, only applies to global arrays.
Optional< const char * > toString(const Optional< DWARFFormValue > &V)
Take an optional DWARFFormValue and try to extract a string value from it.
static const MCBinaryExpr * createAdd(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
StubValueTy & getGVStubEntry(MCSymbol *Sym)
MCSection * getStaticDtorSection(unsigned Priority, const MCSymbol *KeySym) const override
StringRef - Represent a constant reference to a string, i.e.
So we should use XX3Form_Rcr to implement intrinsic Convert DP outs ins xscvdpsp No builtin are required Round &Convert QP DP(dword[1] is set to zero) No builtin are required Round to Quad Precision because you need to assign rounding mode in instruction Provide builtin(set f128:$vT,(int_ppc_vsx_xsrqpi f128:$vB))(set f128 yields< n x< ty > >< result > yields< ty >< result > No builtin are required Load Store load store see def memrix16 in PPCInstrInfo td Load Store Vector load store outs ins lxsdx set load store with conversion from to DP
MCSymbol * getCFIPersonalitySymbol(const GlobalValue *GV, const TargetMachine &TM, MachineModuleInfo *MMI) const override
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Type * getType() const
All values are typed, get the type of this value.
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.
@ WeakODRLinkage
Same, but only replaced by something equivalent.
static int getSelectionForCOFF(const GlobalValue *GV)
static bool canUsePrivateLabel(const MCAsmInfo &AsmInfo, const MCSection &Section)
LLVMContext & getContext() const
All values hold a context through their type.
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Instances of this class represent a uniqued identifier for a section in the current translation unit.
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
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.
@ AvailableExternallyLinkage
Available for inspection, not emission.
MCSectionCOFF * getCOFFSection(StringRef Section, unsigned Characteristics, SectionKind Kind, StringRef COMDATSymName, int Selection, unsigned UniqueID=GenericSectionID, const char *BeginSymName=nullptr)
const GlobalObject * getAliaseeObject() const
static StringRef getSectionPrefixForGlobal(SectionKind Kind)
Return the section prefix name used by options FunctionsSections and DataSections.
static const Comdat * getWasmComdat(const GlobalValue *GV)
#define LLVM_FALLTHROUGH
LLVM_FALLTHROUGH - Mark fallthrough cases in switch statements.
StringRef getName() const
Return a constant reference to the value's name.
MCSection * getUniqueSectionForFunction(const Function &F, const TargetMachine &TM) const override
const std::string & getSourceFileName() const
Get the module's original source file name.
@ CommonLinkage
Tentative definitions.
MBBSectionID getSectionID() const
Returns the section ID of this basic block.
const CustomOperand< const MCSubtargetInfo & > Msg[]
StringRef getName() const
MCSection * getSection() const
Returns the Section this function belongs to.
static SectionKind getData()
static MCSection * selectExplicitSectionGlobal(const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM, MCContext &Ctx, Mangler &Mang, unsigned &NextUniqueID, bool Retain, bool ForceUnique)
MCSymbol * getCFIPersonalitySymbol(const GlobalValue *GV, const TargetMachine &TM, MachineModuleInfo *MMI) const override
void diagnose(const DiagnosticInfo &DI)
Report a message to the currently installed diagnostic handler.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
SectionKind - This is a simple POD value that classifies the properties of a section.
Function & getFunction()
Return the LLVM function that this machine code represents.
TargetLoweringObjectFileGOFF()
virtual bool emitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute)=0
Add the given Attribute to Symbol.
const static MBBSectionID ColdSectionID
StringRef getPrivateGlobalPrefix() const
Lightweight error class with error context and mandatory checking.
This represents a section on a Mach-O system (used by Mac OS X).
const Comdat * getComdat() const
static bool ShouldSetSSPCanaryBitInTB(const MachineFunction *MF)
MCSection * getSectionForCommandLines() const override
If supported, return the section to use for the llvm.commandline metadata.
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...
void Initialize(MCContext &Ctx, const TargetMachine &TM) override
This method must be called before any actual lowering is done.
CodeModel::Model getCodeModel() const
Returns the code model.
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
AttributeSet getAttributes() const
Return the attribute set for this global.
@ Require
Adds a requirement that another module flag be present and have a specified value after linking is pe...
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...
@ GenericSectionID
Pass this value as the UniqueID during section creation to get the generic section with the given nam...
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.
@ XMC_DS
Descriptor csect.
amdgpu AMDGPU DAG DAG Pattern Instruction Selection
bool binutilsIsAtLeast(int Major, int Minor) const
std::string getInstrProfSectionName(InstrProfSectKind IPSK, Triple::ObjectFormatType OF, bool AddSegmentInfo=true)
Return the name of the profile section corresponding to IPSK.
@ ExternalLinkage
Externally visible function.
ExceptionHandling getExceptionHandlingType() const
static XCOFF::StorageClass getStorageClassForGlobal(const GlobalValue *GV)
@ PrivateLinkage
Like Internal, but omit from symbol table.
void emitULEB128IntValue(uint64_t Value, unsigned PadTo=0)
Special case of EmitULEB128Value that avoids the client having to pass in a MCExpr for constant integ...
PointerIntPair - This class implements a pair of a pointer and small integer.
void emitLinkerFlagsForGlobalCOFF(raw_ostream &OS, const GlobalValue *GV, const Triple &TT, Mangler &Mangler)
MCSection * SelectSectionForGlobal(const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const override
const MCExpr * lowerRelativeReference(const GlobalValue *LHS, const GlobalValue *RHS, const TargetMachine &TM) const override
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.
COFFYAML::WeakExternalCharacteristics Characteristics
bool isReadOnlyWithRel() const
const Triple & getTargetTriple() const
MachineModuleInfoELF - This is a MachineModuleInfoImpl implementation for ELF targets.
MCSection * getSectionForMachineBasicBlock(const Function &F, const MachineBasicBlock &MBB, const TargetMachine &TM) const override
Returns a unique section for the given machine basic block.
static MCSectionWasm * selectWasmSectionForGlobal(MCContext &Ctx, const GlobalObject *GO, SectionKind Kind, Mangler &Mang, const TargetMachine &TM, bool EmitUniqueSection, unsigned *NextUniqueID)
bool isDeclarationForLinker() const
A raw_ostream that writes to an SmallVector or SmallString.
virtual void emitValueToAlignment(unsigned ByteAlignment, int64_t Value=0, unsigned ValueSize=1, unsigned MaxBytesToEmit=0)
Emit some number of copies of Value until the byte alignment ByteAlignment is reached.
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...
virtual void emitBytes(StringRef Data)
Emit the bytes in Data into the output.
EnvironmentType getEnvironment() const
Get the parsed environment type of this triple.
const MCExpr * lowerRelativeReference(const GlobalValue *LHS, const GlobalValue *RHS, const TargetMachine &TM) const override
const DataLayout & getDataLayout() const
Get the data layout for the module's target platform.
const char LLVMTargetMachineRef TM
static MCSectionELF * getStaticStructorSection(MCContext &Ctx, bool UseInitArray, bool IsCtor, unsigned Priority, const MCSymbol *KeySym)
This represents an "assembler immediate".
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 ...
MCSection * SelectSectionForGlobal(const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const override
MCSection * getSectionForLSDA(const Function &F, const MCSymbol &FnSym, const TargetMachine &TM) const override
For functions, this will return the LSDA section.
MCSection * getSectionForJumpTable(const Function &F, const TargetMachine &TM) const override
@ ExternalWeakLinkage
ExternalWeak linkage description.
@ XMC_UL
Uninitialized thread-local variable.
MCSection * getStaticCtorSection(unsigned Priority, const MCSymbol *KeySym) const override
static const Comdat * getELFComdat(const GlobalValue *GV)
@ LinkOnceODRLinkage
Same, but only replaced by something equivalent.
MCSection * getStaticDtorSection(unsigned Priority, const MCSymbol *KeySym) const override
virtual void SwitchSection(MCSection *Section, const MCExpr *Subsection=nullptr)
Set the current section where code is being emitted to Section.
static const GlobalValue * getComdatGVForCOFF(const GlobalValue *GV)
const Module * getModule() const
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...
LLVM Value Representation.
Wrapper for a function that represents a value that functionally represents the original function.
Base class for the full range of assembler expressions which are needed for parsing.
bool isExecuteOnly() const
bool shouldPutJumpTableInFunctionSection(bool UsesLabelDifference, const Function &F) const override
Ty & getObjFileInfo()
Keep track of various per-module pieces of information for backends that would like to do so.
Tracking metadata reference owned by Metadata.
static unsigned getWasmSectionFlags(SectionKind K)
@ IMAGE_COMDAT_SELECT_ANY
@ XMC_BS
BSS class (uninitialized static internal)
GlobalValue * getNamedValue(StringRef Name) const
Return the global value in the module with the specified name, of arbitrary type.
const MCSymbolRefExpr * getSymB() const
MachineModuleInfoMachO - This is a MachineModuleInfoImpl implementation for MachO targets.
const MCExpr * lowerRelativeReference(const GlobalValue *LHS, const GlobalValue *RHS, const TargetMachine &TM) const override
TypeSize getPrimitiveSizeInBits() const LLVM_READONLY
Return the basic size of this type if it is a primitive type.