LLZK 2.0.0
An open-source IR for Zero Knowledge (ZK) circuits
Loading...
Searching...
No Matches
Builder.h File Reference
#include <mlir-c/IR.h>
#include <mlir-c/Support.h>
Include dependency graph for Builder.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  MlirOpBuilderInsertPoint
 Current insertion point of an mlir::OpBuilder instance represented as a block and an operation within that block. More...

Macros

#define DEFINE_C_API_STRUCT(name, storage)
#define DECLARE_SUFFIX_OP_BUILDER_CREATE_FN(suffix, ...)
#define DECLARE_OP_BUILDER_CREATE_FN(...)

Typedefs

typedef struct MlirOpBuilderInsertPoint MlirOpBuilderInsertPoint
typedef void(* MlirNotifyOperationInserted) (MlirOperation, MlirOpBuilderInsertPoint, void *)
 Callback type for listening to operation insertions in an mlir::OpBuilder.
typedef void(* MlirNotifyBlockInserted) (MlirBlock, MlirRegion, MlirBlock, void *)
 Callback type for listening to block insertions in an mlir::OpBuilder.

Functions

 DEFINE_C_API_STRUCT (MlirOpBuilder, void)
 Wrapper around an mlir::OpBuilder instance.
 DEFINE_C_API_STRUCT (MlirOpBuilderListener, void)
 Wrapper around an mlir::OpBuilder::Listener instance.
MLIR_CAPI_EXPORTED void mlirOpBuilderDestroy (MlirOpBuilder builder)
 Destroys the given builder.
MLIR_CAPI_EXPORTED MlirContext mlirOpBuilderGetContext (MlirOpBuilder builder)
 Returns the context.
MLIR_CAPI_EXPORTED void mlirOpBuilderSetInsertionPointToStart (MlirOpBuilder builder, MlirBlock block)
 Sets the insertion point to the beginning of the given block.
MLIR_CAPI_EXPORTED MlirOperation mlirOpBuilderGetInsertionPoint (MlirOpBuilder builder)
 Returns the current insertion point in the builder.
MLIR_CAPI_EXPORTED MlirBlock mlirOpBuilderGetInsertionBlock (MlirOpBuilder builder)
 Returns the current insertion block in the builder.
MLIR_CAPI_EXPORTED MlirOperation mlirOpBuilderInsert (MlirOpBuilder builder, MlirOperation op)
 Insert the given operation at the current insertion point and return it.
MLIR_CAPI_EXPORTED MlirOpBuilderListener mlirOpBuilderListenerCreate (MlirNotifyOperationInserted operationCb, MlirNotifyBlockInserted blockCb, void *userData)
 Creates a new mlir::OpBuilder::Listener.
MLIR_CAPI_EXPORTED void mlirOpBuilderListenerDestroy (MlirOpBuilderListener listener)
 Destroys the given listener.

Macro Definition Documentation

◆ DECLARE_OP_BUILDER_CREATE_FN

#define DECLARE_OP_BUILDER_CREATE_FN ( ...)
Value:
#define DECLARE_SUFFIX_OP_BUILDER_CREATE_FN(suffix,...)
Definition Builder.h:61

Definition at line 68 of file Builder.h.

◆ DECLARE_SUFFIX_OP_BUILDER_CREATE_FN

#define DECLARE_SUFFIX_OP_BUILDER_CREATE_FN ( suffix,
... )
Value:
/* Create a new builder with the given context */ \
MLIR_CAPI_EXPORTED MlirOpBuilder mlirOpBuilderCreate##suffix(__VA_ARGS__); \
/* Create a new builder with the given context and listener */ \
MLIR_CAPI_EXPORTED MlirOpBuilder mlirOpBuilderCreate##suffix##WithListener( \
__VA_ARGS__, MlirOpBuilderListener \
);
MlirOpBuilder mlirOpBuilderCreate(MlirContext ctx)
Creates a new OpBuilder for the given MLIR context.
Definition Builder.cpp:62

Definition at line 61 of file Builder.h.

◆ DEFINE_C_API_STRUCT

