80 #include <system_error> 87 #define DEBUG_TYPE "bitcode-reader" 89 STATISTIC(NumMDStringLoaded,
"Number of MDStrings loaded");
90 STATISTIC(NumMDNodeTemporary,
"Number of MDNode::Temporary created");
91 STATISTIC(NumMDRecordLoaded,
"Number of Metadata records loaded");
97 cl::desc(
"Import full type definitions for ThinLTO."));
101 cl::desc(
"Force disable the lazy-loading on-demand of metadata when " 102 "loading bitcode for importing."));
106 static int64_t unrotateSign(uint64_t U) {
return (U & 1) ? ~(U >> 1) : U >> 1; }
108 class BitcodeReaderMetadataList {
135 unsigned RefsUpperBound;
138 BitcodeReaderMetadataList(
LLVMContext &
C,
size_t RefsUpperBound)
144 unsigned size()
const {
return MetadataPtrs.
size(); }
145 void resize(
unsigned N) { MetadataPtrs.
resize(N); }
149 void pop_back() { MetadataPtrs.
pop_back(); }
150 bool empty()
const {
return MetadataPtrs.
empty(); }
152 Metadata *operator[](
unsigned i)
const {
154 return MetadataPtrs[i];
158 if (I < MetadataPtrs.
size())
159 return MetadataPtrs[I];
163 void shrinkTo(
unsigned N) {
164 assert(N <=
size() &&
"Invalid shrinkTo request!");
165 assert(ForwardReference.
empty() &&
"Unexpected forward refs");
166 assert(UnresolvedNodes.
empty() &&
"Unexpected unresolved node");
172 Metadata *getMetadataFwdRef(
unsigned Idx);
178 Metadata *getMetadataIfResolved(
unsigned Idx);
180 MDNode *getMDNodeFwdRefOrNull(
unsigned Idx);
181 void assignValue(
Metadata *MD,
unsigned Idx);
182 void tryToResolveCycles();
183 bool hasFwdRefs()
const {
return !ForwardReference.
empty(); }
184 int getNextFwdRef() {
186 return *ForwardReference.
begin();
202 void BitcodeReaderMetadataList::assignValue(
Metadata *MD,
unsigned Idx) {
203 if (
auto *MDN = dyn_cast<MDNode>(MD))
204 if (!MDN->isResolved())
205 UnresolvedNodes.
insert(Idx);
222 TempMDTuple PrevMD(cast<MDTuple>(OldMD.
get()));
223 PrevMD->replaceAllUsesWith(MD);
224 ForwardReference.
erase(Idx);
227 Metadata *BitcodeReaderMetadataList::getMetadataFwdRef(
unsigned Idx) {
229 if (Idx >= RefsUpperBound)
235 if (
Metadata *MD = MetadataPtrs[Idx])
239 ForwardReference.
insert(Idx);
242 ++NumMDNodeTemporary;
244 MetadataPtrs[Idx].reset(MD);
248 Metadata *BitcodeReaderMetadataList::getMetadataIfResolved(
unsigned Idx) {
250 if (
auto *N = dyn_cast_or_null<MDNode>(MD))
251 if (!N->isResolved())
256 MDNode *BitcodeReaderMetadataList::getMDNodeFwdRefOrNull(
unsigned Idx) {
257 return dyn_cast_or_null<MDNode>(getMetadataFwdRef(Idx));
260 void BitcodeReaderMetadataList::tryToResolveCycles() {
261 if (!ForwardReference.
empty())
266 for (
const auto &
Ref : OldTypeRefs.FwdDecls)
267 OldTypeRefs.Final.insert(
Ref);
268 OldTypeRefs.FwdDecls.clear();
272 for (
const auto &Array : OldTypeRefs.Arrays)
273 Array.second->replaceAllUsesWith(resolveTypeRefArray(Array.first.get()));
274 OldTypeRefs.Arrays.clear();
279 for (
const auto &
Ref : OldTypeRefs.Unknown) {
281 Ref.second->replaceAllUsesWith(CT);
283 Ref.second->replaceAllUsesWith(
Ref.first);
285 OldTypeRefs.Unknown.clear();
287 if (UnresolvedNodes.
empty())
292 for (
unsigned I : UnresolvedNodes) {
293 auto &MD = MetadataPtrs[
I];
294 auto *N = dyn_cast_or_null<MDNode>(MD);
298 assert(!N->isTemporary() &&
"Unexpected forward reference");
303 UnresolvedNodes.clear();
306 void BitcodeReaderMetadataList::addTypeRef(
MDString &
UUID,
310 OldTypeRefs.FwdDecls.insert(std::make_pair(&UUID, &CT));
312 OldTypeRefs.Final.insert(std::make_pair(&UUID, &CT));
316 auto *UUID = dyn_cast_or_null<MDString>(MaybeUUID);
320 if (
auto *CT = OldTypeRefs.Final.lookup(UUID))
323 auto &
Ref = OldTypeRefs.Unknown[
UUID];
329 Metadata *BitcodeReaderMetadataList::upgradeTypeRefArray(
Metadata *MaybeTuple) {
330 auto *Tuple = dyn_cast_or_null<MDTuple>(MaybeTuple);
331 if (!Tuple || Tuple->isDistinct())
335 if (!Tuple->isTemporary())
336 return resolveTypeRefArray(Tuple);
340 OldTypeRefs.Arrays.emplace_back(
341 std::piecewise_construct, std::forward_as_tuple(Tuple),
343 return OldTypeRefs.Arrays.back().second.get();
346 Metadata *BitcodeReaderMetadataList::resolveTypeRefArray(
Metadata *MaybeTuple) {
347 auto *Tuple = dyn_cast_or_null<MDTuple>(MaybeTuple);
348 if (!Tuple || Tuple->isDistinct())
353 Ops.
reserve(Tuple->getNumOperands());
354 for (
Metadata *MD : Tuple->operands())
362 class PlaceholderQueue {
365 std::deque<DistinctMDOperandPlaceholder> PHs;
368 ~PlaceholderQueue() {
369 assert(
empty() &&
"PlaceholderQueue hasn't been flushed before being destroyed");
371 bool empty() {
return PHs.empty(); }
373 void flush(BitcodeReaderMetadataList &MetadataList);
377 void getTemporaries(BitcodeReaderMetadataList &MetadataList,
379 for (
auto &PH : PHs) {
380 auto ID = PH.getID();
381 auto *MD = MetadataList.lookup(
ID);
386 auto *N = dyn_cast_or_null<MDNode>(MD);
387 if (N && N->isTemporary())
396 PHs.emplace_back(ID);
400 void PlaceholderQueue::flush(BitcodeReaderMetadataList &MetadataList) {
401 while (!PHs.empty()) {
402 auto *MD = MetadataList.lookup(PHs.front().getID());
403 assert(MD &&
"Flushing placeholder on unassigned MD");
405 if (
auto *MDN = dyn_cast<MDNode>(MD))
406 assert(MDN->isResolved() &&
407 "Flushing Placeholder while cycles aren't resolved");
409 PHs.front().replaceUseWith(MD);
417 return make_error<StringError>(
422 BitcodeReaderMetadataList MetadataList;
427 std::function<Type *(unsigned)> getTypeByID;
435 std::vector<StringRef> MDStringRef;
439 MDString *lazyLoadOneMDString(
unsigned Idx);
442 std::vector<uint64_t> GlobalMetadataBitPosIndex;
451 void lazyLoadOneMetadata(
unsigned Idx, PlaceholderQueue &Placeholders);
455 std::vector<std::pair<DICompileUnit *, Metadata *>> CUSubprograms;
464 bool StripTBAA =
false;
465 bool HasSeenOldLoopTags =
false;
466 bool NeedUpgradeToDIGlobalVariableExpression =
false;
467 bool NeedDeclareExpressionUpgrade =
false;
470 bool IsImporting =
false;
473 PlaceholderQueue &Placeholders,
StringRef Blob,
474 unsigned &NextMetadataNo);
481 void resolveForwardRefsAndPlaceholders(PlaceholderQueue &Placeholders);
484 void upgradeCUSubprograms() {
485 for (
auto CU_SP : CUSubprograms)
486 if (
auto *SPs = dyn_cast_or_null<MDTuple>(CU_SP.second))
487 for (
auto &
Op : SPs->operands())
488 if (
auto *
SP = dyn_cast_or_null<DISubprogram>(
Op))
489 SP->replaceUnit(CU_SP.first);
490 CUSubprograms.clear();
494 void upgradeCUVariables() {
495 if (!NeedUpgradeToDIGlobalVariableExpression)
500 for (
unsigned I = 0,
E = CUNodes->getNumOperands(); I !=
E; ++
I) {
501 auto *
CU = cast<DICompileUnit>(CUNodes->getOperand(I));
502 if (
auto *GVs = dyn_cast_or_null<MDTuple>(
CU->getRawGlobalVariables()))
503 for (
unsigned I = 0; I < GVs->getNumOperands(); I++)
505 dyn_cast_or_null<DIGlobalVariable>(GVs->getOperand(I))) {
508 GVs->replaceOperandWith(I, DGVE);
513 for (
auto &GV : TheModule.
globals()) {
515 GV.getMetadata(LLVMContext::MD_dbg, MDs);
516 GV.eraseMetadata(LLVMContext::MD_dbg);
518 if (
auto *DGV = dyn_cast<DIGlobalVariable>(MD)) {
521 GV.addMetadata(LLVMContext::MD_dbg, *DGVE);
523 GV.addMetadata(LLVMContext::MD_dbg, *MD);
529 void upgradeDeclareExpressions(
Function &
F) {
530 if (!NeedDeclareExpressionUpgrade)
535 if (
auto *DDI = dyn_cast<DbgDeclareInst>(&I))
536 if (
auto *DIExpr = DDI->getExpression())
537 if (DIExpr->startsWithDeref() &&
538 dyn_cast_or_null<Argument>(DDI->getAddress())) {
540 Ops.
append(std::next(DIExpr->elements_begin()),
541 DIExpr->elements_end());
548 Error upgradeDIExpression(uint64_t FromVersion,
551 auto N = Expr.
size();
552 switch (FromVersion) {
554 return error(
"Invalid record");
556 if (N >= 3 && Expr[N - 3] == dwarf::DW_OP_bit_piece)
561 if (N && Expr[0] == dwarf::DW_OP_deref) {
562 auto End = Expr.
end();
563 if (Expr.
size() >= 3 &&
565 End = std::prev(End, 3);
566 std::move(std::next(Expr.
begin()), End, Expr.
begin());
567 *std::prev(End) = dwarf::DW_OP_deref;
569 NeedDeclareExpressionUpgrade =
true;
575 while (!SubExpr.empty()) {
580 switch (SubExpr.front()) {
584 case dwarf::DW_OP_constu:
585 case dwarf::DW_OP_minus:
586 case dwarf::DW_OP_plus:
596 HistoricSize = std::min(SubExpr.size(), HistoricSize);
599 switch (SubExpr.front()) {
600 case dwarf::DW_OP_plus:
601 Buffer.
push_back(dwarf::DW_OP_plus_uconst);
602 Buffer.
append(Args.begin(), Args.end());
604 case dwarf::DW_OP_minus:
606 Buffer.
append(Args.begin(), Args.end());
611 Buffer.
append(Args.begin(), Args.end());
616 SubExpr = SubExpr.slice(HistoricSize);
629 void upgradeDebugInfo() {
630 upgradeCUSubprograms();
631 upgradeCUVariables();
639 : MetadataList(TheModule.getContext(), Stream.SizeInBytes()),
640 ValueList(ValueList), Stream(Stream), Context(TheModule.getContext()),
641 TheModule(TheModule), getTypeByID(
std::move(getTypeByID)),
642 IsImporting(IsImporting) {}
644 Error parseMetadata(
bool ModuleLevel);
646 bool hasFwdRefs()
const {
return MetadataList.hasFwdRefs(); }
649 if (ID < MDStringRef.size())
650 return lazyLoadOneMDString(ID);
651 if (
auto *MD = MetadataList.lookup(ID))
655 if (ID < (MDStringRef.size() + GlobalMetadataBitPosIndex.size())) {
656 PlaceholderQueue Placeholders;
657 lazyLoadOneMetadata(ID, Placeholders);
658 resolveForwardRefsAndPlaceholders(Placeholders);
659 return MetadataList.lookup(ID);
661 return MetadataList.getMetadataFwdRef(ID);
665 return FunctionsWithSPs.
lookup(F);
670 Error parseMetadataAttachment(
673 Error parseMetadataKinds();
678 unsigned size()
const {
return MetadataList.size(); }
679 void shrinkTo(
unsigned N) { MetadataList.shrinkTo(N); }
684 MetadataLoader::MetadataLoaderImpl::lazyLoadModuleMetadataBlock() {
685 IndexCursor = Stream;
695 switch (Entry.
Kind) {
698 return error(
"Malformed block");
709 unsigned Code = MaybeCode.
get();
714 return std::move(Err);
721 return MaybeRecord.takeError();
722 unsigned NumStrings = Record[0];
723 MDStringRef.
reserve(NumStrings);
724 auto IndexNextMDString = [&](
StringRef Str) {
725 MDStringRef.push_back(Str);
727 if (
auto Err = parseMetadataStrings(Record, Blob, IndexNextMDString))
728 return std::move(Err);
735 return std::move(Err);
741 return MaybeRecord.takeError();
742 if (Record.
size() != 2)
743 return error(
"Invalid record");
744 auto Offset = Record[0] + (Record[1] << 32);
747 return std::move(Err);
753 Entry = MaybeEntry.
get();
755 "Corrupted bitcode: Expected `Record` when trying to find the " 761 "Corrupted bitcode: Expected `METADATA_INDEX` when trying to " 762 "find the Metadata index");
766 auto CurrentValue = BeginPos;
767 GlobalMetadataBitPosIndex.reserve(Record.
size());
768 for (
auto &Elt : Record) {
770 GlobalMetadataBitPosIndex.push_back(CurrentValue);
777 return error(
"Corrupted Metadata block");
781 return std::move(Err);
787 Code = MaybeCode.
get();
795 Code = MaybeCode.
get();
806 return MaybeNextBitCode.takeError();
811 for (
unsigned i = 0; i !=
Size; ++i) {
816 MDNode *MD = MetadataList.getMDNodeFwdRefOrNull(Record[i]);
817 assert(MD &&
"Invalid metadata: expect fwd ref to MDNode");
826 return std::move(Err);
832 return MaybeRecord.takeError();
833 if (Record.
size() % 2 == 0)
834 return error(
"Invalid record");
835 unsigned ValueID = Record[0];
836 if (ValueID >= ValueList.
size())
837 return error(
"Invalid record");
838 if (
auto *GO = dyn_cast<GlobalObject>(ValueList[ValueID]))
839 if (
Error Err = parseGlobalObjectAttachment(
841 return std::move(Err);
881 GlobalMetadataBitPosIndex.clear();
893 if (!ModuleLevel && MetadataList.hasFwdRefs())
894 return error(
"Invalid metadata: fwd refs into function blocks");
904 PlaceholderQueue Placeholders;
908 if (ModuleLevel && IsImporting && MetadataList.empty() &&
910 auto SuccessOrErr = lazyLoadModuleMetadataBlock();
912 return SuccessOrErr.takeError();
913 if (SuccessOrErr.get()) {
916 MetadataList.resize(MDStringRef.size() +
917 GlobalMetadataBitPosIndex.size());
921 resolveForwardRefsAndPlaceholders(Placeholders);
939 unsigned NextMetadataNo = MetadataList.size();
948 switch (Entry.
Kind) {
951 return error(
"Malformed block");
953 resolveForwardRefsAndPlaceholders(Placeholders);
967 if (
Error Err = parseOneMetadata(Record, MaybeCode.get(), Placeholders,
968 Blob, NextMetadataNo))
971 return MaybeCode.takeError();
975 MDString *MetadataLoader::MetadataLoaderImpl::lazyLoadOneMDString(
unsigned ID) {
977 if (
Metadata *MD = MetadataList.lookup(ID))
978 return cast<MDString>(MD);
980 MetadataList.assignValue(MDS, ID);
984 void MetadataLoader::MetadataLoaderImpl::lazyLoadOneMetadata(
985 unsigned ID, PlaceholderQueue &Placeholders) {
986 assert(ID < (MDStringRef.size()) + GlobalMetadataBitPosIndex.size());
987 assert(ID >= MDStringRef.size() &&
"Unexpected lazy-loading of MDString");
989 if (
auto *MD = MetadataList.lookup(ID)) {
990 auto *N = cast<MDNode>(MD);
991 if (!N->isTemporary())
997 GlobalMetadataBitPosIndex[ID - MDStringRef.size()]))
1006 ++NumMDRecordLoaded;
1010 parseOneMetadata(Record, MaybeCode.get(), Placeholders, Blob,
ID))
1019 void MetadataLoader::MetadataLoaderImpl::resolveForwardRefsAndPlaceholders(
1020 PlaceholderQueue &Placeholders) {
1024 Placeholders.getTemporaries(MetadataList, Temporaries);
1027 if (Temporaries.
empty() && !MetadataList.hasFwdRefs())
1032 for (
auto ID : Temporaries)
1033 lazyLoadOneMetadata(ID, Placeholders);
1034 Temporaries.clear();
1038 while (MetadataList.hasFwdRefs())
1039 lazyLoadOneMetadata(MetadataList.getNextFwdRef(), Placeholders);
1044 MetadataList.tryToResolveCycles();
1048 Placeholders.flush(MetadataList);
1051 Error MetadataLoader::MetadataLoaderImpl::parseOneMetadata(
1053 PlaceholderQueue &Placeholders,
StringRef Blob,
unsigned &NextMetadataNo) {
1055 bool IsDistinct =
false;
1056 auto getMD = [&](
unsigned ID) ->
Metadata * {
1057 if (ID < MDStringRef.size())
1058 return lazyLoadOneMDString(ID);
1060 if (
auto *MD = MetadataList.lookup(ID))
1064 if (ID < (MDStringRef.size() + GlobalMetadataBitPosIndex.size())) {
1068 MetadataList.getMetadataFwdRef(NextMetadataNo);
1069 lazyLoadOneMetadata(ID, Placeholders);
1070 return MetadataList.lookup(ID);
1073 return MetadataList.getMetadataFwdRef(ID);
1075 if (
auto *MD = MetadataList.getMetadataIfResolved(ID))
1077 return &Placeholders.getPlaceholderOp(ID);
1079 auto getMDOrNull = [&](
unsigned ID) ->
Metadata * {
1081 return getMD(ID - 1);
1084 auto getMDOrNullWithoutPlaceholders = [&](
unsigned ID) ->
Metadata * {
1086 return MetadataList.getMetadataFwdRef(ID - 1);
1089 auto getMDString = [&](
unsigned ID) ->
MDString * {
1092 auto MDS = getMDOrNull(ID);
1093 return cast_or_null<MDString>(MDS);
1097 auto getDITypeRefOrNull = [&](
unsigned ID) {
1098 return MetadataList.upgradeTypeRef(getMDOrNull(ID));
1101 #define GET_OR_DISTINCT(CLASS, ARGS) \ 1102 (IsDistinct ? CLASS::getDistinct ARGS : CLASS::get ARGS) 1114 Code = MaybeCode.
get();
1116 ++NumMDRecordLoaded;
1119 return error(
"METADATA_NAME not followed by METADATA_NAMED_NODE");
1121 return MaybeNextBitCode.takeError();
1126 for (
unsigned i = 0; i !=
Size; ++i) {
1127 MDNode *MD = MetadataList.getMDNodeFwdRefOrNull(Record[i]);
1129 return error(
"Invalid named metadata: expect fwd ref to MDNode");
1138 if (Record.
size() % 2 == 1)
1139 return error(
"Invalid record");
1143 auto dropRecord = [&] {
1147 if (Record.
size() != 2) {
1152 Type *Ty = getTypeByID(Record[0]);
1158 MetadataList.assignValue(
1166 if (Record.
size() % 2 == 1)
1167 return error(
"Invalid record");
1171 for (
unsigned i = 0; i !=
Size; i += 2) {
1172 Type *Ty = getTypeByID(Record[i]);
1174 return error(
"Invalid record");
1180 assert(isa<ConstantAsMetadata>(MD) &&
1181 "Expected non-function-local metadata");
1186 MetadataList.assignValue(
MDNode::get(Context, Elts), NextMetadataNo);
1191 if (Record.
size() != 2)
1192 return error(
"Invalid record");
1194 Type *Ty = getTypeByID(Record[0]);
1196 return error(
"Invalid record");
1198 MetadataList.assignValue(
1210 for (
unsigned ID : Record)
1219 if (Record.
size() != 5 && Record.
size() != 6)
1220 return error(
"Invalid record");
1222 IsDistinct = Record[0];
1223 unsigned Line = Record[1];
1224 unsigned Column = Record[2];
1226 Metadata *InlinedAt = getMDOrNull(Record[4]);
1227 bool ImplicitCode = Record.
size() == 6 && Record[5];
1228 MetadataList.assignValue(
1236 if (Record.
size() < 4)
1237 return error(
"Invalid record");
1239 IsDistinct = Record[0];
1240 unsigned Tag = Record[1];
1243 if (Tag >= 1u << 16 || Version != 0)
1244 return error(
"Invalid record");
1246 auto *Header = getMDString(Record[3]);
1248 for (
unsigned I = 4,
E = Record.
size(); I !=
E; ++
I)
1249 DwarfOps.
push_back(getMDOrNull(Record[I]));
1250 MetadataList.assignValue(
1261 switch (Record[0] >> 1) {
1264 (Context, Record[1], unrotateSign(Record.
back())));
1268 unrotateSign(Record.
back())));
1271 return error(
"Invalid record: Unsupported version of DISubrange");
1274 MetadataList.assignValue(Val, NextMetadataNo);
1275 IsDistinct = Record[0] & 1;
1280 if (Record.
size() != 3)
1281 return error(
"Invalid record");
1283 IsDistinct = Record[0] & 1;
1284 bool IsUnsigned = Record[0] & 2;
1285 MetadataList.assignValue(
1287 IsUnsigned, getMDString(Record[2]))),
1293 if (Record.
size() < 6 || Record.
size() > 7)
1294 return error(
"Invalid record");
1296 IsDistinct = Record[0];
1298 static_cast<DINode::DIFlags>(Record[6]) : DINode::FlagZero;
1300 MetadataList.assignValue(
1302 (Context, Record[1], getMDString(Record[2]), Record[3],
1303 Record[4], Record[5], Flags)),
1309 if (Record.
size() < 12 || Record.
size() > 13)
1310 return error(
"Invalid record");
1315 if (Record.
size() > 12 && Record[12])
1316 DWARFAddressSpace = Record[12] - 1;
1318 IsDistinct = Record[0];
1320 MetadataList.assignValue(
1322 (Context, Record[1], getMDString(Record[2]),
1323 getMDOrNull(Record[3]), Record[4],
1324 getDITypeRefOrNull(Record[5]),
1325 getDITypeRefOrNull(Record[6]), Record[7], Record[8],
1326 Record[9], DWARFAddressSpace, Flags,
1327 getDITypeRefOrNull(Record[11]))),
1333 if (Record.
size() < 16 || Record.
size() > 17)
1334 return error(
"Invalid record");
1338 IsDistinct = Record[0] & 0x1;
1339 bool IsNotUsedInTypeRef = Record[0] >= 2;
1340 unsigned Tag = Record[1];
1343 unsigned Line = Record[4];
1346 uint64_t SizeInBits = Record[7];
1348 return error(
"Alignment value is too large");
1350 uint64_t OffsetInBits = 0;
1353 unsigned RuntimeLang = Record[12];
1355 Metadata *TemplateParams =
nullptr;
1357 auto *Identifier = getMDString(Record[15]);
1366 (Tag == dwarf::DW_TAG_enumeration_type ||
1367 Tag == dwarf::DW_TAG_class_type ||
1368 Tag == dwarf::DW_TAG_structure_type ||
1369 Tag == dwarf::DW_TAG_union_type)) {
1370 Flags = Flags | DINode::FlagFwdDecl;
1372 BaseType = getDITypeRefOrNull(Record[6]);
1373 OffsetInBits = Record[9];
1374 Elements = getMDOrNull(Record[11]);
1375 VTableHolder = getDITypeRefOrNull(Record[13]);
1376 TemplateParams = getMDOrNull(Record[14]);
1377 if (Record.
size() > 16)
1378 Discriminator = getMDOrNull(Record[16]);
1383 Context, *Identifier, Tag, Name, File, Line, Scope, BaseType,
1384 SizeInBits, AlignInBits, OffsetInBits, Flags, Elements, RuntimeLang,
1385 VTableHolder, TemplateParams, Discriminator);
1390 (Context, Tag, Name, File, Line, Scope, BaseType,
1391 SizeInBits, AlignInBits, OffsetInBits, Flags,
1392 Elements, RuntimeLang, VTableHolder, TemplateParams,
1393 Identifier, Discriminator));
1394 if (!IsNotUsedInTypeRef && Identifier)
1395 MetadataList.addTypeRef(*Identifier, *cast<DICompositeType>(CT));
1397 MetadataList.assignValue(CT, NextMetadataNo);
1402 if (Record.
size() < 3 || Record.
size() > 4)
1403 return error(
"Invalid record");
1404 bool IsOldTypeRefArray = Record[0] < 2;
1405 unsigned CC = (Record.
size() > 3) ? Record[3] : 0;
1407 IsDistinct = Record[0] & 0x1;
1409 Metadata *Types = getMDOrNull(Record[2]);
1411 Types = MetadataList.upgradeTypeRefArray(Types);
1413 MetadataList.assignValue(
1421 if (Record.
size() != 6)
1422 return error(
"Invalid record");
1424 IsDistinct = Record[0];
1425 MetadataList.assignValue(
1427 (Context, getMDOrNull(Record[1]),
1428 getMDString(Record[2]), getMDString(Record[3]),
1429 getMDString(Record[4]), getMDString(Record[5]))),
1436 if (Record.
size() != 3 && Record.
size() != 5 && Record.
size() != 6)
1437 return error(
"Invalid record");
1439 IsDistinct = Record[0];
1446 if (Record.
size() > 4 && Record[3] && Record[4])
1447 Checksum.
emplace(static_cast<DIFile::ChecksumKind>(Record[3]),
1448 getMDString(Record[4]));
1449 MetadataList.assignValue(
1452 (Context, getMDString(Record[1]), getMDString(Record[2]), Checksum,
1460 if (Record.
size() < 14 || Record.
size() > 19)
1461 return error(
"Invalid record");
1467 Context, Record[1], getMDOrNull(Record[2]), getMDString(Record[3]),
1468 Record[4], getMDString(Record[5]), Record[6], getMDString(Record[7]),
1469 Record[8], getMDOrNull(Record[9]), getMDOrNull(Record[10]),
1470 getMDOrNull(Record[12]), getMDOrNull(Record[13]),
1471 Record.
size() <= 15 ? nullptr : getMDOrNull(Record[15]),
1472 Record.
size() <= 14 ? 0 : Record[14],
1473 Record.
size() <= 16 ?
true : Record[16],
1474 Record.
size() <= 17 ?
false : Record[17],
1475 Record.
size() <= 18 ? 0 : Record[18],
1476 Record.
size() <= 19 ? 0 : Record[19]);
1478 MetadataList.assignValue(
CU, NextMetadataNo);
1482 if (
Metadata *SPs = getMDOrNullWithoutPlaceholders(Record[11]))
1483 CUSubprograms.push_back({
CU, SPs});
1487 if (Record.
size() < 18 || Record.
size() > 21)
1488 return error(
"Invalid record");
1490 bool HasSPFlags = Record[0] & 4;
1503 const unsigned DIFlagMainSubprogram = 1 << 21;
1504 bool HasOldMainSubprogramFlag = Flags & DIFlagMainSubprogram;
1505 if (HasOldMainSubprogramFlag)
1511 if (HasOldMainSubprogramFlag && HasSPFlags)
1512 SPFlags |= DISubprogram::SPFlagMainSubprogram;
1513 else if (!HasSPFlags)
1515 Record[7], Record[8],
1516 Record[14], Record[11],
1517 HasOldMainSubprogramFlag);
1520 IsDistinct = (Record[0] & 1) || (SPFlags & DISubprogram::SPFlagDefinition);
1526 bool HasUnit = Record[0] & 2;
1527 if (!HasSPFlags && HasUnit && Record.
size() < 19)
1528 return error(
"Invalid record");
1529 if (HasSPFlags && !HasUnit)
1530 return error(
"Invalid record");
1533 bool HasThisAdj =
true;
1534 bool HasThrownTypes =
true;
1535 unsigned OffsetA = 0;
1536 unsigned OffsetB = 0;
1540 if (Record.
size() >= 19) {
1544 HasThisAdj = Record.
size() >= 20;
1545 HasThrownTypes = Record.
size() >= 21;
1547 Metadata *CUorFn = getMDOrNull(Record[12 + OffsetB]);
1551 getDITypeRefOrNull(Record[1]),
1552 getMDString(Record[2]),
1553 getMDString(Record[3]),
1554 getMDOrNull(Record[4]),
1556 getMDOrNull(Record[6]),
1557 Record[7 + OffsetA],
1558 getDITypeRefOrNull(Record[8 + OffsetA]),
1559 Record[10 + OffsetA],
1560 HasThisAdj ? Record[16 + OffsetB] : 0,
1563 HasUnit ? CUorFn :
nullptr,
1564 getMDOrNull(Record[13 + OffsetB]),
1565 getMDOrNull(Record[14 + OffsetB]),
1566 getMDOrNull(Record[15 + OffsetB]),
1567 HasThrownTypes ? getMDOrNull(Record[17 + OffsetB])
1570 MetadataList.assignValue(SP, NextMetadataNo);
1575 if (
auto *CMD = dyn_cast_or_null<ConstantAsMetadata>(CUorFn))
1576 if (
auto *F = dyn_cast<Function>(CMD->getValue())) {
1580 FunctionsWithSPs[F] = SP;
1581 else if (!F->
empty())
1588 if (Record.
size() != 5)
1589 return error(
"Invalid record");
1591 IsDistinct = Record[0];
1592 MetadataList.assignValue(
1594 (Context, getMDOrNull(Record[1]),
1595 getMDOrNull(Record[2]), Record[3], Record[4])),
1601 if (Record.
size() != 4)
1602 return error(
"Invalid record");
1604 IsDistinct = Record[0];
1605 MetadataList.assignValue(
1607 (Context, getMDOrNull(Record[1]),
1608 getMDOrNull(Record[2]), Record[3])),
1614 IsDistinct = Record[0] & 1;
1615 MetadataList.assignValue(
1617 (Context, getMDOrNull(Record[1]),
1618 getMDOrNull(Record[2]), getMDString(Record[3]),
1619 getMDOrNull(Record[4]), Record[5])),
1627 if (Record.
size() == 3)
1628 Name = getMDString(Record[2]);
1629 else if (Record.
size() == 5)
1630 Name = getMDString(Record[3]);
1632 return error(
"Invalid record");
1634 IsDistinct = Record[0] & 1;
1635 bool ExportSymbols = Record[0] & 2;
1636 MetadataList.assignValue(
1638 (Context, getMDOrNull(Record[1]), Name, ExportSymbols)),
1644 if (Record.
size() != 5)
1645 return error(
"Invalid record");
1647 IsDistinct = Record[0];
1648 MetadataList.assignValue(
1650 (Context, Record[1], Record[2], getMDString(Record[3]),
1651 getMDString(Record[4]))),
1657 if (Record.
size() != 5)
1658 return error(
"Invalid record");
1660 IsDistinct = Record[0];
1661 MetadataList.assignValue(
1663 (Context, Record[1], Record[2], getMDOrNull(Record[3]),
1664 getMDOrNull(Record[4]))),
1670 if (Record.
size() != 3)
1671 return error(
"Invalid record");
1673 IsDistinct = Record[0];
1675 (Context, getMDString(Record[1]),
1676 getDITypeRefOrNull(Record[2]))),
1682 if (Record.
size() != 5)
1683 return error(
"Invalid record");
1685 IsDistinct = Record[0];
1686 MetadataList.assignValue(
1688 (Context, Record[1], getMDString(Record[2]),
1689 getDITypeRefOrNull(Record[3]),
1690 getMDOrNull(Record[4]))),
1696 if (Record.
size() < 11 || Record.
size() > 13)
1697 return error(
"Invalid record");
1699 IsDistinct = Record[0] & 1;
1700 unsigned Version = Record[0] >> 1;
1703 MetadataList.assignValue(
1706 (Context, getMDOrNull(Record[1]), getMDString(Record[2]),
1707 getMDString(Record[3]), getMDOrNull(Record[4]), Record[5],
1708 getDITypeRefOrNull(Record[6]), Record[7], Record[8],
1709 getMDOrNull(Record[9]), getMDOrNull(Record[10]), Record[11])),
1713 }
else if (Version == 1) {
1716 MetadataList.assignValue(
1718 (Context, getMDOrNull(Record[1]),
1719 getMDString(Record[2]), getMDString(Record[3]),
1720 getMDOrNull(Record[4]), Record[5],
1721 getDITypeRefOrNull(Record[6]), Record[7], Record[8],
1722 getMDOrNull(Record[10]),
nullptr, Record[11])),
1726 }
else if (Version == 0) {
1729 NeedUpgradeToDIGlobalVariableExpression =
true;
1730 Metadata *Expr = getMDOrNull(Record[9]);
1732 if (Record.
size() > 11) {
1734 return error(
"Alignment value is too large");
1735 AlignInBits = Record[11];
1738 if (
auto *CMD = dyn_cast_or_null<ConstantAsMetadata>(Expr)) {
1739 if (
auto *GV = dyn_cast<GlobalVariable>(CMD->getValue())) {
1742 }
else if (
auto *CI = dyn_cast<ConstantInt>(CMD->getValue())) {
1744 {dwarf::DW_OP_constu, CI->getZExtValue(),
1745 dwarf::DW_OP_stack_value});
1752 (Context, getMDOrNull(Record[1]), getMDString(Record[2]),
1753 getMDString(Record[3]), getMDOrNull(Record[4]), Record[5],
1754 getDITypeRefOrNull(Record[6]), Record[7], Record[8],
1755 getMDOrNull(Record[10]),
nullptr, AlignInBits));
1764 auto *
MDNode = Expr ? cast<Metadata>(DGVE) : cast<Metadata>(DGV);
1765 MetadataList.assignValue(
MDNode, NextMetadataNo);
1768 return error(
"Invalid record");
1774 if (Record.
size() < 8 || Record.
size() > 10)
1775 return error(
"Invalid record");
1777 IsDistinct = Record[0] & 1;
1778 bool HasAlignment = Record[0] & 2;
1782 bool HasTag = !HasAlignment && Record.
size() > 8;
1787 return error(
"Alignment value is too large");
1788 AlignInBits = Record[8 + HasTag];
1790 MetadataList.assignValue(
1792 (Context, getMDOrNull(Record[1 + HasTag]),
1793 getMDString(Record[2 + HasTag]),
1794 getMDOrNull(Record[3 + HasTag]), Record[4 + HasTag],
1795 getDITypeRefOrNull(Record[5 + HasTag]),
1796 Record[6 + HasTag], Flags, AlignInBits)),
1802 if (Record.
size() != 5)
1803 return error(
"Invalid record");
1805 IsDistinct = Record[0] & 1;
1806 MetadataList.assignValue(
1808 (Context, getMDOrNull(Record[1]),
1809 getMDString(Record[2]),
1810 getMDOrNull(Record[3]), Record[4])),
1816 if (Record.
size() < 1)
1817 return error(
"Invalid record");
1819 IsDistinct = Record[0] & 1;
1820 uint64_t
Version = Record[0] >> 1;
1824 if (
Error Err = upgradeDIExpression(Version, Elts, Buffer))
1827 MetadataList.assignValue(
1833 if (Record.
size() != 3)
1834 return error(
"Invalid record");
1836 IsDistinct = Record[0];
1837 Metadata *Expr = getMDOrNull(Record[2]);
1840 MetadataList.assignValue(
1842 (Context, getMDOrNull(Record[1]), Expr)),
1848 if (Record.
size() != 8)
1849 return error(
"Invalid record");
1851 IsDistinct = Record[0];
1852 MetadataList.assignValue(
1854 (Context, getMDString(Record[1]),
1855 getMDOrNull(Record[2]), Record[3],
1856 getMDString(Record[4]), getMDString(Record[5]),
1857 Record[6], getDITypeRefOrNull(Record[7]))),
1863 if (Record.
size() != 6 && Record.
size() != 7)
1864 return error(
"Invalid record");
1866 IsDistinct = Record[0];
1867 bool HasFile = (Record.
size() == 7);
1868 MetadataList.assignValue(
1870 (Context, Record[1], getMDOrNull(Record[2]),
1871 getDITypeRefOrNull(Record[3]),
1872 HasFile ? getMDOrNull(Record[6]) :
nullptr,
1873 HasFile ? Record[4] : 0, getMDString(Record[5]))),
1883 ++NumMDStringLoaded;
1885 MetadataList.assignValue(MD, NextMetadataNo);
1890 auto CreateNextMDString = [&](
StringRef Str) {
1891 ++NumMDStringLoaded;
1892 MetadataList.assignValue(
MDString::get(Context, Str), NextMetadataNo);
1895 if (
Error Err = parseMetadataStrings(Record, Blob, CreateNextMDString))
1900 if (Record.
size() % 2 == 0)
1901 return error(
"Invalid record");
1902 unsigned ValueID = Record[0];
1903 if (ValueID >= ValueList.
size())
1904 return error(
"Invalid record");
1905 if (
auto *GO = dyn_cast<GlobalObject>(ValueList[ValueID]))
1906 if (
Error Err = parseGlobalObjectAttachment(
1914 if (
Error Err = parseMetadataKindRecord(Record))
1920 #undef GET_OR_DISTINCT 1923 Error MetadataLoader::MetadataLoaderImpl::parseMetadataStrings(
1929 if (Record.
size() != 2)
1930 return error(
"Invalid record: metadata strings layout");
1932 unsigned NumStrings = Record[0];
1933 unsigned StringsOffset = Record[1];
1935 return error(
"Invalid record: metadata strings with no strings");
1936 if (StringsOffset > Blob.
size())
1937 return error(
"Invalid record: metadata strings corrupt offset");
1945 return error(
"Invalid record: metadata strings bad length");
1952 return error(
"Invalid record: metadata strings truncated chars");
1954 CallBack(Strings.
slice(0, Size));
1956 }
while (--NumStrings);
1961 Error MetadataLoader::MetadataLoaderImpl::parseGlobalObjectAttachment(
1964 for (
unsigned I = 0,
E = Record.
size(); I !=
E; I += 2) {
1965 auto K = MDKindMap.
find(Record[I]);
1966 if (K == MDKindMap.
end())
1967 return error(
"Invalid ID");
1968 MDNode *MD = MetadataList.getMDNodeFwdRefOrNull(Record[I + 1]);
1970 return error(
"Invalid metadata attachment: expect fwd ref to MDNode");
1983 PlaceholderQueue Placeholders;
1991 switch (Entry.
Kind) {
1994 return error(
"Malformed block");
1996 resolveForwardRefsAndPlaceholders(Placeholders);
2005 ++NumMDRecordLoaded;
2009 switch (MaybeRecord.
get()) {
2013 unsigned RecordLength = Record.
size();
2015 return error(
"Invalid record");
2016 if (RecordLength % 2 == 0) {
2018 if (
Error Err = parseGlobalObjectAttachment(F, Record))
2025 for (
unsigned i = 1; i != RecordLength; i = i + 2) {
2026 unsigned Kind = Record[i];
2028 if (I == MDKindMap.
end())
2029 return error(
"Invalid ID");
2030 if (I->second == LLVMContext::MD_tbaa && StripTBAA)
2033 auto Idx = Record[i + 1];
2034 if (Idx < (MDStringRef.size() + GlobalMetadataBitPosIndex.size()) &&
2035 !MetadataList.lookup(Idx)) {
2038 lazyLoadOneMetadata(Idx, Placeholders);
2039 resolveForwardRefsAndPlaceholders(Placeholders);
2042 Metadata *Node = MetadataList.getMetadataFwdRef(Idx);
2043 if (isa<LocalAsMetadata>(Node))
2047 MDNode *MD = dyn_cast_or_null<MDNode>(Node);
2049 return error(
"Invalid metadata attachment");
2051 if (HasSeenOldLoopTags && I->second == LLVMContext::MD_loop)
2054 if (I->second == LLVMContext::MD_tbaa) {
2067 Error MetadataLoader::MetadataLoaderImpl::parseMetadataKindRecord(
2069 if (Record.
size() < 2)
2070 return error(
"Invalid record");
2072 unsigned Kind = Record[0];
2076 if (!MDKindMap.
insert(std::make_pair(Kind, NewKind)).second)
2077 return error(
"Conflicting METADATA_KIND records");
2095 switch (Entry.
Kind) {
2098 return error(
"Malformed block");
2108 ++NumMDRecordLoaded;
2112 switch (MaybeCode.
get()) {
2116 if (
Error Err = parseMetadataKindRecord(Record))
2125 Pimpl = std::move(RHS.Pimpl);
2129 : Pimpl(
std::move(RHS.Pimpl)) {}
2137 Stream, TheModule, ValueList,
std::move(getTypeByID), IsImporting)) {}
2139 Error MetadataLoader::parseMetadata(
bool ModuleLevel) {
2140 return Pimpl->parseMetadata(ModuleLevel);
2148 return Pimpl->getMetadataFwdRefOrLoad(Idx);
2152 return Pimpl->lookupSubprogramForFunction(F);
2157 return Pimpl->parseMetadataAttachment(F, InstructionList);
2161 return Pimpl->parseMetadataKinds();
2165 return Pimpl->setStripTBAA(StripTBAA);
2174 return Pimpl->upgradeDebugIntrinsics(F);
Scope
Defines the scope in which this symbol should be visible: Default – Visible in the public interface ...
bool mayBeOldLoopAttachmentTag(StringRef Name)
Check whether a string looks like an old loop attachment tag.
reference emplace_back(ArgTypes &&... Args)
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata *> MDs)
Atomic ordering constants.
bool isMetadataTy() const
Return true if this is 'metadata'.
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
This class represents lattice values for constants.
uint64_t GetCurrentBitNo() const
Return the bit # of the bit we are reading.
A Module instance is used to store all the information related to an LLVM module. ...
#define LLVM_UNLIKELY(EXPR)
#define LLVM_LIKELY(EXPR)
amdgpu Simplify well known AMD library false FunctionCallee Value const Twine & Name
Tracking metadata reference.
static MDString * get(LLVMContext &Context, StringRef Str)
void push_back(const T &Elt)
void addOperand(MDNode *M)
Expected< uint32_t > ReadVBR(unsigned NumBits)
static bool lookup(const GsymReader &GR, DataExtractor &Data, uint64_t &Offset, uint64_t BaseAddr, uint64_t Addr, SourceLocations &SrcLocs, llvm::Error &Err)
A Lookup helper functions.
void emplace(ArgTypes &&... Args)
Create a new object by constructing it in place with the given arguments.
static DISPFlags toSPFlags(bool IsLocalToUnit, bool IsDefinition, bool IsOptimized, unsigned Virtuality=SPFlagNonvirtual, bool IsMainSubprogram=false)
An efficient, type-erasing, non-owning reference to a callable.
This file contains the declaration of the Comdat class, which represents a single COMDAT in LLVM...
NamedMDNode * getOrInsertNamedMetadata(StringRef Name)
Return the named MDNode in the module with the specified name.
bool erase(const ValueT &V)
STATISTIC(NumFunctions, "Total number of functions")
block Block Frequency true
If this flag is used, the advance() method does not automatically pop the block scope when the end of...
Error takeError()
Take ownership of the stored error.
void reserve(size_type N)
bool isForwardDecl() const
std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)
std::string toString(Error E)
Write all error messages (if any) in E to a string.
MDNode * upgradeInstructionLoopAttachment(MDNode &N)
Upgrade the loop attachment metadata node.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
LLVM_NODISCARD StringRef drop_front(size_t N=1) const
Return a StringRef equal to 'this' but with the first N elements dropped.
The access may reference the value stored in memory.
std::error_code make_error_code(BitcodeError E)
This file contains the simple types necessary to represent the attributes associated with functions a...
Error SkipBlock()
Having read the ENTER_SUBBLOCK abbrevid and a BlockID, skip over the body of this block...
LLVM_NODISCARD StringRef slice(size_t Start, size_t End) const
Return a reference to the substring from [Start, End).
static TempMDTuple getTemporary(LLVMContext &Context, ArrayRef< Metadata *> MDs)
Placeholder metadata for operands of distinct MDNodes.
Only used in LLVM metadata.
Tagged union holding either a T or a Error.
This file implements a class to represent arbitrary precision integral constant values and operations...
Expected< unsigned > ReadCode()
Expected< unsigned > skipRecord(unsigned AbbrevID)
Read the current record and discard it, returning the code for the record.
NamedMDNode * getNamedMetadata(const Twine &Name) const
Return the first NamedMDNode in the module with the specified name.
LLVM_NODISCARD size_t size() const
size - Get the string size.
iterator find(const_arg_type_t< KeyT > Val)
bool isVoidTy() const
Return true if this is 'void'.
static TempMDTuple getTemporary(LLVMContext &Context, ArrayRef< Metadata *> MDs)
Return a temporary node.
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata *> MDs)
initializer< Ty > init(const Ty &Val)
void setSubprogram(DISubprogram *SP)
Set the attached subprogram.
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...
The instances of the Type class are immutable: once they are created, they are never changed...
This is an important class for using LLVM in a threaded context.
Instrumentation for Order File
size_t size() const
size - Get the array size.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This represents a position within a bitcode file, implemented on top of a SimpleBitstreamCursor.
static MDTuple * getDistinct(LLVMContext &Context, ArrayRef< Metadata *> MDs)
This file contains the declarations for the subclasses of Constant, which represent the different fla...
std::pair< iterator, bool > insert(const ValueT &V)
A pair of DIGlobalVariable and DIExpression.
This file declares a class to represent arbitrary precision floating point values and provide a varie...
bool isMaterializable() const
void consumeError(Error Err)
Consume a Error without doing anything.
void setMetadata(unsigned KindID, MDNode *Node)
Set the metadata of the specified kind to the specified node.
An imported module (C++ using directive or similar).
Error JumpToBit(uint64_t BitNo)
Reset the stream to the specified bit number.
Expected< unsigned > readRecord(unsigned AbbrevID, SmallVectorImpl< uint64_t > &Vals, StringRef *Blob=nullptr)
constexpr bool empty(const T &RangeOrContainer)
Test whether RangeOrContainer is empty. Similar to C++17 std::empty.
BaseType
A given derived pointer can have multiple base pointers through phi/selects.
static ErrorSuccess success()
Create a success value.
When advancing through a bitstream cursor, each advance can discover a few different kinds of entries...
auto size(R &&Range, typename std::enable_if< std::is_same< typename std::iterator_traits< decltype(Range.begin())>::iterator_category, std::random_access_iterator_tag >::value, void >::type *=nullptr) -> decltype(std::distance(Range.begin(), Range.end()))
Get the size of a range.
Align max(MaybeAlign Lhs, Align Rhs)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
Module.h This file contains the declarations for the Module class.
void addMetadata(unsigned KindID, MDNode &MD)
Add a metadata attachment.
std::pair< llvm::MachO::Target, std::string > UUID
reference get()
Returns a reference to the stored T value.
Implements a dense probed hash-table based set with some number of buckets stored inline...
MDNode * UpgradeTBAANode(MDNode &TBAANode)
If the given TBAA tag uses the scalar TBAA format, create a new node corresponding to the upgrade to ...
Value * getValueFwdRef(unsigned Idx, Type *Ty, Type **FullTy=nullptr)
A (clang) module that has been imported by the compile unit.
Generic tagged DWARF-like metadata node.
static void clear(coro::Shape &Shape)
void append(in_iter in_start, in_iter in_end)
Add the specified range to the end of the SmallVector.
Type array for a subprogram.
Error EnterSubBlock(unsigned BlockID, unsigned *NumWordsP=nullptr)
Having read the ENTER_SUBBLOCK abbrevid, and enter the block.
MDString * getRawIdentifier() const
LLVM_NODISCARD bool empty() const
Expected< BitstreamEntry > advanceSkippingSubblocks(unsigned Flags=0)
This is a convenience function for clients that don't expect any subblocks.
DISPFlags
Debug info subprogram flags.
ValueT lookup(const_arg_type_t< KeyT > Val) const
lookup - Return the entry for the specified key, or a default constructed value if no such entry exis...
static DICompositeType * buildODRType(LLVMContext &Context, MDString &Identifier, unsigned Tag, MDString *Name, Metadata *File, unsigned Line, Metadata *Scope, Metadata *BaseType, uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits, DIFlags Flags, Metadata *Elements, unsigned RuntimeLang, Metadata *VTableHolder, Metadata *TemplateParams, Metadata *Discriminator)
Build a DICompositeType with the given ODR identifier.
unsigned getMDKindID(StringRef Name) const
Return a unique non-zero ID for the specified metadata kind.
ModuleSummaryIndex.h This file contains the declarations the classes that hold the module index and s...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
LLVM Value Representation.
#define LLVM_FALLTHROUGH
LLVM_FALLTHROUGH - Mark fallthrough cases in switch statements.
Lightweight error class with error context and mandatory checking.
void addDebugInfo(DIGlobalVariableExpression *GV)
Attach a DIGlobalVariableExpression.
print Print MemDeps of function
iterator_range< global_iterator > globals()
StringRef - Represent a constant reference to a string, i.e.
enum llvm::BitstreamEntry::@159 Kind
This represents a position within a bitstream.
Function Alias Analysis false
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
Basic type, like 'int' or 'float'.