MCPcopy Create free account
hub / github.com/NVIDIA/cuda-tile / getType

Method getType

lib/Bytecode/Reader/BytecodeReader.cpp:493–528  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

491 }
492
493 Type getType(uint64_t typeIndex) {
494 if (typeIndex >= typeCache.size())
495 return Type();
496 if (typeCache[typeIndex])
497 return typeCache[typeIndex];
498
499 // Check for recursion.
500 if (currentlyParsing.count(typeIndex))
501 return Type();
502 // Mark this type as currently being parsed.
503 currentlyParsing.insert(typeIndex);
504 [[maybe_unused]] llvm::scope_exit removeIndex(
505 [&] { currentlyParsing.erase(typeIndex); });
506 // Calculate the boundaries for the type data.
507 uint32_t start = typeStartIndices[typeIndex];
508 uint32_t end = (typeIndex + 1 < typeStartIndices.size())
509 ? typeStartIndices[typeIndex + 1]
510 : payload.size();
511 if (end < start || end > payload.size())
512 return Type();
513 // Parse the type from its specific byte slice.
514 EncodingReader typeReader(payload.slice(start, end - start), context);
515 uint64_t typeTag;
516 if (failed(typeReader.readVarInt(typeTag)))
517 return nullptr;
518 ArrayRef<uint8_t> payloadBytes;
519 if (typeReader.remaining() > 0)
520 payloadBytes = typeReader.readBytes(typeReader.remaining());
521 Type parsedType;
522 if (failed(parseTypeImpl(typeTag, payloadBytes, parsedType)))
523 return Type();
524
525 // Cache the result.
526 typeCache[typeIndex] = parsedType;
527 return parsedType;
528 }
529
530 size_t size() const { return typeStartIndices.size(); }
531

Callers 15

createFunctionFunction · 0.80
createGlobalFunction · 0.80
writeSingleAttributeMethod · 0.80
writeBlockMethod · 0.80
writeGlobalSectionFunction · 0.80
isConstOneFunction · 0.80
performLoopSplitFunction · 0.80
verifyWithAssumeOpMethod · 0.80
getConstantBoolValueFunction · 0.80
isConstantOnesValueFunction · 0.80

Calls 4

sizeMethod · 0.80
readVarIntMethod · 0.80
remainingMethod · 0.80
readBytesMethod · 0.80

Tested by

no test coverage detected