15#ifndef LLZK_C_BUILDER_H
16#define LLZK_C_BUILDER_H
19#include <mlir-c/Support.h>
25#define DEFINE_C_API_STRUCT(name, storage) \
30 typedef struct name name
37#undef DEFINE_C_API_STRUCT
61#define DECLARE_SUFFIX_OP_BUILDER_CREATE_FN(suffix, ...) \
63 MLIR_CAPI_EXPORTED MlirOpBuilder mlirOpBuilderCreate##suffix(__VA_ARGS__); \
65 MLIR_CAPI_EXPORTED MlirOpBuilder mlirOpBuilderCreate##suffix##WithListener( \
66 __VA_ARGS__, MlirOpBuilderListener \
68#define DECLARE_OP_BUILDER_CREATE_FN(...) DECLARE_SUFFIX_OP_BUILDER_CREATE_FN(, __VA_ARGS__)
72#undef DECLARE_OP_BUILDER_CREATE_FN
81MLIR_CAPI_EXPORTED
void
91MLIR_CAPI_EXPORTED MlirOperation
mlirOpBuilderInsert(MlirOpBuilder builder, MlirOperation op);
MLIR_CAPI_EXPORTED MlirOpBuilderListener mlirOpBuilderListenerCreate(MlirNotifyOperationInserted operationCb, MlirNotifyBlockInserted blockCb, void *userData)
Creates a new mlir::OpBuilder::Listener.
#define DECLARE_OP_BUILDER_CREATE_FN(...)
void(* MlirNotifyOperationInserted)(MlirOperation, MlirOpBuilderInsertPoint, void *)
Callback type for listening to operation insertions in an mlir::OpBuilder.
MLIR_CAPI_EXPORTED MlirOperation mlirOpBuilderGetInsertionPoint(MlirOpBuilder builder)
Returns the current insertion point in the builder.
#define DEFINE_C_API_STRUCT(name, storage)
MLIR_CAPI_EXPORTED void mlirOpBuilderDestroy(MlirOpBuilder builder)
Destroys the given builder.
MLIR_CAPI_EXPORTED MlirContext mlirOpBuilderGetContext(MlirOpBuilder builder)
Returns the context.
MLIR_CAPI_EXPORTED MlirBlock mlirOpBuilderGetInsertionBlock(MlirOpBuilder builder)
Returns the current insertion block in the builder.
MLIR_CAPI_EXPORTED void mlirOpBuilderListenerDestroy(MlirOpBuilderListener listener)
Destroys the given listener.
MLIR_CAPI_EXPORTED MlirOperation mlirOpBuilderInsert(MlirOpBuilder builder, MlirOperation op)
Insert the given operation at the current insertion point and return it.
MLIR_CAPI_EXPORTED void mlirOpBuilderSetInsertionPointToStart(MlirOpBuilder builder, MlirBlock block)
Sets the insertion point to the beginning of the given block.
void(* MlirNotifyBlockInserted)(MlirBlock, MlirRegion, MlirBlock, void *)
Callback type for listening to block insertions in an mlir::OpBuilder.
Current insertion point of an mlir::OpBuilder instance represented as a block and an operation within...
MlirOperation point
The operation that the builder is inserting before.
MlirBlock block
The block that the builder is inserting into.