MLIR  15.0.0git
Classes | Macros | Typedefs | Functions
IR.h File Reference
#include <stdbool.h>
#include <stdint.h>
#include "mlir-c/Support.h"
+ Include dependency graph for IR.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  MlirNamedAttribute
 Named MLIR attribute. More...
 
struct  MlirOperationState
 An auxiliary class for constructing operations. More...
 

Macros

#define DEFINE_C_API_STRUCT(name, storage)
 Opaque type declarations. More...
 

Typedefs

typedef struct MlirNamedAttribute MlirNamedAttribute
 
typedef struct MlirOperationState MlirOperationState
 

Functions

 DEFINE_C_API_STRUCT (MlirContext, void)
 
 DEFINE_C_API_STRUCT (MlirDialect, void)
 
 DEFINE_C_API_STRUCT (MlirDialectRegistry, void)
 
 DEFINE_C_API_STRUCT (MlirOperation, void)
 
 DEFINE_C_API_STRUCT (MlirOpPrintingFlags, void)
 
 DEFINE_C_API_STRUCT (MlirBlock, void)
 
 DEFINE_C_API_STRUCT (MlirRegion, void)
 
 DEFINE_C_API_STRUCT (MlirSymbolTable, void)
 
 DEFINE_C_API_STRUCT (MlirAttribute, const void)
 
 DEFINE_C_API_STRUCT (MlirIdentifier, const void)
 
 DEFINE_C_API_STRUCT (MlirLocation, const void)
 
 DEFINE_C_API_STRUCT (MlirModule, const void)
 
 DEFINE_C_API_STRUCT (MlirType, const void)
 
 DEFINE_C_API_STRUCT (MlirValue, const void)
 
MLIR_CAPI_EXPORTED MlirContext mlirContextCreate ()
 Creates an MLIR context and transfers its ownership to the caller. More...
 
MLIR_CAPI_EXPORTED bool mlirContextEqual (MlirContext ctx1, MlirContext ctx2)
 Checks if two contexts are equal. More...
 
static bool mlirContextIsNull (MlirContext context)
 Checks whether a context is null. More...
 
MLIR_CAPI_EXPORTED void mlirContextDestroy (MlirContext context)
 Takes an MLIR context owned by the caller and destroys it. More...
 
MLIR_CAPI_EXPORTED void mlirContextSetAllowUnregisteredDialects (MlirContext context, bool allow)
 Sets whether unregistered dialects are allowed in this context. More...
 
MLIR_CAPI_EXPORTED bool mlirContextGetAllowUnregisteredDialects (MlirContext context)
 Returns whether the context allows unregistered dialects. More...
 
MLIR_CAPI_EXPORTED intptr_t mlirContextGetNumRegisteredDialects (MlirContext context)
 Returns the number of dialects registered with the given context. More...
 
MLIR_CAPI_EXPORTED void mlirContextAppendDialectRegistry (MlirContext ctx, MlirDialectRegistry registry)
 Append the contents of the given dialect registry to the registry associated with the context. More...
 
MLIR_CAPI_EXPORTED intptr_t mlirContextGetNumLoadedDialects (MlirContext context)
 Returns the number of dialects loaded by the context. More...
 
MLIR_CAPI_EXPORTED MlirDialect mlirContextGetOrLoadDialect (MlirContext context, MlirStringRef name)
 Gets the dialect instance owned by the given context using the dialect namespace to identify it, loads (i.e., constructs the instance of) the dialect if necessary. More...
 
MLIR_CAPI_EXPORTED void mlirContextEnableMultithreading (MlirContext context, bool enable)
 Set threading mode (must be set to false to mlir-print-ir-after-all). More...
 
