13 #ifndef MLIR_BYTECODE_BYTECODEWRITER_H
14 #define MLIR_BYTECODE_BYTECODEWRITER_H
33 StringRef producer =
"MLIR" LLVM_VERSION_STRING);
52 template <
typename CallableT>
53 std::enable_if_t<std::is_convertible<
57 name, std::forward<CallableT>(printFn)));
69 std::unique_ptr<Impl>
impl;
79 const BytecodeWriterConfig &config = {});
This class is used to build resource entries for use by the printer.
static std::unique_ptr< AsmResourcePrinter > fromCallable(StringRef name, CallableT &&printFn)
Return a resource printer implemented via the given callable, whose form should match that of buildRe...
This class contains the configuration used for the bytecode writer.
BytecodeWriterConfig(StringRef producer="MLIR" LLVM_VERSION_STRING)
producer is an optional string that can be used to identify the producer of the bytecode when reading...
void attachFallbackResourcePrinter(FallbackAsmResourceMap &map)
Attach resource printers to the AsmState for the fallback resources in the given map.
std::enable_if_t< std::is_convertible< CallableT, function_ref< void(Operation *, AsmResourceBuilder &)> >::value > attachResourcePrinter(StringRef name, CallableT &&printFn)
Attach an resource printer, in the form of a callable, to the configuration.
const Impl & getImpl() const
Return an instance of the internal implementation.
void attachResourcePrinter(std::unique_ptr< AsmResourcePrinter > printer)
Attach the given resource printer to the writer configuration.
A fallback map containing external resources not explicitly handled by another parser/printer.
std::vector< std::unique_ptr< AsmResourcePrinter > > getPrinters()
Build a set of resource printers to print the resources within this map.
Operation is the basic unit of execution within MLIR.
Include the generated interface declarations.
void writeBytecodeToFile(Operation *op, raw_ostream &os, const BytecodeWriterConfig &config={})
Write the bytecode for the given operation to the provided output stream.