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) \
29 typedef struct name name
34#undef DEFINE_C_API_STRUCT
39struct MlirOpInsertionPoint {
43typedef struct MlirOpInsertionPoint MlirOpInsertionPoint;
45struct MlirBlockInsertionPoint {
49typedef struct MlirBlockInsertionPoint MlirBlockInsertionPoint;
62#define DECLARE_SUFFIX_OP_BUILDER_CREATE_FN(suffix, ...) \
63 MLIR_CAPI_EXPORTED MlirOpBuilder mlirOpBuilderCreate##suffix(__VA_ARGS__); \
64 MLIR_CAPI_EXPORTED MlirOpBuilder mlirOpBuilderCreate##suffix##WithListener( \
65 __VA_ARGS__, MlirOpBuilderListener \
67#define DECLARE_OP_BUILDER_CREATE_FN(...) DECLARE_SUFFIX_OP_BUILDER_CREATE_FN(, __VA_ARGS__)
71#undef DECLARE_OP_BUILDER_CREATE_FN
80MLIR_CAPI_EXPORTED
void
MLIR_CAPI_EXPORTED MlirOpBuilderListener mlirOpBuilderListenerCreate(MlirNotifyOperationInserted operationCb, MlirNotifyBlockInserted blockCb, void *userData)
Creates a new mlir::OpBuilder::Listener.
#define DECLARE_OP_BUILDER_CREATE_FN(...)
MLIR_CAPI_EXPORTED MlirOperation mlirOpBuilderGetInsertionPoint(MlirOpBuilder builder)
Returns the current insertion point in the builder.
#define DEFINE_C_API_STRUCT(name, storage)
void(* MlirNotifyOperationInserted)(MlirOperation, void *)
MLIR_CAPI_EXPORTED void mlirOpBuilderDestroy(MlirOpBuilder builder)
Destroys the given builder.
MLIR_CAPI_EXPORTED MlirContext mlirOpBuilderGetContext(MlirOpBuilder builder)
Returns the context.
void(* MlirNotifyBlockInserted)(MlirBlock, void *)
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 void mlirOpBuilderSetInsertionPointToStart(MlirOpBuilder builder, MlirBlock block)
Sets the insertion point to the beginning of the given block.