MLIR_CAPI_EXPORTED bool mlirContextIsRegisteredOperation (MlirContext context, MlirStringRef name)
 Returns whether the given fully-qualified operation (i.e. More...
 
MLIR_CAPI_EXPORTED MlirContext mlirDialectGetContext (MlirDialect dialect)
 Returns the context that owns the dialect. More...
 
static bool mlirDialectIsNull (MlirDialect dialect)
 Checks if the dialect is null. More...
 
MLIR_CAPI_EXPORTED bool mlirDialectEqual (MlirDialect dialect1, MlirDialect dialect2)
 Checks if two dialects that belong to the same context are equal. More...
 
MLIR_CAPI_EXPORTED MlirStringRef mlirDialectGetNamespace (MlirDialect dialect)
 Returns the namespace of the given dialect. More...
 
MLIR_CAPI_EXPORTED MlirDialectRegistry mlirDialectRegistryCreate ()
 Creates a dialect registry and transfers its ownership to the caller. More...
 
static bool mlirDialectRegistryIsNull (MlirDialectRegistry registry)
 Checks if the dialect registry is null. More...
 
MLIR_CAPI_EXPORTED void mlirDialectRegistryDestroy (MlirDialectRegistry registry)
 Takes a dialect registry owned by the caller and destroys it. More...
 
MLIR_CAPI_EXPORTED MlirLocation mlirLocationFileLineColGet (MlirContext context, MlirStringRef filename, unsigned line, unsigned col)
 Creates an File/Line/Column location owned by the given context. More...
 
MLIR_CAPI_EXPORTED MlirLocation mlirLocationCallSiteGet (MlirLocation callee, MlirLocation caller)
 Creates a call site location with a callee and a caller. More...
 
MLIR_CAPI_EXPORTED MlirLocation mlirLocationFusedGet (MlirContext ctx, intptr_t nLocations, MlirLocation const *locations, MlirAttribute metadata)
 Creates a fused location with an array of locations and metadata. More...
 
MLIR_CAPI_EXPORTED MlirLocation mlirLocationNameGet (MlirContext context, MlirStringRef name, MlirLocation childLoc)
 Creates a name location owned by the given context. More...
 
MLIR_CAPI_EXPORTED MlirLocation mlirLocationUnknownGet (MlirContext context)
 Creates a location with unknown position owned by the given context. More...
 
MLIR_CAPI_EXPORTED MlirContext mlirLocationGetContext (MlirLocation location)
 Gets the context that a location was created with. More...
 
static bool mlirLocationIsNull (MlirLocation location)
 Checks if the location is null. More...
 
MLIR_CAPI_EXPORTED bool mlirLocationEqual (MlirLocation l1, MlirLocation l2)
 Checks if two locations are equal. More...
 
MLIR_CAPI_EXPORTED void mlirLocationPrint (MlirLocation location, MlirStringCallback callback, void *userData)
 Prints a location by sending chunks of the string representation and forwarding userData tocallback`. More...
 
MLIR_CAPI_EXPORTED MlirModule mlirModuleCreateEmpty (MlirLocation location)
 Creates a new, empty module and transfers ownership to the caller. More...
 
MLIR_CAPI_EXPORTED MlirModule mlirModuleCreateParse (MlirContext context, MlirStringRef module)
 Parses a module from the string and transfers ownership to the caller. More...
 
MLIR_CAPI_EXPORTED MlirContext mlirModuleGetContext (MlirModule module)
 Gets the context that a module was created with. More...
 
MLIR_CAPI_EXPORTED MlirBlock mlirModuleGetBody (MlirModule module)
 Gets the body of the module, i.e. the only block it contains. More...
 
static bool mlirModuleIsNull (MlirModule module)
 Checks whether a module is null. More...
 
MLIR_CAPI_EXPORTED void mlirModuleDestroy (MlirModule module)
 Takes a module owned by the caller and deletes it. More...
 
MLIR_CAPI_EXPORTED MlirOperation mlirModuleGetOperation (MlirModule module)
 Views the module as a generic operation. More...
 
MLIR_CAPI_EXPORTED MlirModule mlirModuleFromOperation (MlirOperation op)
 Views the generic operation as a module. More...
 
MLIR_CAPI_EXPORTED MlirOperationState mlirOperationStateGet (MlirStringRef name, MlirLocation loc)
 Constructs an operation state from a name and a location. More...
 
MLIR_CAPI_EXPORTED void mlirOperationStateAddResults (MlirOperationState *state, intptr_t n, MlirType const *results)
 Adds a list of components to the operation state. More...
 
MLIR_CAPI_EXPORTED void mlirOperationStateAddOperands (MlirOperationState *state, intptr_t n, MlirValue const *operands)
 
MLIR_CAPI_EXPORTED void mlirOperationStateAddOwnedRegions (MlirOperationState *state, intptr_t n, MlirRegion const *regions)
 
MLIR_CAPI_EXPORTED void mlirOperationStateAddSuccessors (MlirOperationState *state, intptr_t n, MlirBlock const *successors)
 
MLIR_CAPI_EXPORTED void mlirOperationStateAddAttributes (MlirOperationState *state, intptr_t n, MlirNamedAttribute const *attributes)
 
MLIR_CAPI_EXPORTED void mlirOperationStateEnableResultTypeInference (MlirOperationState *state)
 Enables result type inference for the operation under construction. More...
 
MLIR_CAPI_EXPORTED MlirOpPrintingFlags mlirOpPrintingFlagsCreate ()
 Creates new printing flags with defaults, intended for customization. More...
 
MLIR_CAPI_EXPORTED void mlirOpPrintingFlagsDestroy (MlirOpPrintingFlags flags)
 Destroys printing flags created with mlirOpPrintingFlagsCreate. More...
 
MLIR_CAPI_EXPORTED void mlirOpPrintingFlagsElideLargeElementsAttrs (MlirOpPrintingFlags flags, intptr_t largeElementLimit)
 Enables the elision of large elements attributes by printing a lexically valid but otherwise meaningless form instead of the element data. More...
 
MLIR_CAPI_EXPORTED void mlirOpPrintingFlagsEnableDebugInfo (MlirOpPrintingFlags flags, bool prettyForm)
 Enable printing of debug information. More...
 
MLIR_CAPI_EXPORTED void mlirOpPrintingFlagsPrintGenericOpForm (MlirOpPrintingFlags flags)
 Always print operations in the generic form. More...
 
MLIR_CAPI_EXPORTED void mlirOpPrintingFlagsUseLocalScope (MlirOpPrintingFlags flags)
 Use local scope when printing the operation. More...
 
MLIR_CAPI_EXPORTED MlirOperation mlirOperationCreate (MlirOperationState *state)
 Creates an operation and transfers ownership to the caller. More...
 
MLIR_CAPI_EXPORTED MlirOperation mlirOperationClone (MlirOperation op)
 Creates a deep copy of an operation. More...
 
MLIR_CAPI_EXPORTED void mlirOperationDestroy (MlirOperation op)
 Takes an operation owned by the caller and destroys it. More...
 
MLIR_CAPI_EXPORTED void mlirOperationRemoveFromParent (MlirOperation op)
 Removes the given operation from its parent block. More...
 
static bool mlirOperationIsNull (MlirOperation op)
 Checks whether the underlying operation is null. More...
 
MLIR_CAPI_EXPORTED bool mlirOperationEqual (MlirOperation op, MlirOperation other)
 Checks whether two operation handles point to the same operation. More...
 
MLIR_CAPI_EXPORTED MlirContext mlirOperationGetContext (MlirOperation op)
 Gets the context this operation is associated with. More...
 
MLIR_CAPI_EXPORTED MlirLocation mlirOperationGetLocation (MlirOperation op)
 Gets the location of the operation. More...
 
MLIR_CAPI_EXPORTED MlirTypeID mlirOperationGetTypeID (MlirOperation op)
 Gets the type id of the operation. More...
 
MLIR_CAPI_EXPORTED MlirIdentifier mlirOperationGetName (MlirOperation op)
 Gets the name of the operation as an identifier. More...
 
MLIR_CAPI_EXPORTED MlirBlock mlirOperationGetBlock (MlirOperation op)
 Gets the block that owns this operation, returning null if the operation is not owned. More...
 
MLIR_CAPI_EXPORTED MlirOperation mlirOperationGetParentOperation (MlirOperation op)
 Gets the operation that owns this operation, returning null if the operation is not owned. More...
 
MLIR_CAPI_EXPORTED intptr_t mlirOperationGetNumRegions (MlirOperation op)
 Returns the number of regions attached to the given operation. More...
 
MLIR_CAPI_EXPORTED MlirRegion mlirOperationGetRegion (MlirOperation op, intptr_t pos)
 Returns pos-th region attached to the operation. More...
 
MLIR_CAPI_EXPORTED MlirOperation mlirOperationGetNextInBlock (MlirOperation op)
 Returns an operation immediately following the given operation it its enclosing block. More...
 
MLIR_CAPI_EXPORTED intptr_t mlirOperationGetNumOperands (MlirOperation op)
 Returns the number of operands of the operation. More...
 
MLIR_CAPI_EXPORTED MlirValue mlirOperationGetOperand (MlirOperation op, intptr_t pos)
 Returns pos-th operand of the operation. More...
 
MLIR_CAPI_EXPORTED void mlirOperationSetOperand (MlirOperation op, intptr_t pos, MlirValue newValue)
 Sets the pos-th operand of the operation. More...
 
MLIR_CAPI_EXPORTED intptr_t mlirOperationGetNumResults (MlirOperation op)
 Returns the number of results of the operation. More...
 
MLIR_CAPI_EXPORTED MlirValue mlirOperationGetResult (MlirOperation op, intptr_t pos)
 Returns pos-th result of the operation. More...
 
MLIR_CAPI_EXPORTED intptr_t mlirOperationGetNumSuccessors (MlirOperation op)
 Returns the number of successor blocks of the operation. More...
 
MLIR_CAPI_EXPORTED MlirBlock mlirOperationGetSuccessor (MlirOperation op, intptr_t pos)
 Returns pos-th successor of the operation. More...
 
MLIR_CAPI_EXPORTED intptr_t mlirOperationGetNumAttributes (MlirOperation op)
 Returns the number of attributes attached to the operation. More...
 
MLIR_CAPI_EXPORTED MlirNamedAttribute mlirOperationGetAttribute (MlirOperation op, intptr_t pos)
 Return pos-th attribute of the operation. More...
 
MLIR_CAPI_EXPORTED MlirAttribute mlirOperationGetAttributeByName (MlirOperation op, MlirStringRef name)
 Returns an attribute attached to the operation given its name. More...
 
MLIR_CAPI_EXPORTED void mlirOperationSetAttributeByName (MlirOperation op, MlirStringRef name, MlirAttribute attr)
 Sets an attribute by name, replacing the existing if it exists or adding a new one otherwise. More...
 
MLIR_CAPI_EXPORTED bool mlirOperationRemoveAttributeByName (MlirOperation op, MlirStringRef name)
 Removes an attribute by name. More...
 
MLIR_CAPI_EXPORTED void mlirOperationPrint (MlirOperation op, MlirStringCallback callback, void *userData)
 Prints an operation by sending chunks of the string representation and forwarding userData tocallback`. More...
 
MLIR_CAPI_EXPORTED void mlirOperationPrintWithFlags (MlirOperation op, MlirOpPrintingFlags flags, MlirStringCallback callback, void *userData)
 Same as mlirOperationPrint but accepts flags controlling the printing behavior. More...
 
MLIR_CAPI_EXPORTED void mlirOperationDump (MlirOperation op)
 Prints an operation to stderr. More...
 
MLIR_CAPI_EXPORTED bool mlirOperationVerify (MlirOperation op)
 Verify the operation and return true if it passes, false if it fails. More...
 
MLIR_CAPI_EXPORTED void mlirOperationMoveAfter (MlirOperation op, MlirOperation other)
 Moves the given operation immediately after the other operation in its parent block. More...
 
MLIR_CAPI_EXPORTED void mlirOperationMoveBefore (MlirOperation op, MlirOperation other)
 Moves the given operation immediately before the other operation in its parent block. More...
 
MLIR_CAPI_EXPORTED MlirRegion mlirRegionCreate ()
 Creates a new empty region and transfers ownership to the caller. More...
 
MLIR_CAPI_EXPORTED void mlirRegionDestroy (MlirRegion region)
 Takes a region owned by the caller and destroys it. More...
 
static bool mlirRegionIsNull (MlirRegion region)
 Checks whether a region is null. More...
 
MLIR_CAPI_EXPORTED bool mlirRegionEqual (MlirRegion region, MlirRegion other)
 Checks whether two region handles point to the same region. More...
 
MLIR_CAPI_EXPORTED MlirBlock mlirRegionGetFirstBlock (MlirRegion region)
 Gets the first block in the region. More...
 
MLIR_CAPI_EXPORTED void mlirRegionAppendOwnedBlock (MlirRegion region, MlirBlock block)
 Takes a block owned by the caller and appends it to the given region. More...
 
MLIR_CAPI_EXPORTED void mlirRegionInsertOwnedBlock (MlirRegion region, intptr_t pos, MlirBlock block)
 Takes a block owned by the caller and inserts it at pos to the given region. More...
 
MLIR_CAPI_EXPORTED void mlirRegionInsertOwnedBlockAfter (MlirRegion region, MlirBlock reference, MlirBlock block)
 Takes a block owned by the caller and inserts it after the (non-owned) reference block in the given region. More...
 
MLIR_CAPI_EXPORTED void mlirRegionInsertOwnedBlockBefore (MlirRegion region, MlirBlock reference, MlirBlock block)
 Takes a block owned by the caller and inserts it before the (non-owned) reference block in the given region. More...
 
MLIR_CAPI_EXPORTED MlirRegion mlirOperationGetFirstRegion (MlirOperation op)
 Returns first region attached to the operation. More...
 
MLIR_CAPI_EXPORTED MlirRegion mlirRegionGetNextInOperation (MlirRegion region)
 Returns the region immediately following the given region in its parent operation. More...
 
MLIR_CAPI_EXPORTED MlirBlock mlirBlockCreate (intptr_t nArgs, MlirType const *args, MlirLocation const *locs)
 Creates a new empty block with the given argument types and transfers ownership to the caller. More...
 
MLIR_CAPI_EXPORTED void mlirBlockDestroy (MlirBlock block)
 Takes a block owned by the caller and destroys it. More...
 
MLIR_CAPI_EXPORTED void mlirBlockDetach (MlirBlock block)
 Detach a block from the owning region and assume ownership. More...
 
static bool mlirBlockIsNull (MlirBlock block)
 Checks whether a block is null. More...
 
MLIR_CAPI_EXPORTED bool mlirBlockEqual (MlirBlock block, MlirBlock other)
 Checks whether two blocks handles point to the same block. More...
 
MLIR_CAPI_EXPORTED MlirOperation mlirBlockGetParentOperation (MlirBlock)
 Returns the closest surrounding operation that contains this block. More...
 
MLIR_CAPI_EXPORTED MlirRegion mlirBlockGetParentRegion (MlirBlock block)
 Returns the region that contains this block. More...
 
MLIR_CAPI_EXPORTED MlirBlock mlirBlockGetNextInRegion (MlirBlock block)
 Returns the block immediately following the given block in its parent region. More...
 
MLIR_CAPI_EXPORTED MlirOperation mlirBlockGetFirstOperation (MlirBlock block)
 Returns the first operation in the block. More...
 
MLIR_CAPI_EXPORTED MlirOperation mlirBlockGetTerminator (MlirBlock block)
 Returns the terminator operation in the block or null if no terminator. More...
 
MLIR_CAPI_EXPORTED void mlirBlockAppendOwnedOperation (MlirBlock block, MlirOperation operation)
 Takes an operation owned by the caller and appends it to the block. More...
 
MLIR_CAPI_EXPORTED void mlirBlockInsertOwnedOperation (MlirBlock block, intptr_t pos, MlirOperation operation)
 Takes an operation owned by the caller and inserts it as pos to the block. More...
 
MLIR_CAPI_EXPORTED void mlirBlockInsertOwnedOperationAfter (MlirBlock block, MlirOperation reference, MlirOperation operation)
 Takes an operation owned by the caller and inserts it after the (non-owned) reference operation in the given block. More...
 
MLIR_CAPI_EXPORTED void mlirBlockInsertOwnedOperationBefore (MlirBlock block, MlirOperation reference, MlirOperation operation)
 Takes an operation owned by the caller and inserts it before the (non-owned) reference operation in the given block. More...
 
MLIR_CAPI_EXPORTED intptr_t mlirBlockGetNumArguments (MlirBlock block)
 Returns the number of arguments of the block. More...
 
MLIR_CAPI_EXPORTED MlirValue mlirBlockAddArgument (MlirBlock block, MlirType type, MlirLocation loc)
 Appends an argument of the specified type to the block. More...
 
MLIR_CAPI_EXPORTED MlirValue mlirBlockGetArgument (MlirBlock block, intptr_t pos)
 Returns pos-th argument of the block. More...
 
MLIR_CAPI_EXPORTED void mlirBlockPrint (MlirBlock block, MlirStringCallback callback, void *userData)
 Prints a block by sending chunks of the string representation and forwarding userData tocallback`. More...
 
static bool mlirValueIsNull (MlirValue value)
 Returns whether the value is null. More...
 
MLIR_CAPI_EXPORTED bool mlirValueEqual (MlirValue value1, MlirValue value2)
 Returns 1 if two values are equal, 0 otherwise. More...
 
MLIR_CAPI_EXPORTED bool mlirValueIsABlockArgument (MlirValue value)
 Returns 1 if the value is a block argument, 0 otherwise. More...
 
MLIR_CAPI_EXPORTED bool mlirValueIsAOpResult (MlirValue value)
 Returns 1 if the value is an operation result, 0 otherwise. More...
 
MLIR_CAPI_EXPORTED MlirBlock mlirBlockArgumentGetOwner (MlirValue value)
 Returns the block in which this value is defined as an argument. More...
 
MLIR_CAPI_EXPORTED intptr_t mlirBlockArgumentGetArgNumber (MlirValue value)
 Returns the position of the value in the argument list of its block. More...
 
MLIR_CAPI_EXPORTED void mlirBlockArgumentSetType (MlirValue value, MlirType type)
 Sets the type of the block argument to the given type. More...
 
MLIR_CAPI_EXPORTED MlirOperation mlirOpResultGetOwner (MlirValue value)
 Returns an operation that produced this value as its result. More...
 
MLIR_CAPI_EXPORTED intptr_t mlirOpResultGetResultNumber (MlirValue value)
 Returns the position of the value in the list of results of the operation that produced it. More...
 
MLIR_CAPI_EXPORTED MlirType mlirValueGetType (MlirValue value)
 Returns the type of the value. More...
 
MLIR_CAPI_EXPORTED void mlirValueDump (MlirValue value)
 Prints the value to the standard error stream. More...
 
MLIR_CAPI_EXPORTED void mlirValuePrint (MlirValue value, MlirStringCallback callback, void *userData)
 Prints a value by sending chunks of the string representation and forwarding userData tocallback`. More...
 
MLIR_CAPI_EXPORTED MlirType mlirTypeParseGet (MlirContext context, MlirStringRef type)
 Parses a type. The type is owned by the context. More...
 
MLIR_CAPI_EXPORTED MlirContext mlirTypeGetContext (MlirType type)
 Gets the context that a type was created with. More...
 
MLIR_CAPI_EXPORTED MlirTypeID mlirTypeGetTypeID (MlirType type)
 Gets the type ID of the type. More...
 
static bool mlirTypeIsNull (MlirType type)
 Checks whether a type is null. More...
 
MLIR_CAPI_EXPORTED bool mlirTypeEqual (MlirType t1, MlirType t2)
 Checks if two types are equal. More...
 
MLIR_CAPI_EXPORTED void mlirTypePrint (MlirType type, MlirStringCallback callback, void *userData)
 Prints a location by sending chunks of the string representation and forwarding userData tocallback`. More...
 
MLIR_CAPI_EXPORTED void mlirTypeDump (MlirType type)
 Prints the type to the standard error stream. More...
 
MLIR_CAPI_EXPORTED MlirAttribute mlirAttributeParseGet (MlirContext context, MlirStringRef attr)
 Parses an attribute. The attribute is owned by the context. More...
 
MLIR_CAPI_EXPORTED MlirContext mlirAttributeGetContext (MlirAttribute attribute)
 Gets the context that an attribute was created with. More...
 
MLIR_CAPI_EXPORTED MlirType mlirAttributeGetType (MlirAttribute attribute)
 Gets the type of this attribute. More...
 
MLIR_CAPI_EXPORTED MlirTypeID mlirAttributeGetTypeID (MlirAttribute attribute)
 Gets the type id of the attribute. More...
 
static bool mlirAttributeIsNull (MlirAttribute attr)
 Checks whether an attribute is null. More...
 
MLIR_CAPI_EXPORTED bool mlirAttributeEqual (MlirAttribute a1, MlirAttribute a2)
 Checks if two attributes are equal. More...
 
MLIR_CAPI_EXPORTED void mlirAttributePrint (MlirAttribute attr, MlirStringCallback callback, void *userData)
 Prints an attribute by sending chunks of the string representation and forwarding userData tocallback`. More...
 
MLIR_CAPI_EXPORTED void mlirAttributeDump (MlirAttribute attr)
 Prints the attribute to the standard error stream. More...
 
MLIR_CAPI_EXPORTED MlirNamedAttribute mlirNamedAttributeGet (MlirIdentifier name, MlirAttribute attr)
 Associates an attribute with the name. Takes ownership of neither. More...
 
MLIR_CAPI_EXPORTED MlirIdentifier mlirIdentifierGet (MlirContext context, MlirStringRef str)
 Gets an identifier with the given string value. More...
 
MLIR_CAPI_EXPORTED MlirContext mlirIdentifierGetContext (MlirIdentifier)
 Returns the context associated with this identifier. More...
 
MLIR_CAPI_EXPORTED bool mlirIdentifierEqual (MlirIdentifier ident, MlirIdentifier other)
 Checks whether two identifiers are the same. More...
 
MLIR_CAPI_EXPORTED MlirStringRef mlirIdentifierStr (MlirIdentifier ident)
 Gets the string value of the identifier. More...
 
MLIR_CAPI_EXPORTED MlirStringRef mlirSymbolTableGetSymbolAttributeName ()
 Returns the name of the attribute used to store symbol names compatible with symbol tables. More...
 
MLIR_CAPI_EXPORTED MlirStringRef mlirSymbolTableGetVisibilityAttributeName ()
 Returns the name of the attribute used to store symbol visibility. More...
 
MLIR_CAPI_EXPORTED MlirSymbolTable mlirSymbolTableCreate (MlirOperation operation)
 Creates a symbol table for the given operation. More...
 
static bool mlirSymbolTableIsNull (MlirSymbolTable symbolTable)
 Returns true if the symbol table is null. More...
 
MLIR_CAPI_EXPORTED void mlirSymbolTableDestroy (MlirSymbolTable symbolTable)
 Destroys the symbol table created with mlirSymbolTableCreate. More...
 
MLIR_CAPI_EXPORTED MlirOperation mlirSymbolTableLookup (MlirSymbolTable symbolTable, MlirStringRef name)
 Looks up a symbol with the given name in the given symbol table and returns the operation that corresponds to the symbol. More...
 
MLIR_CAPI_EXPORTED MlirAttribute mlirSymbolTableInsert (MlirSymbolTable symbolTable, MlirOperation operation)
 Inserts the given operation into the given symbol table. More...
 
MLIR_CAPI_EXPORTED void mlirSymbolTableErase (MlirSymbolTable symbolTable, MlirOperation operation)
 Removes the given operation from the symbol table and erases it. More...
 
MLIR_CAPI_EXPORTED MlirLogicalResult mlirSymbolTableReplaceAllSymbolUses (MlirStringRef oldSymbol, MlirStringRef newSymbol, MlirOperation from)
 Attempt to replace all uses that are nested within the given operation of the given symbol 'oldSymbol' with the provided 'newSymbol'. More...
 
MLIR_CAPI_EXPORTED void mlirSymbolTableWalkSymbolTables (MlirOperation from, bool allSymUsesVisible, void(*callback)(MlirOperation, bool, void *userData), void *userData)
 Walks all symbol table operations nested within, and including, op. More...
 

Macro Definition Documentation

◆ DEFINE_C_API_STRUCT

#define DEFINE_C_API_STRUCT (   name,
  storage 
)
Value:
struct name { \
storage *ptr; \
}; \
typedef struct name name