#define DEFINE_C_API_STRUCT ( name,
storage )
Value:
struct name { \
/* raw pointer to C++ object */ \
storage *ptr; \
}; \
typedef struct name name

Definition at line 25 of file Builder.h.

Typedef Documentation

◆ MlirNotifyBlockInserted

typedef void(* MlirNotifyBlockInserted) (MlirBlock, MlirRegion, MlirBlock, void *)

Callback type for listening to block insertions in an mlir::OpBuilder.

Definition at line 52 of file Builder.h.

◆ MlirNotifyOperationInserted

typedef void(* MlirNotifyOperationInserted) (MlirOperation, MlirOpBuilderInsertPoint, void *)

Callback type for listening to operation insertions in an mlir::OpBuilder.

Definition at line 50 of file Builder.h.

◆ MlirOpBuilderInsertPoint

typedef struct MlirOpBuilderInsertPoint MlirOpBuilderInsertPoint

Definition at line 47 of file Builder.h.

Function Documentation

◆ DEFINE_C_API_STRUCT() [1/2]

DEFINE_C_API_STRUCT ( MlirOpBuilder ,
void  )

Wrapper around an mlir::OpBuilder instance.

◆ DEFINE_C_API_STRUCT() [2/2]

DEFINE_C_API_STRUCT ( MlirOpBuilderListener ,
void  )

Wrapper around an mlir::OpBuilder::Listener instance.

◆ mlirOpBuilderDestroy()

MLIR_CAPI_EXPORTED void mlirOpBuilderDestroy ( MlirOpBuilder builder)

Destroys the given builder.

Destroys the given builder.

Definition at line 74 of file Builder.cpp.

◆ mlirOpBuilderGetContext()

MLIR_CAPI_EXPORTED MlirContext mlirOpBuilderGetContext ( MlirOpBuilder builder)

Returns the context.

Returns the context.

Definition at line 79 of file Builder.cpp.

◆ mlirOpBuilderGetInsertionBlock()

MLIR_CAPI_EXPORTED MlirBlock mlirOpBuilderGetInsertionBlock ( MlirOpBuilder builder)

Returns the current insertion block in the builder.

Returns the current insertion block in the builder.

Definition at line 103 of file Builder.cpp.

◆ mlirOpBuilderGetInsertionPoint()

MLIR_CAPI_EXPORTED MlirOperation mlirOpBuilderGetInsertionPoint ( MlirOpBuilder builder)

Returns the current insertion point in the builder.

Returns the current insertion point in the builder.

Definition at line 91 of file Builder.cpp.

◆ mlirOpBuilderInsert()

MLIR_CAPI_EXPORTED MlirOperation mlirOpBuilderInsert ( MlirOpBuilder builder,
MlirOperation op )

Insert the given operation at the current insertion point and return it.

Insert the given operation at the current insertion point and return it.

Definition at line 108 of file Builder.cpp.

◆ mlirOpBuilderListenerCreate()

MLIR_CAPI_EXPORTED MlirOpBuilderListener mlirOpBuilderListenerCreate ( MlirNotifyOperationInserted opCb,
MlirNotifyBlockInserted blockCb,
void * userData )

Creates a new mlir::OpBuilder::Listener.

Takes one callback for each method of the Listener interface and a pointer to user defined data.

Creates a new mlir::OpBuilder::Listener.

userData is an opaque pointer forwarded unchanged to each callback.

Definition at line 119 of file Builder.cpp.

◆ mlirOpBuilderListenerDestroy()

MLIR_CAPI_EXPORTED void mlirOpBuilderListenerDestroy ( MlirOpBuilderListener listener)

Destroys the given listener.

Destroys the given listener.

Definition at line 126 of file Builder.cpp.

◆ mlirOpBuilderSetInsertionPointToStart()

MLIR_CAPI_EXPORTED void mlirOpBuilderSetInsertionPointToStart ( MlirOpBuilder builder,
MlirBlock block )

Sets the insertion point to the beginning of the given block.

Sets the insertion point to the beginning of the given block.

Definition at line 85 of file Builder.cpp.