Lines Matching full:metadata
39 #include "llvm/IR/Metadata.h"
73 STATISTIC(NumMDRecordLoaded, "Number of Metadata records loaded");
83 cl::desc("Force disable the lazy-loading on-demand of metadata when "
91 /// Array of metadata references.
101 /// The set of indices in MetadataPtrs above of Metadata that need to be
128 void push_back(Metadata *MD) { MetadataPtrs.emplace_back(MD); }
130 Metadata *back() const { return MetadataPtrs.back(); }
134 Metadata *operator[](unsigned i) const {
139 Metadata *lookup(unsigned I) const {
152 /// Return the given metadata, creating a replaceable forward reference if
154 Metadata *getMetadataFwdRef(unsigned Idx);
156 /// Return the given metadata only if it is fully resolved.
160 Metadata *getMetadataIfResolved(unsigned Idx);
163 void assignValue(Metadata *MD, unsigned Idx);
175 Metadata *upgradeTypeRef(Metadata *MaybeUUID);
178 Metadata *upgradeTypeRefArray(Metadata *MaybeTuple);
181 Metadata *resolveTypeRefArray(Metadata *MaybeTuple);
184 void BitcodeReaderMetadataList::assignValue(Metadata *MD, unsigned Idx) {
209 Metadata *BitcodeReaderMetadataList::getMetadataFwdRef(unsigned Idx) {
217 if (Metadata *MD = MetadataPtrs[Idx])
225 Metadata *MD = MDNode::getTemporary(Context, std::nullopt).release();
230 Metadata *BitcodeReaderMetadataList::getMetadataIfResolved(unsigned Idx) {
231 Metadata *MD = lookup(Idx);
297 Metadata *BitcodeReaderMetadataList::upgradeTypeRef(Metadata *MaybeUUID) {
311 Metadata *BitcodeReaderMetadataList::upgradeTypeRefArray(Metadata *MaybeTuple) {
328 Metadata *BitcodeReaderMetadataList::resolveTypeRefArray(Metadata *MaybeTuple) {
334 SmallVector<Metadata *, 32> Ops;
336 for (Metadata *MD : Tuple->operands())
412 /// Cursor associated with the lazy-loading of Metadata. This is the easy way
414 /// the middle of the metadata block and load any record.
424 /// Index that keeps track of where to find a metadata record in the stream.
442 /// Populate the index above to enable lazily loading of metadata, and load
443 /// the named metadata as well as the transitively referenced global
444 /// Metadata.
447 /// On-demand loading of a single metadata. Requires the index above to be
453 std::vector<std::pair<DICompileUnit *, Metadata *>> CUSubprograms;
456 /// metadata.
470 /// True if metadata is being parsed for a module being ThinLTO imported.
559 SetVector<Metadata *> EntitiesToRemove;
560 for (Metadata *Op : CU->getImportedEntities()->operands()) {
569 SmallVector<Metadata *> NewImports;
570 for (Metadata *Op : CU->getImportedEntities()->operands()) {
577 std::map<DISubprogram *, SmallVector<Metadata *>> SPToEntities;
590 SmallVector<Metadata *> MDs(RetainedNodes.begin(),
722 void callMDTypeCallback(Metadata **Val, unsigned TypeID);
737 Metadata *getMetadataFwdRefOrLoad(unsigned ID) {
847 "Metadata index");
853 "find the Metadata index");
868 return error("Corrupted Metadata block");
870 // Named metadata need to be materialized now and aren't deferred.
883 // Read name of the named metadata.
890 // Named Metadata comes in two parts, we expect the name to be followed
899 // Read named metadata elements.
904 // taking MDNode as operand and not using the Metadata infrastructure.
905 // It is acknowledged by 'TODO: Inherit from Metadata' in the
908 assert(MD && "Invalid metadata: expect fwd ref to MDNode");
976 // Nothing to do if we didn't find any of these metadata records.
1048 void MetadataLoader::MetadataLoaderImpl::callMDTypeCallback(Metadata **Val,
1057 /// module level metadata.
1060 return error("Invalid metadata: fwd refs into function blocks");
1072 // We lazy-load module-level metadata: we build an index for each record, and
1073 // then load individual record as needed, starting with the named metadata.
1080 // An index was successfully created and we will be able to load metadata
1093 // Reading the named metadata created forward references and/or
1150 if (Metadata *MD = MetadataList.lookup(ID))
1161 // Lookup first if the metadata hasn't already been loaded.
1191 /// Iteratively lazy-loading metadata on-demand if needed.
1232 // Pretend that the constant was deleted, which will replace metadata
1249 auto getMD = [&](unsigned ID) -> Metadata * {
1272 auto getMDOrNull = [&](unsigned ID) -> Metadata * {
1277 auto getMDOrNullWithoutPlaceholders = [&](unsigned ID) -> Metadata * {
1301 // Read name of the named metadata.
1314 // Read named metadata elements.
1320 return error("Invalid named metadata: expect fwd ref to MDNode");
1328 // metadata.
1354 return error("Invalid value reference from old fn metadata");
1366 SmallVector<Metadata *, 8> Elts;
1377 return error("Invalid value reference from old metadata");
1378 Metadata *MD = ValueAsMetadata::get(V);
1380 "Expected non-function-local metadata");
1401 return error("Invalid value reference from metadata");
1403 Metadata *MD = ValueAsMetadata::get(V);
1413 SmallVector<Metadata *, 8> Elts;
1430 Metadata *Scope = getMD(Record[3]);
1431 Metadata *InlinedAt = getMDOrNull(Record[4]);
1452 SmallVector<Metadata *, 8> DwarfOps;
1462 Metadata *Val = nullptr;
1465 // - Metadata node (version 1)
1468 // - Metadata node (version 2)
1470 // - Metadata node (version 2)
1495 Metadata *Val = nullptr;
1554 Metadata *StringLocationExp = SizeIs8 ? nullptr : getMDOrNull(Record[5]);
1576 Metadata *Annotations = nullptr;
1613 Metadata *File = getMDOrNull(Record[3]);
1615 Metadata *Scope = getDITypeRefOrNull(Record[5]);
1616 Metadata *BaseType = nullptr;
1623 Metadata *Elements = nullptr;
1625 Metadata *VTableHolder = nullptr;
1626 Metadata *TemplateParams = nullptr;
1627 Metadata *Discriminator = nullptr;
1628 Metadata *DataLocation = nullptr;
1629 Metadata *Associated = nullptr;
1630 Metadata *Allocated = nullptr;
1631 Metadata *Rank = nullptr;
1632 Metadata *Annotations = nullptr;
1713 Metadata *Types = getMDOrNull(Record[2]);
1792 if (Metadata *SPs = getMDOrNullWithoutPlaceholders(Record[11]))
1811 // Support for old metadata when
1862 Metadata *CUorFn = getMDOrNull(Record[12 + OffsetB]);
1898 // metadata.
2029 Metadata *Annotations = nullptr;
2058 // Upgrade old metadata, which stored a global variable reference or a
2061 Metadata *Expr = getMDOrNull(Record[9]);
2095 auto *MDNode = Expr ? cast<Metadata>(DGVE) : cast<Metadata>(DGV);
2128 Metadata *Annotations = nullptr;
2183 Metadata *Expr = getMDOrNull(Record[2]);
2232 Metadata *MD = MDString::get(Context, String);
2270 Metadata *MD = getMD(Elt);
2295 return error("Invalid record: metadata strings layout");
2300 return error("Invalid record: metadata strings with no strings");
2302 return error("Invalid record: metadata strings corrupt offset");
2310 return error("Invalid record: metadata strings bad length");
2316 return error("Invalid record: metadata strings truncated chars");
2335 return error("Invalid metadata attachment: expect fwd ref to MDNode");
2341 /// Parse metadata attachments.
2367 // Read a metadata attachment record.
2406 Metadata *Node = MetadataList.getMetadataFwdRef(Idx);
2413 return error("Invalid metadata attachment");
2445 /// Parse the metadata kinds out of the METADATA_KIND_BLOCK.
2508 /// Return the given metadata, creating a replaceable forward reference if
2510 Metadata *MetadataLoader::getMetadataFwdRefOrLoad(unsigned Idx) {