Lines Matching +defs:buffer +defs:string
39 static std::string toString(bytecode::Section::ID sectionID) {
92 : buffer(contents), dataIt(buffer.begin()), fileLoc(fileLoc) {}
99 bool empty() const { return dataIt == buffer.end(); }
102 size_t size() const { return buffer.end() - dataIt; }
247 /// Parse a null-terminated string into `result` (without including the NUL
254 "malformed null-terminated string, no null character found");
324 /// The bytecode buffer.
325 ArrayRef<uint8_t> buffer;
327 /// The current iterator within the 'buffer'.
369 /// This class is used to read references to the string section from the
373 /// Initialize the string section reader with the given section data.
376 /// Parse a shared string from the string section. The shared string is
377 /// encoded using an index to a corresponding string in the string section.
379 return parseEntry(reader, strings, result, "string");
382 /// Parse a shared string from the string section. The shared string is
383 /// encoded using an index to a corresponding string in the string section.
393 /// Parse a shared string from the string section. The shared string is
394 /// encoded using an index to a corresponding string in the string section.
397 return resolveEntry(reader, strings, index, result, "string");
419 for (StringRef &string : llvm::reverse(strings)) {
425 "string size exceeds the available data size");
428 // Extract the string from the data, dropping the null character.
430 string = StringRef(
437 // should be at the same offset as the first string.
481 /// A buffer containing the encoding of the dialect version parsed.
554 llvm::StringMap<std::string> dialectResourceHandleRenamingMap;
582 FailureOr<std::string> parseAsString() const final {
584 return emitError() << "expected a string resource entry, but found a "
587 StringRef string;
588 if (failed(stringReader.parseString(reader, string)))
590 return string.str();
604 // If we have an extendable reference to the buffer owner, we don't need to
605 // allocate a new buffer for the data, and can use the data directly.
610 // Allocate an unmanager buffer which captures a reference to the owner.
882 /// The string section reader used to resolve string references when parsing
930 // bytecode version from the version buffer if it wasn't already processed.
1063 // Parse the raw properties buffer.
1097 // Acquire the sub-buffer that represent the requested properties.
1101 // sub-buffer.
1109 // Setup a new reader to read from the `rawProperties` sub-buffer.
1126 /// The properties buffer referenced within the bytecode file.
1129 /// Table of offset in the buffer above.
1309 /// This class is used to read a bytecode buffer and translate it into MLIR.
1319 llvm::MemoryBufferRef buffer,
1329 buffer(buffer), bufferOwnerRef(bufferOwnerRef) {}
1331 /// Read the bytecode defined within `buffer` into the given block.
1623 /// Reference to the input buffer.
1624 llvm::MemoryBufferRef buffer;
1627 /// extend the lifetime of the input buffer.
1633 EncodingReader reader(buffer.getBuffer(), fileLoc);
1680 // Process the string section first.
1784 /// for dialects, and the entryIdx represent the string itself.
2531 llvm::MemoryBufferRef buffer, const ParserConfig &config, bool lazyLoading,
2534 FileLineColLoc::get(config.getContext(), buffer.getBufferIdentifier(),
2536 impl = std::make_unique<Impl>(sourceFileLoc, config, lazyLoading, buffer,
2563 bool mlir::isBytecode(llvm::MemoryBufferRef buffer) {
2564 return buffer.getBuffer().starts_with("ML\xefR");
2567 /// Read the bytecode from the provided memory buffer reference.
2568 /// `bufferOwnerRef` if provided is the owning source manager for the buffer,
2569 /// and may be used to extend the lifetime of the buffer.
2571 readBytecodeFileImpl(llvm::MemoryBufferRef buffer, Block *block,
2575 FileLineColLoc::get(config.getContext(), buffer.getBufferIdentifier(),
2577 if (!isBytecode(buffer)) {
2579 "input buffer is not an MLIR bytecode file");
2583 buffer, bufferOwnerRef);
2587 LogicalResult mlir::readBytecodeFile(llvm::MemoryBufferRef buffer, Block *block,
2589 return readBytecodeFileImpl(buffer, block, config, /*bufferOwnerRef=*/{});