MLIR
20.0.0git
|
#include "mlir/Bytecode/BytecodeReader.h"
#include "mlir/AsmParser/AsmParser.h"
#include "mlir/Bytecode/BytecodeImplementation.h"
#include "mlir/Bytecode/BytecodeOpInterface.h"
#include "mlir/Bytecode/Encoding.h"
#include "mlir/IR/BuiltinOps.h"
#include "mlir/IR/Diagnostics.h"
#include "mlir/IR/OpImplementation.h"
#include "mlir/IR/Verifier.h"
#include "mlir/IR/Visitors.h"
#include "mlir/Support/LLVM.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/ScopeExit.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/MemoryBufferRef.h"
#include "llvm/Support/SourceMgr.h"
#include <cstddef>
#include <list>
#include <memory>
#include <numeric>
#include <optional>
Go to the source code of this file.
Classes | |
class | mlir::BytecodeReader::Impl |
This class is used to read a bytecode buffer and translate it into MLIR. More... | |
Macros | |
#define | DEBUG_TYPE "mlir-bytecode-reader" |
Functions | |
static std::string | toString (bytecode::Section::ID sectionID) |
Stringify the given section ID. More... | |
static bool | isSectionOptional (bytecode::Section::ID sectionID, int version) |
Returns true if the given top-level section ID is optional. More... | |
template<typename RangeT , typename T > | |
static LogicalResult | resolveEntry (EncodingReader &reader, RangeT &entries, uint64_t index, T &entry, StringRef entryStr) |
Resolve an index into the given entry list. More... | |
template<typename RangeT , typename T > | |
static LogicalResult | parseEntry (EncodingReader &reader, RangeT &entries, T &entry, StringRef entryStr) |
Parse and resolve an index into the given entry list. More... | |
static LogicalResult | parseDialectGrouping (EncodingReader &reader, MutableArrayRef< std::unique_ptr< BytecodeDialect >> dialects, function_ref< LogicalResult(BytecodeDialect *)> entryCallback) |
Parse a single dialect group encoded in the byte stream. More... | |
template<typename T > | |
static LogicalResult | parseResourceGroup (Location fileLoc, bool allowEmpty, EncodingReader &offsetReader, EncodingReader &resourceReader, StringSectionReader &stringReader, T *handler, const std::shared_ptr< llvm::SourceMgr > &bufferOwnerRef, function_ref< StringRef(StringRef)> remapKey={}, function_ref< LogicalResult(StringRef)> processKeyFn={}) |
static LogicalResult | readBytecodeFileImpl (llvm::MemoryBufferRef buffer, Block *block, const ParserConfig &config, const std::shared_ptr< llvm::SourceMgr > &bufferOwnerRef) |
Read the bytecode from the provided memory buffer reference. More... | |
#define DEBUG_TYPE "mlir-bytecode-reader" |
Definition at line 34 of file BytecodeReader.cpp.
|
static |
Returns true if the given top-level section ID is optional.
Definition at line 65 of file BytecodeReader.cpp.
References mlir::bytecode::Section::kAttrType, mlir::bytecode::Section::kAttrTypeOffset, mlir::bytecode::Section::kDialect, mlir::bytecode::Section::kDialectVersions, mlir::bytecode::Section::kIR, mlir::bytecode::kNativePropertiesEncoding, mlir::bytecode::Section::kProperties, mlir::bytecode::Section::kResource, mlir::bytecode::Section::kResourceOffset, and mlir::bytecode::Section::kString.
Referenced by mlir::BytecodeReader::Impl::read().
|
static |
Parse a single dialect group encoded in the byte stream.
Definition at line 511 of file BytecodeReader.cpp.
References parseEntry().
|
static |
Parse and resolve an index into the given entry list.
Definition at line 356 of file BytecodeReader.cpp.
References resolveEntry().
Referenced by parseDialectGrouping().
|
static |
Definition at line 639 of file BytecodeReader.cpp.
|
static |
Read the bytecode from the provided memory buffer reference.
bufferOwnerRef
if provided is the owning source manager for the buffer, and may be used to extend the lifetime of the buffer.
Definition at line 2571 of file BytecodeReader.cpp.
References mlir::config, mlir::emitError(), mlir::FileLineColLoc::get(), mlir::isBytecode(), and mlir::BytecodeReader::Impl::read().
Referenced by mlir::readBytecodeFile().
|
static |
Resolve an index into the given entry list.
entry
may either be a reference, in which case it is assigned to the corresponding value in entries
, or a pointer, in which case it is assigned to the address of the element in entries
.
Definition at line 340 of file BytecodeReader.cpp.
Referenced by parseEntry().
|
static |
Stringify the given section ID.
Definition at line 39 of file BytecodeReader.cpp.
References mlir::bytecode::Section::kAttrType, mlir::bytecode::Section::kAttrTypeOffset, mlir::bytecode::Section::kDialect, mlir::bytecode::Section::kDialectVersions, mlir::bytecode::Section::kIR, mlir::bytecode::Section::kProperties, mlir::bytecode::Section::kResource, mlir::bytecode::Section::kResourceOffset, and mlir::bytecode::Section::kString.
Referenced by encodeError(), getLocationFromLoc(), getURIFromLoc(), and mlir::lsp::JSONTransport::run().