13 #ifndef MLIR_BYTECODE_BYTECODEREADER_H
14 #define MLIR_BYTECODE_BYTECODEREADER_H
22 class MemoryBufferRef;
35 llvm::MemoryBufferRef buffer,
const ParserConfig &config,
bool lazyLoad,
36 const std::shared_ptr<llvm::SourceMgr> &bufferOwnerRef = {});
76 std::unique_ptr<Impl>
impl;
Block represents an ordered list of Operations.
This class is used to read a bytecode buffer and translate it into MLIR.
The BytecodeReader allows to load MLIR bytecode files, while keeping the state explicitly available i...
LogicalResult materialize(Operation *op, llvm::function_ref< bool(Operation *)> lazyOpsCallback=[](Operation *) { return false;})
Materialize the provide operation.
LogicalResult finalize(function_ref< bool(Operation *)> shouldMaterialize=[](Operation *) { return true;})
Finalize the lazy-loading by calling back with every op that hasn't been materialized to let the clie...
BytecodeReader(llvm::MemoryBufferRef buffer, const ParserConfig &config, bool lazyLoad, const std::shared_ptr< llvm::SourceMgr > &bufferOwnerRef={})
Create a bytecode reader for the given buffer.
int64_t getNumOpsToMaterialize() const
Return the number of ops that haven't been materialized yet.
bool isMaterializable(Operation *op)
Return true if the provided op is materializable.
LogicalResult readTopLevel(Block *block, llvm::function_ref< bool(Operation *)> lazyOps=[](Operation *) { return false;})
Read the operations defined within the given memory buffer, containing MLIR bytecode,...
Operation is the basic unit of execution within MLIR.
This class represents a configuration for the MLIR assembly parser.
The OpAsmOpInterface, see OpAsmInterface.td for more details.
Include the generated interface declarations.
bool isBytecode(llvm::MemoryBufferRef buffer)
Returns true if the given buffer starts with the magic bytes that signal MLIR bytecode.
LogicalResult readBytecodeFile(llvm::MemoryBufferRef buffer, Block *block, const ParserConfig &config)
Read the operations defined within the given memory buffer, containing MLIR bytecode,...