Opaque type declarations.

Types are exposed to C bindings as structs containing opaque pointers. They are not supposed to be inspected from C. This allows the underlying representation to change without affecting the API users. The use of structs instead of typedefs enables some type safety as structs are not implicitly convertible to each other.

Instances of these types may or may not own the underlying object (most often only point to an IR fragment without owning it). The ownership semantics is defined by how an instance of the type was obtained.

Definition at line 45 of file IR.h.

Typedef Documentation

◆ MlirNamedAttribute

Definition at line 78 of file IR.h.

◆ MlirOperationState

Definition at line 280 of file IR.h.

Function Documentation

◆ DEFINE_C_API_STRUCT() [1/14]

DEFINE_C_API_STRUCT ( MlirContext  ,
void   
)

◆ DEFINE_C_API_STRUCT() [2/14]

DEFINE_C_API_STRUCT ( MlirDialect  ,
void   
)

◆ DEFINE_C_API_STRUCT() [3/14]

DEFINE_C_API_STRUCT ( MlirDialectRegistry  ,
void   
)

◆ DEFINE_C_API_STRUCT() [4/14]

DEFINE_C_API_STRUCT ( MlirOperation  ,
void   
)

◆ DEFINE_C_API_STRUCT() [5/14]

DEFINE_C_API_STRUCT ( MlirOpPrintingFlags  ,
void   
)

◆ DEFINE_C_API_STRUCT() [6/14]

DEFINE_C_API_STRUCT ( MlirBlock  ,
void   
)

◆ DEFINE_C_API_STRUCT() [7/14]

DEFINE_C_API_STRUCT ( MlirRegion  ,
void   
)

◆ DEFINE_C_API_STRUCT() [8/14]

DEFINE_C_API_STRUCT ( MlirSymbolTable  ,
void   
)

◆ DEFINE_C_API_STRUCT() [9/14]

DEFINE_C_API_STRUCT ( MlirAttribute  ,
const void   
)

◆ DEFINE_C_API_STRUCT() [10/14]

DEFINE_C_API_STRUCT ( MlirIdentifier  ,
const void   
)

◆ DEFINE_C_API_STRUCT() [11/14]

DEFINE_C_API_STRUCT ( MlirLocation  ,
const void   
)

◆ DEFINE_C_API_STRUCT() [12/14]

DEFINE_C_API_STRUCT ( MlirModule  ,
const void   
)

◆ DEFINE_C_API_STRUCT() [13/14]

DEFINE_C_API_STRUCT ( MlirType  ,
const void   
)

◆ DEFINE_C_API_STRUCT() [14/14]

DEFINE_C_API_STRUCT ( MlirValue  ,
const void   
)

◆ mlirAttributeDump()

MLIR_CAPI_EXPORTED void mlirAttributeDump ( MlirAttribute  attr)

Prints the attribute to the standard error stream.

Definition at line 768 of file IR.cpp.

References unwrap().

Referenced by mlirAttributeIsNull(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirAttributeEqual()

MLIR_CAPI_EXPORTED bool mlirAttributeEqual ( MlirAttribute  a1,
MlirAttribute  a2 
)

Checks if two attributes are equal.

Definition at line 758 of file IR.cpp.

References unwrap().

Referenced by mlirAttributeIsNull(), and mlir::python::PyAttribute::operator==().

◆ mlirAttributeGetContext()

MLIR_CAPI_EXPORTED MlirContext mlirAttributeGetContext ( MlirAttribute  attribute)

◆ mlirAttributeGetType()

MLIR_CAPI_EXPORTED MlirType mlirAttributeGetType ( MlirAttribute  attribute)

Gets the type of this attribute.

Definition at line 750 of file IR.cpp.

References unwrap(), and wrap().

Referenced by mlir::python::PyConcreteAttribute< DerivedTy, BaseTy >::bind(), mlirTypeIsNull(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirAttributeGetTypeID()

MLIR_CAPI_EXPORTED MlirTypeID mlirAttributeGetTypeID ( MlirAttribute  attribute)

Gets the type id of the attribute.

Definition at line 754 of file IR.cpp.

References unwrap(), and wrap().

Referenced by mlirTypeIsNull().

◆ mlirAttributeIsNull()

static bool mlirAttributeIsNull ( MlirAttribute  attr)
inlinestatic

◆ mlirAttributeParseGet()

MLIR_CAPI_EXPORTED MlirAttribute mlirAttributeParseGet ( MlirContext  context,
MlirStringRef  attr 
)

Parses an attribute. The attribute is owned by the context.

Definition at line 742 of file IR.cpp.

References mlir::parseAttribute(), unwrap(), and wrap().

Referenced by mlirTypeIsNull(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirAttributePrint()

MLIR_CAPI_EXPORTED void mlirAttributePrint ( MlirAttribute  attr,
MlirStringCallback  callback,
void userData 
)

Prints an attribute by sending chunks of the string representation and forwarding userData tocallback`.

Note that the callback may be called several times with consecutive chunks of the string.

Definition at line 762 of file IR.cpp.

References mlir::Diagnostic::print(), and unwrap().

Referenced by mlirAttributeIsNull(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirBlockAddArgument()

MLIR_CAPI_EXPORTED MlirValue mlirBlockAddArgument ( MlirBlock  block,
MlirType  type,
MlirLocation  loc 
)

Appends an argument of the specified type to the block.

Returns the newly added argument.

Definition at line 646 of file IR.cpp.

References unwrap(), and wrap().

Referenced by mlirBlockIsNull().

◆ mlirBlockAppendOwnedOperation()

MLIR_CAPI_EXPORTED void mlirBlockAppendOwnedOperation ( MlirBlock  block,
MlirOperation  operation 
)

Takes an operation owned by the caller and appends it to the block.

Definition at line 598 of file IR.cpp.

References unwrap().

Referenced by mlirBlockInsertOwnedOperationBefore(), mlirBlockIsNull(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirBlockArgumentGetArgNumber()

MLIR_CAPI_EXPORTED intptr_t mlirBlockArgumentGetArgNumber ( MlirValue  value)

Returns the position of the value in the argument list of its block.

Definition at line 681 of file IR.cpp.

References unwrap().

Referenced by mlirValueIsNull(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirBlockArgumentGetOwner()

MLIR_CAPI_EXPORTED MlirBlock mlirBlockArgumentGetOwner ( MlirValue  value)

Returns the block in which this value is defined as an argument.

Asserts if the value is not a block argument.

Definition at line 677 of file IR.cpp.

References unwrap(), and wrap().

Referenced by mlir::python::PyValue::createFromCapsule(), mlirValueIsNull(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirBlockArgumentSetType()

MLIR_CAPI_EXPORTED void mlirBlockArgumentSetType ( MlirValue  value,
MlirType  type 
)

Sets the type of the block argument to the given type.

Definition at line 686 of file IR.cpp.

References unwrap().

Referenced by mlirValueIsNull(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirBlockCreate()

MLIR_CAPI_EXPORTED MlirBlock mlirBlockCreate ( intptr_t  nArgs,
MlirType const *  args,
MlirLocation const *  locs 
)

Creates a new empty block with the given argument types and transfers ownership to the caller.

Definition at line 557 of file IR.cpp.

References mlir::Block::addArgument(), unwrap(), and wrap().

Referenced by PyGlobalDebugFlag::bind(), mlirRegionIsNull(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirBlockDestroy()

MLIR_CAPI_EXPORTED void mlirBlockDestroy ( MlirBlock  block)

Takes a block owned by the caller and destroys it.

Definition at line 635 of file IR.cpp.

References unwrap().

Referenced by mlirRegionIsNull().

◆ mlirBlockDetach()

MLIR_CAPI_EXPORTED void mlirBlockDetach ( MlirBlock  block)

Detach a block from the owning region and assume ownership.

Definition at line 637 of file IR.cpp.

References mlir::Region::getBlocks(), mlir::Block::getParent(), and unwrap().

Referenced by mlirRegionIsNull(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirBlockEqual()

MLIR_CAPI_EXPORTED bool mlirBlockEqual ( MlirBlock  block,
MlirBlock  other 
)

Checks whether two blocks handles point to the same block.

This does not perform deep comparison.

Definition at line 565 of file IR.cpp.

References unwrap().

Referenced by mlirBlockIsNull().

◆ mlirBlockGetArgument()

MLIR_CAPI_EXPORTED MlirValue mlirBlockGetArgument ( MlirBlock  block,
intptr_t  pos 
)

Returns pos-th argument of the block.

Definition at line 651 of file IR.cpp.

References unwrap(), and wrap().

Referenced by mlirBlockIsNull(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirBlockGetFirstOperation()

MLIR_CAPI_EXPORTED MlirOperation mlirBlockGetFirstOperation ( MlirBlock  block)

◆ mlirBlockGetNextInRegion()

MLIR_CAPI_EXPORTED MlirBlock mlirBlockGetNextInRegion ( MlirBlock  block)

Returns the block immediately following the given block in its parent region.

Definition at line 577 of file IR.cpp.

References unwrap(), and wrap().

Referenced by PyGlobalDebugFlag::bind(), and mlirBlockIsNull().

◆ mlirBlockGetNumArguments()

MLIR_CAPI_EXPORTED intptr_t mlirBlockGetNumArguments ( MlirBlock  block)

Returns the number of arguments of the block.

Definition at line 642 of file IR.cpp.

References unwrap().

Referenced by mlirBlockIsNull(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirBlockGetParentOperation()

MLIR_CAPI_EXPORTED MlirOperation mlirBlockGetParentOperation ( MlirBlock  )

Returns the closest surrounding operation that contains this block.

Definition at line 569 of file IR.cpp.

References unwrap(), and wrap().

Referenced by mlir::python::PyValue::createFromCapsule(), mlirBlockIsNull(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirBlockGetParentRegion()

MLIR_CAPI_EXPORTED MlirRegion mlirBlockGetParentRegion ( MlirBlock  block)

Returns the region that contains this block.

Definition at line 573 of file IR.cpp.

References unwrap(), and wrap().

Referenced by mlirBlockIsNull(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirBlockGetTerminator()

MLIR_CAPI_EXPORTED MlirOperation mlirBlockGetTerminator ( MlirBlock  block)

Returns the terminator operation in the block or null if no terminator.

Definition at line 588 of file IR.cpp.

References mlir::Block::back(), mlir::Block::empty(), mlir::Operation::hasTrait(), unwrap(), and wrap().

Referenced by mlir::python::PyInsertionPoint::atBlockTerminator(), mlir::python::PyInsertionPoint::insert(), and mlirBlockIsNull().

◆ mlirBlockInsertOwnedOperation()

MLIR_CAPI_EXPORTED void mlirBlockInsertOwnedOperation ( MlirBlock  block,
intptr_t  pos,
MlirOperation  operation 
)

Takes an operation owned by the caller and inserts it as pos to the block.

This is an expensive operation that scans the block linearly, prefer insertBefore/After instead.

Definition at line 602 of file IR.cpp.

References unwrap().

Referenced by mlirBlockIsNull().

◆ mlirBlockInsertOwnedOperationAfter()

MLIR_CAPI_EXPORTED void mlirBlockInsertOwnedOperationAfter ( MlirBlock  block,
MlirOperation  reference,
MlirOperation  operation 
)

Takes an operation owned by the caller and inserts it after the (non-owned) reference operation in the given block.

If the reference is null, prepends the operation. Otherwise, the reference must belong to the block.

Definition at line 608 of file IR.cpp.

References mlir::Block::begin(), mlir::Block::getOperations(), mlirOperationIsNull(), and unwrap().

Referenced by mlirBlockIsNull().

◆ mlirBlockInsertOwnedOperationBefore()

MLIR_CAPI_EXPORTED void mlirBlockInsertOwnedOperationBefore ( MlirBlock  block,
MlirOperation  reference,
MlirOperation  operation 
)

Takes an operation owned by the caller and inserts it before the (non-owned) reference operation in the given block.

If the reference is null, appends the operation. Otherwise, the reference must belong to the block.

Definition at line 623 of file IR.cpp.

References mlirBlockAppendOwnedOperation(), mlirOperationIsNull(), and unwrap().

Referenced by mlir::python::PyInsertionPoint::insert(), and mlirBlockIsNull().

◆ mlirBlockIsNull()

static bool mlirBlockIsNull ( MlirBlock  block)
inlinestatic

◆ mlirBlockPrint()

MLIR_CAPI_EXPORTED void mlirBlockPrint ( MlirBlock  block,
MlirStringCallback  callback,
void userData 
)

Prints a block by sending chunks of the string representation and forwarding userData tocallback`.

Note that the callback may be called several times with consecutive chunks of the string.

Definition at line 655 of file IR.cpp.

References mlir::Diagnostic::print(), and unwrap().

Referenced by mlirBlockIsNull(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirContextAppendDialectRegistry()

MLIR_CAPI_EXPORTED void mlirContextAppendDialectRegistry ( MlirContext  ctx,
MlirDialectRegistry  registry 
)

Append the contents of the given dialect registry to the registry associated with the context.

Definition at line 56 of file IR.cpp.

References unwrap().

Referenced by mlirContextIsNull().

◆ mlirContextCreate()

MLIR_CAPI_EXPORTED MlirContext mlirContextCreate ( )

Creates an MLIR context and transfers its ownership to the caller.

Definition at line 34 of file IR.cpp.

References wrap().

Referenced by mlir::python::PyMlirContext::createNewContextForInit().

◆ mlirContextDestroy()

MLIR_CAPI_EXPORTED void mlirContextDestroy ( MlirContext  context)

Takes an MLIR context owned by the caller and destroys it.

Definition at line 43 of file IR.cpp.

References unwrap().

Referenced by mlirContextIsNull(), and mlir::python::PyMlirContext::~PyMlirContext().

◆ mlirContextEnableMultithreading()

MLIR_CAPI_EXPORTED void mlirContextEnableMultithreading ( MlirContext  context,
bool  enable 
)

Set threading mode (must be set to false to mlir-print-ir-after-all).

Definition at line 76 of file IR.cpp.

References unwrap().

Referenced by mlirContextIsNull(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirContextEqual()

MLIR_CAPI_EXPORTED bool mlirContextEqual ( MlirContext  ctx1,
MlirContext  ctx2 
)

Checks if two contexts are equal.

Definition at line 39 of file IR.cpp.

References unwrap().

◆ mlirContextGetAllowUnregisteredDialects()

MLIR_CAPI_EXPORTED bool mlirContextGetAllowUnregisteredDialects ( MlirContext  context)

Returns whether the context allows unregistered dialects.

Definition at line 49 of file IR.cpp.

References unwrap().

Referenced by mlirContextIsNull(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirContextGetNumLoadedDialects()

MLIR_CAPI_EXPORTED intptr_t mlirContextGetNumLoadedDialects ( MlirContext  context)

Returns the number of dialects loaded by the context.

Definition at line 63 of file IR.cpp.

References unwrap().

Referenced by mlirContextIsNull().

◆ mlirContextGetNumRegisteredDialects()

MLIR_CAPI_EXPORTED intptr_t mlirContextGetNumRegisteredDialects ( MlirContext  context)

Returns the number of dialects registered with the given context.

A registered dialect will be loaded if needed by the parser.

Definition at line 52 of file IR.cpp.

References unwrap().

Referenced by mlirContextIsNull().

◆ mlirContextGetOrLoadDialect()

MLIR_CAPI_EXPORTED MlirDialect mlirContextGetOrLoadDialect ( MlirContext  context,
MlirStringRef  name 
)

Gets the dialect instance owned by the given context using the dialect namespace to identify it, loads (i.e., constructs the instance of) the dialect if necessary.

If the dialect is not registered with the context, returns null. Use mlirContextLoad<Name>Dialect to load an unregistered dialect.

Definition at line 67 of file IR.cpp.

References unwrap(), and wrap().

Referenced by mlir::python::PyDialects::getDialectForKey(), mlirContextIsNull(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirContextIsNull()

static bool mlirContextIsNull ( MlirContext  context)
inlinestatic

◆ mlirContextIsRegisteredOperation()

MLIR_CAPI_EXPORTED bool mlirContextIsRegisteredOperation ( MlirContext  context,
MlirStringRef  name 
)

Returns whether the given fully-qualified operation (i.e.

'dialect.operation') is registered with the context. This will return true if the dialect is loaded and the operation is registered within the dialect.

Definition at line 72 of file IR.cpp.

References unwrap().

Referenced by mlirContextIsNull(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirContextSetAllowUnregisteredDialects()

MLIR_CAPI_EXPORTED void mlirContextSetAllowUnregisteredDialects ( MlirContext  context,
bool  allow 
)

Sets whether unregistered dialects are allowed in this context.

Definition at line 45 of file IR.cpp.

References unwrap().

Referenced by mlirContextIsNull(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirDialectEqual()

MLIR_CAPI_EXPORTED bool mlirDialectEqual ( MlirDialect  dialect1,
MlirDialect  dialect2 
)

Checks if two dialects that belong to the same context are equal.

Dialects from different contexts will not compare equal.

Definition at line 88 of file IR.cpp.

References unwrap().

Referenced by mlirDialectIsNull().

◆ mlirDialectGetContext()

MLIR_CAPI_EXPORTED MlirContext mlirDialectGetContext ( MlirDialect  dialect)

Returns the context that owns the dialect.

Definition at line 84 of file IR.cpp.

References unwrap(), and wrap().

Referenced by mlirContextIsNull().

◆ mlirDialectGetNamespace()

MLIR_CAPI_EXPORTED MlirStringRef mlirDialectGetNamespace ( MlirDialect  dialect)

Returns the namespace of the given dialect.

Definition at line 92 of file IR.cpp.

References unwrap(), and wrap().

Referenced by mlirDialectIsNull(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirDialectIsNull()

static bool mlirDialectIsNull ( MlirDialect  dialect)
inlinestatic

◆ mlirDialectRegistryCreate()

MLIR_CAPI_EXPORTED MlirDialectRegistry mlirDialectRegistryCreate ( )

Creates a dialect registry and transfers its ownership to the caller.

Definition at line 100 of file IR.cpp.

References wrap().

Referenced by mlirDialectIsNull().

◆ mlirDialectRegistryDestroy()

MLIR_CAPI_EXPORTED void mlirDialectRegistryDestroy ( MlirDialectRegistry  registry)

Takes a dialect registry owned by the caller and destroys it.

Definition at line 104 of file IR.cpp.

References unwrap().

Referenced by mlirDialectRegistryIsNull().

◆ mlirDialectRegistryIsNull()

static bool mlirDialectRegistryIsNull ( MlirDialectRegistry  registry)
inlinestatic

◆ mlirIdentifierEqual()

MLIR_CAPI_EXPORTED bool mlirIdentifierEqual ( MlirIdentifier  ident,
MlirIdentifier  other 
)

Checks whether two identifiers are the same.

Definition at line 787 of file IR.cpp.

References unwrap().

Referenced by mlirAttributeIsNull().

◆ mlirIdentifierGet()

MLIR_CAPI_EXPORTED MlirIdentifier mlirIdentifierGet ( MlirContext  context,
MlirStringRef  str 
)

Gets an identifier with the given string value.

Definition at line 779 of file IR.cpp.

References unwrap(), and wrap().

Referenced by mlir::python::PyOperation::create(), mlirAttributeIsNull(), and mlir::python::PyNamedAttribute::PyNamedAttribute().

◆ mlirIdentifierGetContext()

MLIR_CAPI_EXPORTED MlirContext mlirIdentifierGetContext ( MlirIdentifier  )

Returns the context associated with this identifier.

Definition at line 783 of file IR.cpp.

References unwrap(), and wrap().

Referenced by mlirAttributeIsNull().

◆ mlirIdentifierStr()

MLIR_CAPI_EXPORTED MlirStringRef mlirIdentifierStr ( MlirIdentifier  ident)

◆ mlirLocationCallSiteGet()

MLIR_CAPI_EXPORTED MlirLocation mlirLocationCallSiteGet ( MlirLocation  callee,
MlirLocation  caller 
)

Creates a call site location with a callee and a caller.

Definition at line 149 of file IR.cpp.

References unwrap(), and wrap().

Referenced by mlirDialectRegistryIsNull(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirLocationEqual()

MLIR_CAPI_EXPORTED bool mlirLocationEqual ( MlirLocation  l1,
MlirLocation  l2 
)

Checks if two locations are equal.

Definition at line 174 of file IR.cpp.

References unwrap().

Referenced by mlirLocationIsNull(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirLocationFileLineColGet()

MLIR_CAPI_EXPORTED MlirLocation mlirLocationFileLineColGet ( MlirContext  context,
MlirStringRef  filename,
unsigned  line,
unsigned  col 
)

Creates an File/Line/Column location owned by the given context.

Definition at line 142 of file IR.cpp.

References unwrap(), and wrap().

Referenced by mlirDialectRegistryIsNull(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirLocationFusedGet()

MLIR_CAPI_EXPORTED MlirLocation mlirLocationFusedGet ( MlirContext  ctx,
intptr_t  nLocations,
MlirLocation const *  locations,
MlirAttribute  metadata 
)

Creates a fused location with an array of locations and metadata.

Definition at line 153 of file IR.cpp.

References unwrap(), unwrapList(), and wrap().

Referenced by mlirDialectRegistryIsNull(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirLocationGetContext()

MLIR_CAPI_EXPORTED MlirContext mlirLocationGetContext ( MlirLocation  location)

Gets the context that a location was created with.

Definition at line 178 of file IR.cpp.

References unwrap(), and wrap().

Referenced by mlir::python::PyLocation::createFromCapsule(), mlir::python::PyDiagnostic::getLocation(), and mlirDialectRegistryIsNull().

◆ mlirLocationIsNull()

static bool mlirLocationIsNull ( MlirLocation  location)
inlinestatic

◆ mlirLocationNameGet()

MLIR_CAPI_EXPORTED MlirLocation mlirLocationNameGet ( MlirContext  context,
MlirStringRef  name,
MlirLocation  childLoc 
)

Creates a name location owned by the given context.

Providing null location for childLoc is allowed and if childLoc is null location, then the behavior is the same as having unknown child location.

Definition at line 161 of file IR.cpp.

References mlirLocationIsNull(), unwrap(), and wrap().

Referenced by mlirDialectRegistryIsNull(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirLocationPrint()

MLIR_CAPI_EXPORTED void mlirLocationPrint ( MlirLocation  location,
MlirStringCallback  callback,
void userData 
)

Prints a location by sending chunks of the string representation and forwarding userData tocallback`.

Note that the callback may be called several times with consecutive chunks of the string.

Definition at line 182 of file IR.cpp.

References mlir::Diagnostic::print(), and unwrap().

Referenced by mlirLocationIsNull(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirLocationUnknownGet()

MLIR_CAPI_EXPORTED MlirLocation mlirLocationUnknownGet ( MlirContext  context)

Creates a location with unknown position owned by the given context.

Definition at line 170 of file IR.cpp.

References unwrap(), and wrap().

Referenced by PyGlobalDebugFlag::bind(), mlirDialectRegistryIsNull(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirModuleCreateEmpty()

MLIR_CAPI_EXPORTED MlirModule mlirModuleCreateEmpty ( MlirLocation  location)

Creates a new, empty module and transfers ownership to the caller.

Definition at line 192 of file IR.cpp.

References unwrap(), and wrap().

Referenced by mlirLocationIsNull(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirModuleCreateParse()

MLIR_CAPI_EXPORTED MlirModule mlirModuleCreateParse ( MlirContext  context,
MlirStringRef  module 
)

Parses a module from the string and transfers ownership to the caller.

Definition at line 196 of file IR.cpp.

References mlir::OwningOpRef< OpTy >::release(), and unwrap().

Referenced by mlirLocationIsNull(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirModuleDestroy()

MLIR_CAPI_EXPORTED void mlirModuleDestroy ( MlirModule  module)

Takes a module owned by the caller and deletes it.

Definition at line 212 of file IR.cpp.

References unwrap().

Referenced by mlirModuleIsNull(), and mlir::python::PyModule::~PyModule().

◆ mlirModuleFromOperation()

MLIR_CAPI_EXPORTED MlirModule mlirModuleFromOperation ( MlirOperation  op)

Views the generic operation as a module.

The returned module is null when the input operation was not a ModuleOp.

Definition at line 222 of file IR.cpp.

References unwrap(), and wrap().

Referenced by mlirModuleIsNull().

◆ mlirModuleGetBody()

MLIR_CAPI_EXPORTED MlirBlock mlirModuleGetBody ( MlirModule  module)

Gets the body of the module, i.e. the only block it contains.

Definition at line 208 of file IR.cpp.

References unwrap(), and wrap().

Referenced by mlirLocationIsNull(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirModuleGetContext()

MLIR_CAPI_EXPORTED MlirContext mlirModuleGetContext ( MlirModule  module)

Gets the context that a module was created with.

Definition at line 204 of file IR.cpp.

References unwrap(), and wrap().

Referenced by mlir::python::PyModule::forModule(), and mlirLocationIsNull().

◆ mlirModuleGetOperation()

MLIR_CAPI_EXPORTED MlirOperation mlirModuleGetOperation ( MlirModule  module)

Views the module as a generic operation.

Definition at line 218 of file IR.cpp.

References unwrap(), and wrap().

Referenced by mlirModuleIsNull(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirModuleIsNull()

static bool mlirModuleIsNull ( MlirModule  module)
inlinestatic

◆ mlirNamedAttributeGet()

MLIR_CAPI_EXPORTED MlirNamedAttribute mlirNamedAttributeGet ( MlirIdentifier  name,
MlirAttribute  attr 
)

Associates an attribute with the name. Takes ownership of neither.

Definition at line 770 of file IR.cpp.

Referenced by mlir::python::PyOperation::create(), mlirAttributeIsNull(), and mlir::python::PyNamedAttribute::PyNamedAttribute().

◆ mlirOperationClone()

MLIR_CAPI_EXPORTED MlirOperation mlirOperationClone ( MlirOperation  op)

Creates a deep copy of an operation.

The operation is not inserted and ownership is transferred to the caller.

Definition at line 353 of file IR.cpp.

References unwrap(), and wrap().

Referenced by mlir::python::PyOperation::clone().

◆ mlirOperationCreate()

MLIR_CAPI_EXPORTED MlirOperation mlirOperationCreate ( MlirOperationState state)

Creates an operation and transfers ownership to the caller.

Note that caller owned child objects are transferred in this call and must not be further used. Particularly, this applies to any regions added to the state (the implementation may invalidate any such pointers).

This call can fail under the following conditions, in which case, it will return a null operation and emit diagnostics:

  • Result type inference is enabled and cannot be performed.

Definition at line 315 of file IR.cpp.

References mlir::OperationState::addAttribute(), mlir::OperationState::addOperands(), mlir::OperationState::addRegion(), mlir::OperationState::addSuccessors(), mlir::OperationState::addTypes(), MlirNamedAttribute::attribute, MlirOperationState::attributes, mlir::OperationState::attributes, mlir::Operation::create(), MlirOperationState::enableResultTypeInference, mlir::failed(), inferOperationTypes(), MlirOperationState::location, MlirNamedAttribute::name, MlirOperationState::name, MlirOperationState::nAttributes, MlirOperationState::nOperands, MlirOperationState::nRegions, MlirOperationState::nResults, MlirOperationState::nSuccessors, MlirOperationState::operands, MlirOperationState::regions, mlir::NamedAttrList::reserve(), MlirOperationState::results, MlirOperationState::successors, mlir::OperationState::types, unwrap(), unwrapList(), and wrap().

Referenced by mlir::python::PyOperation::create().

◆ mlirOperationDestroy()

MLIR_CAPI_EXPORTED void mlirOperationDestroy ( MlirOperation  op)

Takes an operation owned by the caller and destroys it.

Definition at line 357 of file IR.cpp.

References unwrap().

Referenced by mlir::python::PyOperation::erase(), and mlir::python::PyOperation::~PyOperation().

◆ mlirOperationDump()

MLIR_CAPI_EXPORTED void mlirOperationDump ( MlirOperation  op)

Prints an operation to stderr.

Definition at line 483 of file IR.cpp.

References unwrap().

Referenced by mlirOperationIsNull(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirOperationEqual()

MLIR_CAPI_EXPORTED bool mlirOperationEqual ( MlirOperation  op,
MlirOperation  other 
)

Checks whether two operation handles point to the same operation.

This does not perform deep comparison.

Definition at line 361 of file IR.cpp.

References unwrap().

Referenced by mlirOperationIsNull(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirOperationGetAttribute()

MLIR_CAPI_EXPORTED MlirNamedAttribute mlirOperationGetAttribute ( MlirOperation  op,
intptr_t  pos 
)

Return pos-th attribute of the operation.

Definition at line 452 of file IR.cpp.

References mlir::NamedAttribute::getName(), mlir::NamedAttribute::getValue(), unwrap(), and wrap().

Referenced by mlirOperationIsNull(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirOperationGetAttributeByName()

MLIR_CAPI_EXPORTED MlirAttribute mlirOperationGetAttributeByName ( MlirOperation  op,
MlirStringRef  name 
)

◆ mlirOperationGetBlock()

MLIR_CAPI_EXPORTED MlirBlock mlirOperationGetBlock ( MlirOperation  op)

Gets the block that owns this operation, returning null if the operation is not owned.

Definition at line 383 of file IR.cpp.

References unwrap(), and wrap().

Referenced by mlir::python::PyOperation::getBlock(), and mlirOperationIsNull().

◆ mlirOperationGetContext()

MLIR_CAPI_EXPORTED MlirContext mlirOperationGetContext ( MlirOperation  op)

Gets the context this operation is associated with.

Definition at line 365 of file IR.cpp.

References unwrap(), and wrap().

Referenced by mlir::python::PyOperation::createFromCapsule(), mlir::python::PyValue::createFromCapsule(), and mlirOperationIsNull().

◆ mlirOperationGetFirstRegion()

MLIR_CAPI_EXPORTED MlirRegion mlirOperationGetFirstRegion ( MlirOperation  op)

Returns first region attached to the operation.

Definition at line 399 of file IR.cpp.

References mlir::Operation::getNumRegions(), mlir::Operation::getRegion(), unwrap(), and wrap().

Referenced by mlirRegionIsNull().

◆ mlirOperationGetLocation()

MLIR_CAPI_EXPORTED MlirLocation mlirOperationGetLocation ( MlirOperation  op)

Gets the location of the operation.

Definition at line 369 of file IR.cpp.

References unwrap(), and wrap().

Referenced by mlirOperationIsNull(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirOperationGetName()

MLIR_CAPI_EXPORTED MlirIdentifier mlirOperationGetName ( MlirOperation  op)

◆ mlirOperationGetNextInBlock()

MLIR_CAPI_EXPORTED MlirOperation mlirOperationGetNextInBlock ( MlirOperation  op)

Returns an operation immediately following the given operation it its enclosing block.

Definition at line 415 of file IR.cpp.

References unwrap(), and wrap().

Referenced by PyGlobalDebugFlag::bind(), and mlirOperationIsNull().

◆ mlirOperationGetNumAttributes()

MLIR_CAPI_EXPORTED intptr_t mlirOperationGetNumAttributes ( MlirOperation  op)

Returns the number of attributes attached to the operation.

Definition at line 448 of file IR.cpp.

References unwrap().

Referenced by mlirOperationIsNull(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirOperationGetNumOperands()

MLIR_CAPI_EXPORTED intptr_t mlirOperationGetNumOperands ( MlirOperation  op)

Returns the number of operands of the operation.

Definition at line 419 of file IR.cpp.

References unwrap().

Referenced by mlirOperationIsNull(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirOperationGetNumRegions()

MLIR_CAPI_EXPORTED intptr_t mlirOperationGetNumRegions ( MlirOperation  op)

Returns the number of regions attached to the given operation.

Definition at line 391 of file IR.cpp.

References unwrap().

Referenced by PyGlobalDebugFlag::bind(), and mlirOperationIsNull().

◆ mlirOperationGetNumResults()

MLIR_CAPI_EXPORTED intptr_t mlirOperationGetNumResults ( MlirOperation  op)

Returns the number of results of the operation.

Definition at line 432 of file IR.cpp.

References unwrap().

Referenced by mlirOperationIsNull(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirOperationGetNumSuccessors()

MLIR_CAPI_EXPORTED intptr_t mlirOperationGetNumSuccessors ( MlirOperation  op)

Returns the number of successor blocks of the operation.

Definition at line 440 of file IR.cpp.

References unwrap().

Referenced by mlirOperationIsNull().

◆ mlirOperationGetOperand()

MLIR_CAPI_EXPORTED MlirValue mlirOperationGetOperand ( MlirOperation  op,
intptr_t  pos 
)

Returns pos-th operand of the operation.

Definition at line 423 of file IR.cpp.

References unwrap(), and wrap().

Referenced by mlirOperationIsNull(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirOperationGetParentOperation()

MLIR_CAPI_EXPORTED MlirOperation mlirOperationGetParentOperation ( MlirOperation  op)

Gets the operation that owns this operation, returning null if the operation is not owned.

Definition at line 387 of file IR.cpp.

References unwrap(), and wrap().

Referenced by mlir::python::PyOperation::getParentOperation(), and mlirOperationIsNull().

◆ mlirOperationGetRegion()

MLIR_CAPI_EXPORTED MlirRegion mlirOperationGetRegion ( MlirOperation  op,
intptr_t  pos 
)

Returns pos-th region attached to the operation.

Definition at line 395 of file IR.cpp.

References unwrap(), and wrap().

Referenced by PyGlobalDebugFlag::bind(), and mlirOperationIsNull().

◆ mlirOperationGetResult()

MLIR_CAPI_EXPORTED MlirValue mlirOperationGetResult ( MlirOperation  op,
intptr_t  pos 
)

Returns pos-th result of the operation.

Definition at line 436 of file IR.cpp.

References unwrap(), and wrap().

Referenced by mlirOperationIsNull(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirOperationGetSuccessor()

MLIR_CAPI_EXPORTED MlirBlock mlirOperationGetSuccessor ( MlirOperation  op,
intptr_t  pos 
)

Returns pos-th successor of the operation.

Definition at line 444 of file IR.cpp.

References unwrap(), and wrap().

Referenced by mlirOperationIsNull().

◆ mlirOperationGetTypeID()

MLIR_CAPI_EXPORTED MlirTypeID mlirOperationGetTypeID ( MlirOperation  op)

Gets the type id of the operation.

Returns null if the operation does not have a registered operation description.

Definition at line 373 of file IR.cpp.

References unwrap(), and wrap().

Referenced by mlirOperationIsNull().

◆ mlirOperationIsNull()

static bool mlirOperationIsNull ( MlirOperation  op)
inlinestatic

Checks whether the underlying operation is null.

Definition at line 376 of file IR.h.

References MLIR_CAPI_EXPORTED, mlirOperationDump(), mlirOperationEqual(), mlirOperationGetAttribute(), mlirOperationGetAttributeByName(), mlirOperationGetBlock(), mlirOperationGetContext(), mlirOperationGetLocation(), mlirOperationGetName(), mlirOperationGetNextInBlock(), mlirOperationGetNumAttributes(), mlirOperationGetNumOperands(), mlirOperationGetNumRegions(), mlirOperationGetNumResults(), mlirOperationGetNumSuccessors(), mlirOperationGetOperand(), mlirOperationGetParentOperation(), mlirOperationGetRegion(), mlirOperationGetResult(), mlirOperationGetSuccessor(), mlirOperationGetTypeID(), mlirOperationMoveAfter(), mlirOperationMoveBefore(), mlirOperationPrint(), mlirOperationPrintWithFlags(), mlirOperationRemoveAttributeByName(), mlirOperationSetAttributeByName(), mlirOperationSetOperand(), mlirOperationVerify(), mlirRegionCreate(), and mlirRegionDestroy().

Referenced by mlir::python::PyInsertionPoint::atBlockBegin(), mlir::python::PyInsertionPoint::atBlockTerminator(), PyGlobalDebugFlag::bind(), mlir::python::PyOperation::createFromCapsule(), mlir::python::PyValue::createFromCapsule(), mlir::python::PySymbolTable::dunderGetItem(), mlir::python::PyOperation::getParentOperation(), mlir::python::PyInsertionPoint::insert(), pybind11::detail::type_caster< MlirOperation >::load(), mlirBlockInsertOwnedOperationAfter(), mlirBlockInsertOwnedOperationBefore(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirOperationMoveAfter()

MLIR_CAPI_EXPORTED void mlirOperationMoveAfter ( MlirOperation  op,
MlirOperation  other 
)

Moves the given operation immediately after the other operation in its parent block.

The given operation may be owned by the caller or by its current block. The other operation must belong to a block. In any case, the ownership is transferred to the block of the other operation.

Definition at line 489 of file IR.cpp.

References unwrap().

Referenced by mlirOperationIsNull(), and mlir::python::PyOperationBase::moveAfter().

◆ mlirOperationMoveBefore()

MLIR_CAPI_EXPORTED void mlirOperationMoveBefore ( MlirOperation  op,
MlirOperation  other 
)

Moves the given operation immediately before the other operation in its parent block.

The given operation may be owner by the caller or by its current block. The other operation must belong to a block. In any case, the ownership is transferred to the block of the other operation.

Definition at line 493 of file IR.cpp.

References unwrap().

Referenced by mlirOperationIsNull(), and mlir::python::PyOperationBase::moveBefore().

◆ mlirOperationPrint()

MLIR_CAPI_EXPORTED void mlirOperationPrint ( MlirOperation  op,
MlirStringCallback  callback,
void userData 
)

Prints an operation by sending chunks of the string representation and forwarding userData tocallback`.

Note that the callback may be called several times with consecutive chunks of the string.

Definition at line 471 of file IR.cpp.

References mlir::Diagnostic::print(), and unwrap().

Referenced by mlirOperationIsNull().

◆ mlirOperationPrintWithFlags()

MLIR_CAPI_EXPORTED void mlirOperationPrintWithFlags ( MlirOperation  op,
MlirOpPrintingFlags  flags,
MlirStringCallback  callback,
void userData 
)

Same as mlirOperationPrint but accepts flags controlling the printing behavior.

Definition at line 477 of file IR.cpp.

References mlir::Diagnostic::print(), and unwrap().

Referenced by mlirOperationIsNull(), and mlir::python::PyOperationBase::print().

◆ mlirOperationRemoveAttributeByName()

MLIR_CAPI_EXPORTED bool mlirOperationRemoveAttributeByName ( MlirOperation  op,
MlirStringRef  name 
)

Removes an attribute by name.

Returns false if the attribute was not found and true if removed.

Definition at line 467 of file IR.cpp.

References unwrap().

Referenced by mlirOperationIsNull(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirOperationRemoveFromParent()

MLIR_CAPI_EXPORTED void mlirOperationRemoveFromParent ( MlirOperation  op)

Removes the given operation from its parent block.

The operation is not destroyed. The ownership of the operation is transferred to the caller.

Definition at line 359 of file IR.cpp.

References unwrap().

Referenced by mlir::python::PyOperation::detachFromParent().

◆ mlirOperationSetAttributeByName()

MLIR_CAPI_EXPORTED void mlirOperationSetAttributeByName ( MlirOperation  op,
MlirStringRef  name,
MlirAttribute  attr 
)

Sets an attribute by name, replacing the existing if it exists or adding a new one otherwise.

Definition at line 462 of file IR.cpp.

References unwrap().

Referenced by mlirOperationIsNull(), mlir::python::PySymbolTable::setSymbolName(), mlir::python::PySymbolTable::setVisibility(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirOperationSetOperand()

MLIR_CAPI_EXPORTED void mlirOperationSetOperand ( MlirOperation  op,
intptr_t  pos,
MlirValue  newValue 
)

Sets the pos-th operand of the operation.

Definition at line 427 of file IR.cpp.

References unwrap().

Referenced by mlirOperationIsNull(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirOperationStateAddAttributes()

MLIR_CAPI_EXPORTED void mlirOperationStateAddAttributes ( MlirOperationState state,
intptr_t  n,
MlirNamedAttribute const *  attributes 
)

Definition at line 271 of file IR.cpp.

References APPEND_ELEMS.

Referenced by mlir::python::PyOperation::create().

◆ mlirOperationStateAddOperands()

MLIR_CAPI_EXPORTED void mlirOperationStateAddOperands ( MlirOperationState state,
intptr_t  n,
MlirValue const *  operands 
)

Definition at line 259 of file IR.cpp.

References APPEND_ELEMS.

Referenced by mlir::python::PyOperation::create().

◆ mlirOperationStateAddOwnedRegions()

MLIR_CAPI_EXPORTED void mlirOperationStateAddOwnedRegions ( MlirOperationState state,
intptr_t  n,
MlirRegion const *  regions 
)

Definition at line 263 of file IR.cpp.

References APPEND_ELEMS.

Referenced by mlir::python::PyOperation::create().

◆ mlirOperationStateAddResults()

MLIR_CAPI_EXPORTED void mlirOperationStateAddResults ( MlirOperationState state,
intptr_t  n,
MlirType const *  results 
)

Adds a list of components to the operation state.

Definition at line 254 of file IR.cpp.

References APPEND_ELEMS.

Referenced by mlir::python::PyOperation::create().

◆ mlirOperationStateAddSuccessors()

MLIR_CAPI_EXPORTED void mlirOperationStateAddSuccessors ( MlirOperationState state,
intptr_t  n,
MlirBlock const *  successors 
)

Definition at line 267 of file IR.cpp.

References APPEND_ELEMS.

Referenced by mlir::python::PyOperation::create().

◆ mlirOperationStateEnableResultTypeInference()

MLIR_CAPI_EXPORTED void mlirOperationStateEnableResultTypeInference ( MlirOperationState state)

Enables result type inference for the operation under construction.

If enabled, then the caller must not have called mlirOperationStateAddResults(). Note that if enabled, the mlirOperationCreate() call is failable: it will return a null operation on inference failure and will emit diagnostics.

Definition at line 276 of file IR.cpp.

References MlirOperationState::enableResultTypeInference.

◆ mlirOperationStateGet()

MLIR_CAPI_EXPORTED MlirOperationState mlirOperationStateGet ( MlirStringRef  name,
MlirLocation  loc 
)

◆ mlirOperationVerify()

MLIR_CAPI_EXPORTED bool mlirOperationVerify ( MlirOperation  op)

Verify the operation and return true if it passes, false if it fails.

Definition at line 485 of file IR.cpp.

References mlir::succeeded(), unwrap(), and mlir::verify().

Referenced by mlirOperationIsNull(), mlir::python::PyOperationBase::print(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirOpPrintingFlagsCreate()

MLIR_CAPI_EXPORTED MlirOpPrintingFlags mlirOpPrintingFlagsCreate ( )

Creates new printing flags with defaults, intended for customization.

Must be freed with a call to mlirOpPrintingFlagsDestroy().

Definition at line 112 of file IR.cpp.

References wrap().

Referenced by mlir::python::PyOperationBase::print().

◆ mlirOpPrintingFlagsDestroy()

MLIR_CAPI_EXPORTED void mlirOpPrintingFlagsDestroy ( MlirOpPrintingFlags  flags)

Destroys printing flags created with mlirOpPrintingFlagsCreate.

Definition at line 116 of file IR.cpp.

References unwrap().

Referenced by mlir::python::PyOperationBase::print().

◆ mlirOpPrintingFlagsElideLargeElementsAttrs()

MLIR_CAPI_EXPORTED void mlirOpPrintingFlagsElideLargeElementsAttrs ( MlirOpPrintingFlags  flags,
intptr_t  largeElementLimit 
)

Enables the elision of large elements attributes by printing a lexically valid but otherwise meaningless form instead of the element data.

The largeElementLimit is used to configure what is considered to be a "large" ElementsAttr by providing an upper limit to the number of elements.

Definition at line 120 of file IR.cpp.

References unwrap().

Referenced by mlir::python::PyOperationBase::print().

◆ mlirOpPrintingFlagsEnableDebugInfo()

MLIR_CAPI_EXPORTED void mlirOpPrintingFlagsEnableDebugInfo ( MlirOpPrintingFlags  flags,
bool  prettyForm 
)

Enable printing of debug information.

If 'prettyForm' is set to true, debug information is printed in a more readable 'pretty' form. Note: The IR generated with 'prettyForm' is not parsable.

Definition at line 125 of file IR.cpp.

References unwrap().

Referenced by mlir::python::PyOperationBase::print().

◆ mlirOpPrintingFlagsPrintGenericOpForm()

MLIR_CAPI_EXPORTED void mlirOpPrintingFlagsPrintGenericOpForm ( MlirOpPrintingFlags  flags)

Always print operations in the generic form.

Definition at line 130 of file IR.cpp.

References unwrap().

Referenced by mlir::python::PyOperationBase::print().

◆ mlirOpPrintingFlagsUseLocalScope()

MLIR_CAPI_EXPORTED void mlirOpPrintingFlagsUseLocalScope ( MlirOpPrintingFlags  flags)

Use local scope when printing the operation.

This allows for using the printer in a more localized and thread-safe setting, but may not necessarily be identical to what the IR will look like when dumping the full module.

Definition at line 134 of file IR.cpp.

References unwrap().

Referenced by mlir::python::PyOperationBase::print().

◆ mlirOpResultGetOwner()

MLIR_CAPI_EXPORTED MlirOperation mlirOpResultGetOwner ( MlirValue  value)

Returns an operation that produced this value as its result.

Asserts if the value is not an op result.

Definition at line 690 of file IR.cpp.

References unwrap(), and wrap().

Referenced by mlir::python::PyValue::createFromCapsule(), mlirValueIsNull(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirOpResultGetResultNumber()

MLIR_CAPI_EXPORTED intptr_t mlirOpResultGetResultNumber ( MlirValue  value)

Returns the position of the value in the list of results of the operation that produced it.

Definition at line 694 of file IR.cpp.

References unwrap().

Referenced by mlirValueIsNull(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirRegionAppendOwnedBlock()

MLIR_CAPI_EXPORTED void mlirRegionAppendOwnedBlock ( MlirRegion  region,
MlirBlock  block 
)

Takes a block owned by the caller and appends it to the given region.

Definition at line 514 of file IR.cpp.

References unwrap().

Referenced by PyGlobalDebugFlag::bind(), mlirRegionInsertOwnedBlockBefore(), mlirRegionIsNull(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirRegionCreate()

MLIR_CAPI_EXPORTED MlirRegion mlirRegionCreate ( )

Creates a new empty region and transfers ownership to the caller.

Definition at line 501 of file IR.cpp.

References wrap().

Referenced by mlir::python::PyOperation::create(), and mlirOperationIsNull().

◆ mlirRegionDestroy()

MLIR_CAPI_EXPORTED void mlirRegionDestroy ( MlirRegion  region)

Takes a region owned by the caller and destroys it.

Definition at line 549 of file IR.cpp.

Referenced by mlirOperationIsNull().

◆ mlirRegionEqual()

MLIR_CAPI_EXPORTED bool mlirRegionEqual ( MlirRegion  region,
MlirRegion  other 
)

Checks whether two region handles point to the same region.

This does not perform deep comparison.

Definition at line 503 of file IR.cpp.

References unwrap().

Referenced by mlirRegionIsNull().

◆ mlirRegionGetFirstBlock()

MLIR_CAPI_EXPORTED MlirBlock mlirRegionGetFirstBlock ( MlirRegion  region)

Gets the first block in the region.

Definition at line 507 of file IR.cpp.

References mlir::Region::empty(), mlir::Region::front(), unwrap(), and wrap().

Referenced by PyGlobalDebugFlag::bind(), mlirRegionIsNull(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirRegionGetNextInOperation()

MLIR_CAPI_EXPORTED MlirRegion mlirRegionGetNextInOperation ( MlirRegion  region)

Returns the region immediately following the given region in its parent operation.

Definition at line 406 of file IR.cpp.

References mlir::Operation::getNumRegions(), mlir::Region::getParentOp(), mlir::Operation::getRegion(), mlir::Region::getRegionNumber(), unwrap(), and wrap().

Referenced by mlirRegionIsNull().

◆ mlirRegionInsertOwnedBlock()

MLIR_CAPI_EXPORTED void mlirRegionInsertOwnedBlock ( MlirRegion  region,
intptr_t  pos,
MlirBlock  block 
)

Takes a block owned by the caller and inserts it at pos to the given region.

This is an expensive operation that linearly scans the region, prefer insertAfter/Before instead.

Definition at line 518 of file IR.cpp.

References unwrap().

Referenced by mlirRegionIsNull(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirRegionInsertOwnedBlockAfter()

MLIR_CAPI_EXPORTED void mlirRegionInsertOwnedBlockAfter ( MlirRegion  region,
MlirBlock  reference,
MlirBlock  block 
)

Takes a block owned by the caller and inserts it after the (non-owned) reference block in the given region.

The reference block must belong to the region. If the reference block is null, prepends the block to the region.

Definition at line 524 of file IR.cpp.

References mlir::Region::begin(), mlir::Region::getBlocks(), mlirBlockIsNull(), and unwrap().

Referenced by mlirRegionIsNull(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirRegionInsertOwnedBlockBefore()

MLIR_CAPI_EXPORTED void mlirRegionInsertOwnedBlockBefore ( MlirRegion  region,
MlirBlock  reference,
MlirBlock  block 
)

Takes a block owned by the caller and inserts it before the (non-owned) reference block in the given region.

The reference block must belong to the region. If the reference block is null, appends the block to the region.

Definition at line 538 of file IR.cpp.

References mlirBlockIsNull(), mlirRegionAppendOwnedBlock(), and unwrap().

Referenced by mlirRegionIsNull(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirRegionIsNull()

static bool mlirRegionIsNull ( MlirRegion  region)
inlinestatic

◆ mlirSymbolTableCreate()

MLIR_CAPI_EXPORTED MlirSymbolTable mlirSymbolTableCreate ( MlirOperation  operation)

Creates a symbol table for the given operation.

If the operation does not have the SymbolTable trait, returns a null symbol table.

Definition at line 807 of file IR.cpp.

References unwrap(), and wrap().

Referenced by mlirAttributeIsNull(), and mlir::python::PySymbolTable::PySymbolTable().

◆ mlirSymbolTableDestroy()

MLIR_CAPI_EXPORTED void mlirSymbolTableDestroy ( MlirSymbolTable  symbolTable)

Destroys the symbol table created with mlirSymbolTableCreate.

This does not affect the operations in the table.

Definition at line 813 of file IR.cpp.

References unwrap().

Referenced by mlirSymbolTableIsNull(), and mlir::python::PySymbolTable::~PySymbolTable().

◆ mlirSymbolTableErase()

MLIR_CAPI_EXPORTED void mlirSymbolTableErase ( MlirSymbolTable  symbolTable,
MlirOperation  operation 
)

Removes the given operation from the symbol table and erases it.

Definition at line 827 of file IR.cpp.

References unwrap().

Referenced by mlir::python::PySymbolTable::erase(), and mlirSymbolTableIsNull().

◆ mlirSymbolTableGetSymbolAttributeName()

MLIR_CAPI_EXPORTED MlirStringRef mlirSymbolTableGetSymbolAttributeName ( )

Returns the name of the attribute used to store symbol names compatible with symbol tables.

Definition at line 799 of file IR.cpp.

References mlir::SymbolTable::getSymbolAttrName(), and wrap().

Referenced by mlir::python::PySymbolTable::getSymbolName(), mlir::python::PySymbolTable::insert(), mlirAttributeIsNull(), and mlir::python::PySymbolTable::setSymbolName().

◆ mlirSymbolTableGetVisibilityAttributeName()

MLIR_CAPI_EXPORTED MlirStringRef mlirSymbolTableGetVisibilityAttributeName ( )

Returns the name of the attribute used to store symbol visibility.

Definition at line 803 of file IR.cpp.

References mlir::SymbolTable::getVisibilityAttrName(), and wrap().

Referenced by mlir::python::PySymbolTable::getVisibility(), mlirAttributeIsNull(), and mlir::python::PySymbolTable::setVisibility().

◆ mlirSymbolTableInsert()

MLIR_CAPI_EXPORTED MlirAttribute mlirSymbolTableInsert ( MlirSymbolTable  symbolTable,
MlirOperation  operation 
)

Inserts the given operation into the given symbol table.

The operation must have the symbol trait. If the symbol table already has a symbol with the same name, renames the symbol being inserted to ensure name uniqueness. Note that this does not move the operation itself into the block of the symbol table operation, this should be done separately. Returns the name of the symbol after insertion.

Definition at line 822 of file IR.cpp.

References unwrap(), and wrap().

Referenced by mlir::python::PySymbolTable::insert(), and mlirSymbolTableIsNull().

◆ mlirSymbolTableIsNull()

static bool mlirSymbolTableIsNull ( MlirSymbolTable  symbolTable)
inlinestatic

◆ mlirSymbolTableLookup()

MLIR_CAPI_EXPORTED MlirOperation mlirSymbolTableLookup ( MlirSymbolTable  symbolTable,
MlirStringRef  name 
)

Looks up a symbol with the given name in the given symbol table and returns the operation that corresponds to the symbol.

If the symbol cannot be found, returns a null operation.

Definition at line 817 of file IR.cpp.

References MlirStringRef::data, MlirStringRef::length, unwrap(), and wrap().

Referenced by mlir::python::PySymbolTable::dunderGetItem(), mlirSymbolTableIsNull(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirSymbolTableReplaceAllSymbolUses()

MLIR_CAPI_EXPORTED MlirLogicalResult mlirSymbolTableReplaceAllSymbolUses ( MlirStringRef  oldSymbol,
MlirStringRef  newSymbol,
MlirOperation  from 
)

Attempt to replace all uses that are nested within the given operation of the given symbol 'oldSymbol' with the provided 'newSymbol'.

This does not traverse into nested symbol tables. Will fail atomically if there are any unknown operations that may be potential symbol tables.

Definition at line 832 of file IR.cpp.

References mlir::SymbolTable::replaceAllSymbolUses(), unwrap(), and wrap().

Referenced by mlirSymbolTableIsNull(), and mlir::python::PySymbolTable::replaceAllSymbolUses().

◆ mlirSymbolTableWalkSymbolTables()

MLIR_CAPI_EXPORTED void mlirSymbolTableWalkSymbolTables ( MlirOperation  from,
bool  allSymUsesVisible,
void(*)(MlirOperation, bool, void *userData)  callback,
void userData 
)

Walks all symbol table operations nested within, and including, op.

For each symbol table operation, the provided callback is invoked with the op and a boolean signifying if the symbols within that symbol table can be treated as if all uses within the IR are visible to the caller. allSymUsesVisible identifies whether all of the symbol uses of symbols within op are visible.

Definition at line 843 of file IR.cpp.

References unwrap(), mlir::SymbolTable::walkSymbolTables(), and wrap().

Referenced by mlirSymbolTableIsNull(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirTypeDump()

MLIR_CAPI_EXPORTED void mlirTypeDump ( MlirType  type)

Prints the type to the standard error stream.

Definition at line 736 of file IR.cpp.

References unwrap().

Referenced by mlirTypeIsNull(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirTypeEqual()

MLIR_CAPI_EXPORTED bool mlirTypeEqual ( MlirType  t1,
MlirType  t2 
)

Checks if two types are equal.

Definition at line 727 of file IR.cpp.

References unwrap().

Referenced by mlirTypeIsNull(), and mlir::python::PyType::operator==().

◆ mlirTypeGetContext()

MLIR_CAPI_EXPORTED MlirContext mlirTypeGetContext ( MlirType  type)

Gets the context that a type was created with.

Definition at line 719 of file IR.cpp.

References unwrap(), and wrap().

Referenced by PyGlobalDebugFlag::bind(), mlir::python::PyType::createFromCapsule(), mlirValueIsNull(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirTypeGetTypeID()

MLIR_CAPI_EXPORTED MlirTypeID mlirTypeGetTypeID ( MlirType  type)

Gets the type ID of the type.

Definition at line 723 of file IR.cpp.

References unwrap(), and wrap().

Referenced by mlirValueIsNull().

◆ mlirTypeIsNull()

static bool mlirTypeIsNull ( MlirType  type)
inlinestatic

◆ mlirTypeParseGet()

MLIR_CAPI_EXPORTED MlirType mlirTypeParseGet ( MlirContext  context,
MlirStringRef  type 
)

Parses a type. The type is owned by the context.

Definition at line 715 of file IR.cpp.

References mlir::parseType(), unwrap(), and wrap().

Referenced by mlirValueIsNull(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirTypePrint()

MLIR_CAPI_EXPORTED void mlirTypePrint ( MlirType  type,
MlirStringCallback  callback,
void userData 
)

Prints a location by sending chunks of the string representation and forwarding userData tocallback`.

Note that the callback may be called several times with consecutive chunks of the string.

Definition at line 731 of file IR.cpp.

References mlir::Diagnostic::print(), and unwrap().

Referenced by mlirTypeIsNull(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirValueDump()

MLIR_CAPI_EXPORTED void mlirValueDump ( MlirValue  value)

Prints the value to the standard error stream.

Definition at line 703 of file IR.cpp.

References unwrap().

Referenced by mlirValueIsNull(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirValueEqual()

MLIR_CAPI_EXPORTED bool mlirValueEqual ( MlirValue  value1,
MlirValue  value2 
)

Returns 1 if two values are equal, 0 otherwise.

Definition at line 665 of file IR.cpp.

References unwrap().

Referenced by mlirValueIsNull().

◆ mlirValueGetType()

MLIR_CAPI_EXPORTED MlirType mlirValueGetType ( MlirValue  value)

Returns the type of the value.

Definition at line 699 of file IR.cpp.

References unwrap(), and wrap().

Referenced by mlirValueIsNull(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirValueIsABlockArgument()

MLIR_CAPI_EXPORTED bool mlirValueIsABlockArgument ( MlirValue  value)

Returns 1 if the value is a block argument, 0 otherwise.

Definition at line 669 of file IR.cpp.

References unwrap().

Referenced by mlir::python::PyValue::createFromCapsule(), mlirValueIsNull(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirValueIsAOpResult()

MLIR_CAPI_EXPORTED bool mlirValueIsAOpResult ( MlirValue  value)

Returns 1 if the value is an operation result, 0 otherwise.

Definition at line 673 of file IR.cpp.

References unwrap().

Referenced by mlir::python::PyValue::createFromCapsule(), mlirValueIsNull(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirValueIsNull()

static bool mlirValueIsNull ( MlirValue  value)
inlinestatic

◆ mlirValuePrint()

MLIR_CAPI_EXPORTED void mlirValuePrint ( MlirValue  value,
MlirStringCallback  callback,
void userData 
)

Prints a value by sending chunks of the string representation and forwarding userData tocallback`.

Note that the callback may be called several times with consecutive chunks of the string.

Definition at line 705 of file IR.cpp.

References mlir::Diagnostic::print(), and unwrap().

Referenced by mlirValueIsNull(), and mlir::python::PySymbolTable::walkSymbolTables().