MLIR  18.0.0git
Macros | Functions
IR.cpp File Reference
#include "mlir-c/IR.h"
#include "mlir-c/Support.h"
#include "mlir/AsmParser/AsmParser.h"
#include "mlir/Bytecode/BytecodeWriter.h"
#include "mlir/CAPI/IR.h"
#include "mlir/CAPI/Support.h"
#include "mlir/CAPI/Utils.h"
#include "mlir/IR/Attributes.h"
#include "mlir/IR/BuiltinAttributes.h"
#include "mlir/IR/BuiltinOps.h"
#include "mlir/IR/Diagnostics.h"
#include "mlir/IR/Dialect.h"
#include "mlir/IR/Location.h"
#include "mlir/IR/Operation.h"
#include "mlir/IR/OperationSupport.h"
#include "mlir/IR/Types.h"
#include "mlir/IR/Value.h"
#include "mlir/IR/Verifier.h"
#include "mlir/IR/Visitors.h"
#include "mlir/Interfaces/InferTypeOpInterface.h"
#include "mlir/Parser/Parser.h"
#include <cstddef>
#include <memory>
#include <optional>

Go to the source code of this file.

Macros

#define APPEND_ELEMS(type, sizeName, elemName)
 

Functions

MlirContext mlirContextCreate ()
 Creates an MLIR context and transfers its ownership to the caller. More...
 
static MLIRContext::Threading toThreadingEnum (bool threadingEnabled)
 
MlirContext mlirContextCreateWithThreading (bool threadingEnabled)
 Creates an MLIR context with an explicit setting of the multithreading setting and transfers its ownership to the caller. More...
 
MlirContext mlirContextCreateWithRegistry (MlirDialectRegistry registry, bool threadingEnabled)
 Creates an MLIR context, setting the multithreading setting explicitly and pre-loading the dialects from the provided DialectRegistry. More...
 
bool mlirContextEqual (MlirContext ctx1, MlirContext ctx2)
 Checks if two contexts are equal. More...
 
void mlirContextDestroy (MlirContext context)
 Takes an MLIR context owned by the caller and destroys it. More...
 
void mlirContextSetAllowUnregisteredDialects (MlirContext context, bool allow)
 Sets whether unregistered dialects are allowed in this context. More...
 
bool mlirContextGetAllowUnregisteredDialects (MlirContext context)
 Returns whether the context allows unregistered dialects. More...
 
intptr_t mlirContextGetNumRegisteredDialects (MlirContext context)
 Returns the number of dialects registered with the given context. More...
 
void mlirContextAppendDialectRegistry (MlirContext ctx, MlirDialectRegistry registry)
 Append the contents of the given dialect registry to the registry associated with the context. More...
 
intptr_t mlirContextGetNumLoadedDialects (MlirContext context)
 Returns the number of dialects loaded by the context. More...
 
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...
 
bool mlirContextIsRegisteredOperation (MlirContext context, MlirStringRef name)
 Returns whether the given fully-qualified operation (i.e. More...
 
void mlirContextEnableMultithreading (MlirContext context, bool enable)
 Set threading mode (must be set to false to mlir-print-ir-after-all). More...
 
void mlirContextLoadAllAvailableDialects (MlirContext context)
 Eagerly loads all available dialects registered with a context, making them available for use for IR construction. More...
 
void mlirContextSetThreadPool (MlirContext context, MlirLlvmThreadPool threadPool)
 Sets the thread pool of the context explicitly, enabling multithreading in the process. More...
 
MlirContext mlirDialectGetContext (MlirDialect dialect)
 Returns the context that owns the dialect. More...
 
bool mlirDialectEqual (MlirDialect dialect1, MlirDialect dialect2)
 Checks if two dialects that belong to the same context are equal. More...
 
MlirStringRef mlirDialectGetNamespace (MlirDialect dialect)
 Returns the namespace of the given dialect. More...
 
MlirDialectRegistry mlirDialectRegistryCreate ()
 Creates a dialect registry and transfers its ownership to the caller. More...
 
void mlirDialectRegistryDestroy (MlirDialectRegistry registry)
 Takes a dialect registry owned by the caller and destroys it. More...
 
MlirAsmState mlirAsmStateCreateForOperation (MlirOperation op, MlirOpPrintingFlags flags)
 Creates new AsmState, as with AsmState the IR should not be mutated in-between using this state. More...
 
static OperationfindParent (Operation *op, bool shouldUseLocalScope)
 
MlirAsmState mlirAsmStateCreateForValue (MlirValue value, MlirOpPrintingFlags flags)
 Creates new AsmState from value. More...
 
void mlirAsmStateDestroy (MlirAsmState state)
 Destroys printing flags created with mlirAsmStateCreate. More...
 
MlirOpPrintingFlags mlirOpPrintingFlagsCreate ()
 Creates new printing flags with defaults, intended for customization. More...
 
void mlirOpPrintingFlagsDestroy (MlirOpPrintingFlags flags)
 Destroys printing flags created with mlirOpPrintingFlagsCreate. More...
 
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...
 
void mlirOpPrintingFlagsEnableDebugInfo (MlirOpPrintingFlags flags, bool enable, bool prettyForm)
 Enable or disable printing of debug information (based on enable). More...
 
void mlirOpPrintingFlagsPrintGenericOpForm (MlirOpPrintingFlags flags)
 Always print operations in the generic form. More...
 
void mlirOpPrintingFlagsUseLocalScope (MlirOpPrintingFlags flags)
 Use local scope when printing the operation. More...
 
void mlirOpPrintingFlagsAssumeVerified (MlirOpPrintingFlags flags)
 Do not verify the operation when using custom operation printers. More...
 
MlirBytecodeWriterConfig mlirBytecodeWriterConfigCreate ()
 Creates new printing flags with defaults, intended for customization. More...
 
void mlirBytecodeWriterConfigDestroy (MlirBytecodeWriterConfig config)
 Destroys printing flags created with mlirBytecodeWriterConfigCreate. More...
 
void mlirBytecodeWriterConfigDesiredEmitVersion (MlirBytecodeWriterConfig flags, int64_t version)
 Sets the version to emit in the writer config. More...
 
MlirAttribute mlirLocationGetAttribute (MlirLocation location)
 Returns the underlying location attribute of this location. More...
 
MlirLocation mlirLocationFromAttribute (MlirAttribute attribute)
 Creates a location from a location attribute. More...
 
MlirLocation mlirLocationFileLineColGet (MlirContext context, MlirStringRef filename, unsigned line, unsigned col)
 Creates an File/Line/Column location owned by the given context. More...
 
MlirLocation mlirLocationCallSiteGet (MlirLocation callee, MlirLocation caller)
 Creates a call site location with a callee and a caller. More...
 
MlirLocation mlirLocationFusedGet (MlirContext ctx, intptr_t nLocations, MlirLocation const *locations, MlirAttribute metadata)
 Creates a fused location with an array of locations and metadata. More...
 
MlirLocation mlirLocationNameGet (MlirContext context, MlirStringRef name, MlirLocation childLoc)
 Creates a name location owned by the given context. More...
 
MlirLocation mlirLocationUnknownGet (MlirContext context)
 Creates a location with unknown position owned by the given context. More...
 
bool mlirLocationEqual (MlirLocation l1, MlirLocation l2)
 Checks if two locations are equal. More...
 
MlirContext mlirLocationGetContext (MlirLocation location)
 Gets the context that a location was created with. More...
 
void mlirLocationPrint (MlirLocation location, MlirStringCallback callback, void *userData)
 Prints a location by sending chunks of the string representation and forwarding userData tocallback`. More...
 
MlirModule mlirModuleCreateEmpty (MlirLocation location)
 Creates a new, empty module and transfers ownership to the caller. More...
 
MlirModule mlirModuleCreateParse (MlirContext context, MlirStringRef module)
 Parses a module from the string and transfers ownership to the caller. More...
 
MlirContext mlirModuleGetContext (MlirModule module)
 Gets the context that a module was created with. More...
 
MlirBlock mlirModuleGetBody (MlirModule module)
 Gets the body of the module, i.e. the only block it contains. More...
 
void mlirModuleDestroy (MlirModule module)
 Takes a module owned by the caller and deletes it. More...
 
MlirOperation mlirModuleGetOperation (MlirModule module)
 Views the module as a generic operation. More...
 
MlirModule mlirModuleFromOperation (MlirOperation op)
 Views the generic operation as a module. More...
 
MlirOperationState mlirOperationStateGet (MlirStringRef name, MlirLocation loc)
 Constructs an operation state from a name and a location. More...
 
void mlirOperationStateAddResults (MlirOperationState *state, intptr_t n, MlirType const *results)
 Adds a list of components to the operation state. More...
 
void mlirOperationStateAddOperands (MlirOperationState *state, intptr_t n, MlirValue const *operands)
 
void mlirOperationStateAddOwnedRegions (MlirOperationState *state, intptr_t n, MlirRegion const *regions)
 
void mlirOperationStateAddSuccessors (MlirOperationState *state, intptr_t n, MlirBlock const *successors)
 
void mlirOperationStateAddAttributes (MlirOperationState *state, intptr_t n, MlirNamedAttribute const *attributes)
 
void mlirOperationStateEnableResultTypeInference (MlirOperationState *state)
 Enables result type inference for the operation under construction. More...
 
static LogicalResult inferOperationTypes (OperationState &state)
 
MlirOperation mlirOperationCreate (MlirOperationState *state)
 Creates an operation and transfers ownership to the caller. More...
 
MlirOperation mlirOperationCreateParse (MlirContext context, MlirStringRef sourceStr, MlirStringRef sourceName)
 Parses an operation, giving ownership to the caller. More...
 
MlirOperation mlirOperationClone (MlirOperation op)
 Creates a deep copy of an operation. More...
 
void mlirOperationDestroy (MlirOperation op)
 Takes an operation owned by the caller and destroys it. More...
 
void mlirOperationRemoveFromParent (MlirOperation op)
 Removes the given operation from its parent block. More...
 
bool mlirOperationEqual (MlirOperation op, MlirOperation other)
 Checks whether two operation handles point to the same operation. More...
 
MlirContext mlirOperationGetContext (MlirOperation op)
 Gets the context this operation is associated with. More...
 
MlirLocation mlirOperationGetLocation (MlirOperation op)
 Gets the location of the operation. More...
 
MlirTypeID mlirOperationGetTypeID (MlirOperation op)
 Gets the type id of the operation. More...
 
MlirIdentifier mlirOperationGetName (MlirOperation op)
 Gets the name of the operation as an identifier. More...
 
MlirBlock mlirOperationGetBlock (MlirOperation op)
 Gets the block that owns this operation, returning null if the operation is not owned. More...
 
MlirOperation mlirOperationGetParentOperation (MlirOperation op)
 Gets the operation that owns this operation, returning null if the operation is not owned. More...
 
intptr_t mlirOperationGetNumRegions (MlirOperation op)
 Returns the number of regions attached to the given operation. More...
 
MlirRegion mlirOperationGetRegion (MlirOperation op, intptr_t pos)
 Returns pos-th region attached to the operation. More...
 
MlirRegion mlirOperationGetFirstRegion (MlirOperation op)
 Returns first region attached to the operation. More...
 
MlirRegion mlirRegionGetNextInOperation (MlirRegion region)
 Returns the region immediately following the given region in its parent operation. More...
 
MlirOperation mlirOperationGetNextInBlock (MlirOperation op)
 Returns an operation immediately following the given operation it its enclosing block. More...
 
intptr_t mlirOperationGetNumOperands (MlirOperation op)
 Returns the number of operands of the operation. More...
 
MlirValue mlirOperationGetOperand (MlirOperation op, intptr_t pos)
 Returns pos-th operand of the operation. More...
 
void mlirOperationSetOperand (MlirOperation op, intptr_t pos, MlirValue newValue)
 Sets the pos-th operand of the operation. More...
 
void mlirOperationSetOperands (MlirOperation op, intptr_t nOperands, MlirValue const *operands)
 Replaces the operands of the operation. More...
 
intptr_t mlirOperationGetNumResults (MlirOperation op)
 Returns the number of results of the operation. More...
 
MlirValue mlirOperationGetResult (MlirOperation op, intptr_t pos)
 Returns pos-th result of the operation. More...
 
intptr_t mlirOperationGetNumSuccessors (MlirOperation op)
 Returns the number of successor blocks of the operation. More...
 
MlirBlock mlirOperationGetSuccessor (MlirOperation op, intptr_t pos)
 Returns pos-th successor of the operation. More...
 
MLIR_CAPI_EXPORTED bool mlirOperationHasInherentAttributeByName (MlirOperation op, MlirStringRef name)
 Returns true if this operation defines an inherent attribute with this name. More...
 
MlirAttribute mlirOperationGetInherentAttributeByName (MlirOperation op, MlirStringRef name)
 Returns an inherent attribute attached to the operation given its name. More...
 
void mlirOperationSetInherentAttributeByName (MlirOperation op, MlirStringRef name, MlirAttribute attr)
 Sets an inherent attribute by name, replacing the existing if it exists. More...
 
intptr_t mlirOperationGetNumDiscardableAttributes (MlirOperation op)
 Returns the number of discardable attributes attached to the operation. More...
 
MlirNamedAttribute mlirOperationGetDiscardableAttribute (MlirOperation op, intptr_t pos)
 Return pos-th discardable attribute of the operation. More...
 
MlirAttribute mlirOperationGetDiscardableAttributeByName (MlirOperation op, MlirStringRef name)
 Returns a discardable attribute attached to the operation given its name. More...
 
void mlirOperationSetDiscardableAttributeByName (MlirOperation op, MlirStringRef name, MlirAttribute attr)
 Sets a discardable attribute by name, replacing the existing if it exists or adding a new one otherwise. More...
 
bool mlirOperationRemoveDiscardableAttributeByName (MlirOperation op, MlirStringRef name)
 Removes a discardable attribute by name. More...
 
void mlirOperationSetSuccessor (MlirOperation op, intptr_t pos, MlirBlock block)
 Set pos-th successor of the operation. More...
 
intptr_t mlirOperationGetNumAttributes (MlirOperation op)
 Returns the number of attributes attached to the operation. More...
 
MlirNamedAttribute mlirOperationGetAttribute (MlirOperation op, intptr_t pos)
 Return pos-th attribute of the operation. More...
 
MlirAttribute mlirOperationGetAttributeByName (MlirOperation op, MlirStringRef name)
 Returns an attribute attached to the operation given its name. More...
 
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...
 
bool mlirOperationRemoveAttributeByName (MlirOperation op, MlirStringRef name)
 Removes an attribute by name. More...
 
void mlirOperationPrint (MlirOperation op, MlirStringCallback callback, void *userData)
 Prints an operation by sending chunks of the string representation and forwarding userData tocallback`. More...
 
void mlirOperationPrintWithFlags (MlirOperation op, MlirOpPrintingFlags flags, MlirStringCallback callback, void *userData)
 Same as mlirOperationPrint but accepts flags controlling the printing behavior. More...
 
void mlirOperationPrintWithState (MlirOperation op, MlirAsmState state, MlirStringCallback callback, void *userData)
 Same as mlirOperationPrint but accepts AsmState controlling the printing behavior as well as caching computed names. More...
 
void mlirOperationWriteBytecode (MlirOperation op, MlirStringCallback callback, void *userData)
 Same as mlirOperationPrint but writing the bytecode format. More...
 
MlirLogicalResult mlirOperationWriteBytecodeWithConfig (MlirOperation op, MlirBytecodeWriterConfig config, MlirStringCallback callback, void *userData)
 Same as mlirOperationWriteBytecode but with writer config and returns failure only if desired bytecode could not be honored. More...
 
void mlirOperationDump (MlirOperation op)
 Prints an operation to stderr. More...
 
bool mlirOperationVerify (MlirOperation op)
 Verify the operation and return true if it passes, false if it fails. More...
 
void mlirOperationMoveAfter (MlirOperation op, MlirOperation other)
 Moves the given operation immediately after the other operation in its parent block. More...
 
void mlirOperationMoveBefore (MlirOperation op, MlirOperation other)
 Moves the given operation immediately before the other operation in its parent block. More...
 
void mlirOperationWalk (MlirOperation op, MlirOperationWalkCallback callback, void *userData, MlirWalkOrder walkOrder)
 Walks operation op in walkOrder and calls callback on that operation. More...
 
MlirRegion mlirRegionCreate ()
 Creates a new empty region and transfers ownership to the caller. More...
 
bool mlirRegionEqual (MlirRegion region, MlirRegion other)
 Checks whether two region handles point to the same region. More...
 
MlirBlock mlirRegionGetFirstBlock (MlirRegion region)
 Gets the first block in the region. More...
 
void mlirRegionAppendOwnedBlock (MlirRegion region, MlirBlock block)
 Takes a block owned by the caller and appends it to the given region. More...
 
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...
 
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...
 
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...
 
void mlirRegionDestroy (MlirRegion region)
 Takes a region owned by the caller and destroys it. More...
 
void mlirRegionTakeBody (MlirRegion target, MlirRegion source)
 Moves the entire content of the source region to the target region. More...
 
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...
 
bool mlirBlockEqual (MlirBlock block, MlirBlock other)
 Checks whether two blocks handles point to the same block. More...
 
MlirOperation mlirBlockGetParentOperation (MlirBlock block)
 Returns the closest surrounding operation that contains this block. More...
 
MlirRegion mlirBlockGetParentRegion (MlirBlock block)
 Returns the region that contains this block. More...
 
MlirBlock mlirBlockGetNextInRegion (MlirBlock block)
 Returns the block immediately following the given block in its parent region. More...
 
MlirOperation mlirBlockGetFirstOperation (MlirBlock block)
 Returns the first operation in the block. More...
 
MlirOperation mlirBlockGetTerminator (MlirBlock block)
 Returns the terminator operation in the block or null if no terminator. More...
 
void mlirBlockAppendOwnedOperation (MlirBlock block, MlirOperation operation)
 Takes an operation owned by the caller and appends it to the block. More...
 
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...
 
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...
 
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...
 
void mlirBlockDestroy (MlirBlock block)
 Takes a block owned by the caller and destroys it. More...
 
void mlirBlockDetach (MlirBlock block)
 Detach a block from the owning region and assume ownership. More...
 
intptr_t mlirBlockGetNumArguments (MlirBlock block)
 Returns the number of arguments of the block. More...
 
MlirValue mlirBlockAddArgument (MlirBlock block, MlirType type, MlirLocation loc)
 Appends an argument of the specified type to the block. More...
 
MlirValue mlirBlockInsertArgument (MlirBlock block, intptr_t pos, MlirType type, MlirLocation loc)
 Inserts an argument of the specified type at a specified index to the block. More...
 
MlirValue mlirBlockGetArgument (MlirBlock block, intptr_t pos)
 Returns pos-th argument of the block. More...
 
void mlirBlockPrint (MlirBlock block, MlirStringCallback callback, void *userData)
 Prints a block by sending chunks of the string representation and forwarding userData tocallback`. More...
 
bool mlirValueEqual (MlirValue value1, MlirValue value2)
 Returns 1 if two values are equal, 0 otherwise. More...
 
bool mlirValueIsABlockArgument (MlirValue value)
 Returns 1 if the value is a block argument, 0 otherwise. More...
 
bool mlirValueIsAOpResult (MlirValue value)
 Returns 1 if the value is an operation result, 0 otherwise. More...
 
MlirBlock mlirBlockArgumentGetOwner (MlirValue value)
 Returns the block in which this value is defined as an argument. More...
 
intptr_t mlirBlockArgumentGetArgNumber (MlirValue value)
 Returns the position of the value in the argument list of its block. More...
 
void mlirBlockArgumentSetType (MlirValue value, MlirType type)
 Sets the type of the block argument to the given type. More...
 
MlirOperation mlirOpResultGetOwner (MlirValue value)
 Returns an operation that produced this value as its result. More...
 
intptr_t mlirOpResultGetResultNumber (MlirValue value)
 Returns the position of the value in the list of results of the operation that produced it. More...
 
MlirType mlirValueGetType (MlirValue value)
 Returns the type of the value. More...
 
void mlirValueSetType (MlirValue value, MlirType type)
 Set the type of the value. More...
 
void mlirValueDump (MlirValue value)
 Prints the value to the standard error stream. More...
 
void mlirValuePrint (MlirValue value, MlirStringCallback callback, void *userData)
 Prints a value by sending chunks of the string representation and forwarding userData tocallback`. More...
 
void mlirValuePrintAsOperand (MlirValue value, MlirAsmState state, MlirStringCallback callback, void *userData)
 Prints a value as an operand (i.e., the ValueID). More...
 
MlirOpOperand mlirValueGetFirstUse (MlirValue value)
 Returns an op operand representing the first use of the value, or a null op operand if there are no uses. More...
 
void mlirValueReplaceAllUsesOfWith (MlirValue oldValue, MlirValue newValue)
 Replace all uses of 'of' value with the 'with' value, updating anything in the IR that uses 'of' to use the other value instead. More...
 
bool mlirOpOperandIsNull (MlirOpOperand opOperand)
 Returns whether the op operand is null. More...
 
MlirOperation mlirOpOperandGetOwner (MlirOpOperand opOperand)
 Returns the owner operation of an op operand. More...
 
unsigned mlirOpOperandGetOperandNumber (MlirOpOperand opOperand)
 Returns the operand number of an op operand. More...
 
MlirOpOperand mlirOpOperandGetNextUse (MlirOpOperand opOperand)
 Returns an op operand representing the next use of the value, or a null op operand if there is no next use. More...
 
MlirType mlirTypeParseGet (MlirContext context, MlirStringRef type)
 Parses a type. The type is owned by the context. More...
 
MlirContext mlirTypeGetContext (MlirType type)
 Gets the context that a type was created with. More...
 
MlirTypeID mlirTypeGetTypeID (MlirType type)
 Gets the type ID of the type. More...
 
MlirDialect mlirTypeGetDialect (MlirType type)
 Gets the dialect a type belongs to. More...
 
bool mlirTypeEqual (MlirType t1, MlirType t2)
 Checks if two types are equal. More...
 
void mlirTypePrint (MlirType type, MlirStringCallback callback, void *userData)
 Prints a location by sending chunks of the string representation and forwarding userData tocallback`. More...
 
void mlirTypeDump (MlirType type)
 Prints the type to the standard error stream. More...
 
MlirAttribute mlirAttributeParseGet (MlirContext context, MlirStringRef attr)
 Parses an attribute. The attribute is owned by the context. More...
 
MlirContext mlirAttributeGetContext (MlirAttribute attribute)
 Gets the context that an attribute was created with. More...
 
MlirType mlirAttributeGetType (MlirAttribute attribute)
 Gets the type of this attribute. More...
 
MlirTypeID mlirAttributeGetTypeID (MlirAttribute attr)
 Gets the type id of the attribute. More...
 
MlirDialect mlirAttributeGetDialect (MlirAttribute attr)
 Gets the dialect of the attribute. More...
 
bool mlirAttributeEqual (MlirAttribute a1, MlirAttribute a2)
 Checks if two attributes are equal. More...
 
void mlirAttributePrint (MlirAttribute attr, MlirStringCallback callback, void *userData)
 Prints an attribute by sending chunks of the string representation and forwarding userData tocallback`. More...
 
void mlirAttributeDump (MlirAttribute attr)
 Prints the attribute to the standard error stream. More...
 
MlirNamedAttribute mlirNamedAttributeGet (MlirIdentifier name, MlirAttribute attr)
 Associates an attribute with the name. Takes ownership of neither. More...
 
MlirIdentifier mlirIdentifierGet (MlirContext context, MlirStringRef str)
 Gets an identifier with the given string value. More...
 
MlirContext mlirIdentifierGetContext (MlirIdentifier ident)
 Returns the context associated with this identifier. More...
 
bool mlirIdentifierEqual (MlirIdentifier ident, MlirIdentifier other)
 Checks whether two identifiers are the same. More...
 
MlirStringRef mlirIdentifierStr (MlirIdentifier ident)
 Gets the string value of the identifier. More...
 
MlirStringRef mlirSymbolTableGetSymbolAttributeName ()
 Returns the name of the attribute used to store symbol names compatible with symbol tables. More...
 
MlirStringRef mlirSymbolTableGetVisibilityAttributeName ()
 Returns the name of the attribute used to store symbol visibility. More...
 
MlirSymbolTable mlirSymbolTableCreate (MlirOperation operation)
 Creates a symbol table for the given operation. More...
 
void mlirSymbolTableDestroy (MlirSymbolTable symbolTable)
 Destroys the symbol table created with mlirSymbolTableCreate. More...
 
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...
 
MlirAttribute mlirSymbolTableInsert (MlirSymbolTable symbolTable, MlirOperation operation)
 Inserts the given operation into the given symbol table. More...
 
void mlirSymbolTableErase (MlirSymbolTable symbolTable, MlirOperation operation)
 Removes the given operation from the symbol table and erases it. More...
 
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...
 
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

◆ APPEND_ELEMS

#define APPEND_ELEMS (   type,
  sizeName,
  elemName 
)
Value:
state->elemName = \
(type *)realloc(state->elemName, (state->sizeName + n) * sizeof(type)); \
memcpy(state->elemName + state->sizeName, elemName, n * sizeof(type)); \
state->sizeName += n;

Definition at line 356 of file IR.cpp.

Function Documentation

◆ findParent()

static Operation* findParent ( Operation op,
bool  shouldUseLocalScope 
)
static

Definition at line 151 of file IR.cpp.

◆ inferOperationTypes()

static LogicalResult inferOperationTypes ( OperationState state)
static

Definition at line 392 of file IR.cpp.

◆ mlirAsmStateCreateForOperation()

MlirAsmState mlirAsmStateCreateForOperation ( MlirOperation  op,
MlirOpPrintingFlags  flags 
)

Creates new AsmState, as with AsmState the IR should not be mutated in-between using this state.

Must be freed with a call to mlirAsmStateDestroy().

Definition at line 146 of file IR.cpp.

Referenced by mlir::python::PyAsmState::PyAsmState().

◆ mlirAsmStateCreateForValue()

MlirAsmState mlirAsmStateCreateForValue ( MlirValue  value,
MlirOpPrintingFlags  flags 
)

Creates new AsmState from value.

Must be freed with a call to mlirAsmStateDestroy().

Definition at line 167 of file IR.cpp.

Referenced by mlir::python::PyAsmState::PyAsmState().

◆ mlirAsmStateDestroy()

void mlirAsmStateDestroy ( MlirAsmState  state)

Destroys printing flags created with mlirAsmStateCreate.

Definition at line 185 of file IR.cpp.

◆ mlirAttributeDump()

void mlirAttributeDump ( MlirAttribute  attr)

Prints the attribute to the standard error stream.

Definition at line 1074 of file IR.cpp.

References unwrap().

◆ mlirAttributeEqual()

bool mlirAttributeEqual ( MlirAttribute  a1,
MlirAttribute  a2 
)

Checks if two attributes are equal.

Definition at line 1064 of file IR.cpp.

References unwrap().

Referenced by mlir::python::PyAttribute::operator==().

◆ mlirAttributeGetContext()

MlirContext mlirAttributeGetContext ( MlirAttribute  attribute)

Gets the context that an attribute was created with.

Definition at line 1045 of file IR.cpp.

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

Referenced by mlir::python::PyAttribute::createFromCapsule(), and mlir::python::PyNamedAttribute::PyNamedAttribute().

◆ mlirAttributeGetDialect()

MlirDialect mlirAttributeGetDialect ( MlirAttribute  attr)

Gets the dialect of the attribute.

Definition at line 1060 of file IR.cpp.

References unwrap(), and wrap().

◆ mlirAttributeGetType()

MlirType mlirAttributeGetType ( MlirAttribute  attribute)

Gets the type of this attribute.

Definition at line 1049 of file IR.cpp.

References mlir::get(), mlir::Attribute::getContext(), unwrap(), and wrap().

Referenced by mlir::python::PyConcreteAttribute< DerivedTy, BaseTy >::bind().

◆ mlirAttributeGetTypeID()

MlirTypeID mlirAttributeGetTypeID ( MlirAttribute  attr)

Gets the type id of the attribute.

Definition at line 1056 of file IR.cpp.

References unwrap(), and wrap().

◆ mlirAttributeParseGet()

MlirAttribute mlirAttributeParseGet ( MlirContext  context,
MlirStringRef  attr 
)

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

Definition at line 1041 of file IR.cpp.

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

◆ mlirAttributePrint()

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 1068 of file IR.cpp.

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

Referenced by mlir::python::PyConcreteAttribute< DerivedTy, BaseTy >::bind().

◆ mlirBlockAddArgument()

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 884 of file IR.cpp.

References unwrap(), and wrap().

◆ mlirBlockAppendOwnedOperation()

void mlirBlockAppendOwnedOperation ( MlirBlock  block,
MlirOperation  operation 
)

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

Definition at line 836 of file IR.cpp.

References unwrap().

Referenced by mlirBlockInsertOwnedOperationBefore().

◆ mlirBlockArgumentGetArgNumber()

intptr_t mlirBlockArgumentGetArgNumber ( MlirValue  value)

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

Definition at line 924 of file IR.cpp.

References unwrap().

◆ mlirBlockArgumentGetOwner()

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 920 of file IR.cpp.

References unwrap(), and wrap().

Referenced by mlir::python::PyValue::createFromCapsule().

◆ mlirBlockArgumentSetType()

void mlirBlockArgumentSetType ( MlirValue  value,
MlirType  type 
)

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

Definition at line 929 of file IR.cpp.

References unwrap().

◆ mlirBlockCreate()

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 795 of file IR.cpp.

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

Referenced by createBlock().

◆ mlirBlockDestroy()

void mlirBlockDestroy ( MlirBlock  block)

Takes a block owned by the caller and destroys it.

Definition at line 873 of file IR.cpp.

References unwrap().

◆ mlirBlockDetach()

void mlirBlockDetach ( MlirBlock  block)

Detach a block from the owning region and assume ownership.

Definition at line 875 of file IR.cpp.

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

◆ mlirBlockEqual()

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 803 of file IR.cpp.

References unwrap().

◆ mlirBlockGetArgument()

MlirValue mlirBlockGetArgument ( MlirBlock  block,
intptr_t  pos 
)

Returns pos-th argument of the block.

Definition at line 894 of file IR.cpp.

References unwrap(), and wrap().

◆ mlirBlockGetFirstOperation()

MlirOperation mlirBlockGetFirstOperation ( MlirBlock  block)

Returns the first operation in the block.

Definition at line 819 of file IR.cpp.

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

Referenced by mlir::python::PyInsertionPoint::atBlockBegin().

◆ mlirBlockGetNextInRegion()

MlirBlock mlirBlockGetNextInRegion ( MlirBlock  block)

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

Definition at line 815 of file IR.cpp.

References unwrap(), and wrap().

◆ mlirBlockGetNumArguments()

intptr_t mlirBlockGetNumArguments ( MlirBlock  block)

Returns the number of arguments of the block.

Definition at line 880 of file IR.cpp.

References unwrap().

◆ mlirBlockGetParentOperation()

MlirOperation mlirBlockGetParentOperation ( MlirBlock  block)

Returns the closest surrounding operation that contains this block.

Definition at line 807 of file IR.cpp.

References unwrap(), and wrap().

Referenced by mlir::python::PyValue::createFromCapsule().

◆ mlirBlockGetParentRegion()

MlirRegion mlirBlockGetParentRegion ( MlirBlock  block)

Returns the region that contains this block.

Definition at line 811 of file IR.cpp.

References unwrap(), and wrap().

◆ mlirBlockGetTerminator()

MlirOperation mlirBlockGetTerminator ( MlirBlock  block)

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

Definition at line 826 of file IR.cpp.

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

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

◆ mlirBlockInsertArgument()

MlirValue mlirBlockInsertArgument ( MlirBlock  block,
intptr_t  pos,
MlirType  type,
MlirLocation  loc 
)

Inserts an argument of the specified type at a specified index to the block.

Returns the newly added argument.

Definition at line 889 of file IR.cpp.

References unwrap(), and wrap().

◆ mlirBlockInsertOwnedOperation()

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 840 of file IR.cpp.

References unwrap().

◆ mlirBlockInsertOwnedOperationAfter()

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 846 of file IR.cpp.

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

◆ mlirBlockInsertOwnedOperationBefore()

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 861 of file IR.cpp.

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

Referenced by mlir::python::PyInsertionPoint::insert().

◆ mlirBlockPrint()

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 898 of file IR.cpp.

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

◆ mlirBytecodeWriterConfigCreate()

MlirBytecodeWriterConfig mlirBytecodeWriterConfigCreate ( void  )

Creates new printing flags with defaults, intended for customization.

Must be freed with a call to mlirBytecodeWriterConfigDestroy().

Definition at line 225 of file IR.cpp.

References wrap().

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

◆ mlirBytecodeWriterConfigDesiredEmitVersion()

void mlirBytecodeWriterConfigDesiredEmitVersion ( MlirBytecodeWriterConfig  flags,
int64_t  version 
)

Sets the version to emit in the writer config.

Definition at line 233 of file IR.cpp.

References unwrap().

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

◆ mlirBytecodeWriterConfigDestroy()

void mlirBytecodeWriterConfigDestroy ( MlirBytecodeWriterConfig  config)

Destroys printing flags created with mlirBytecodeWriterConfigCreate.

Definition at line 229 of file IR.cpp.

References unwrap().

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

◆ mlirContextAppendDialectRegistry()

void mlirContextAppendDialectRegistry ( MlirContext  ctx,
MlirDialectRegistry  registry 
)

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

Definition at line 81 of file IR.cpp.

References unwrap().

◆ mlirContextCreate()

MlirContext mlirContextCreate ( void  )

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

This sets the default multithreading option (enabled).

Definition at line 42 of file IR.cpp.

References wrap().

◆ mlirContextCreateWithRegistry()

MlirContext mlirContextCreateWithRegistry ( MlirDialectRegistry  registry,
bool  threadingEnabled 
)

Creates an MLIR context, setting the multithreading setting explicitly and pre-loading the dialects from the provided DialectRegistry.

Definition at line 57 of file IR.cpp.

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

◆ mlirContextCreateWithThreading()

MlirContext mlirContextCreateWithThreading ( bool  threadingEnabled)

Creates an MLIR context with an explicit setting of the multithreading setting and transfers its ownership to the caller.

Definition at line 52 of file IR.cpp.

References toThreadingEnum(), and wrap().

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

◆ mlirContextDestroy()

void mlirContextDestroy ( MlirContext  context)

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

Definition at line 68 of file IR.cpp.

References unwrap().

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

◆ mlirContextEnableMultithreading()

void mlirContextEnableMultithreading ( MlirContext  context,
bool  enable 
)

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

Definition at line 101 of file IR.cpp.

References unwrap().

◆ mlirContextEqual()

bool mlirContextEqual ( MlirContext  ctx1,
MlirContext  ctx2 
)

Checks if two contexts are equal.

Definition at line 64 of file IR.cpp.

References unwrap().

◆ mlirContextGetAllowUnregisteredDialects()

bool mlirContextGetAllowUnregisteredDialects ( MlirContext  context)

Returns whether the context allows unregistered dialects.

Definition at line 74 of file IR.cpp.

References unwrap().

◆ mlirContextGetNumLoadedDialects()

intptr_t mlirContextGetNumLoadedDialects ( MlirContext  context)

Returns the number of dialects loaded by the context.

Definition at line 88 of file IR.cpp.

References unwrap().

◆ mlirContextGetNumRegisteredDialects()

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 77 of file IR.cpp.

References unwrap().

◆ mlirContextGetOrLoadDialect()

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 92 of file IR.cpp.

References unwrap(), and wrap().

Referenced by mlir::python::PyDialects::getDialectForKey().

◆ mlirContextIsRegisteredOperation()

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 97 of file IR.cpp.

References unwrap().

◆ mlirContextLoadAllAvailableDialects()

void mlirContextLoadAllAvailableDialects ( MlirContext  context)

Eagerly loads all available dialects registered with a context, making them available for use for IR construction.

Definition at line 105 of file IR.cpp.

References unwrap().

◆ mlirContextSetAllowUnregisteredDialects()

void mlirContextSetAllowUnregisteredDialects ( MlirContext  context,
bool  allow 
)

Sets whether unregistered dialects are allowed in this context.

Definition at line 70 of file IR.cpp.

References unwrap().

◆ mlirContextSetThreadPool()

void mlirContextSetThreadPool ( MlirContext  context,
MlirLlvmThreadPool  threadPool 
)

Sets the thread pool of the context explicitly, enabling multithreading in the process.

This API should be used to avoid re-creating thread pools in long-running applications that perform multiple compilations, see the C++ documentation for MLIRContext for details.

Definition at line 109 of file IR.cpp.

◆ mlirDialectEqual()

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 122 of file IR.cpp.

References unwrap().

◆ mlirDialectGetContext()

MlirContext mlirDialectGetContext ( MlirDialect  dialect)

Returns the context that owns the dialect.

Definition at line 118 of file IR.cpp.

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

◆ mlirDialectGetNamespace()

MlirStringRef mlirDialectGetNamespace ( MlirDialect  dialect)

Returns the namespace of the given dialect.

Definition at line 126 of file IR.cpp.

References unwrap(), and wrap().

Referenced by mlir::python::PyGlobals::lookupTypeCaster(), and mlir::python::PyGlobals::lookupValueCaster().

◆ mlirDialectRegistryCreate()

MlirDialectRegistry mlirDialectRegistryCreate ( void  )

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

Definition at line 134 of file IR.cpp.

References wrap().

◆ mlirDialectRegistryDestroy()

void mlirDialectRegistryDestroy ( MlirDialectRegistry  registry)

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

Definition at line 138 of file IR.cpp.

References unwrap().

Referenced by mlir::python::PyDialectRegistry::~PyDialectRegistry().

◆ mlirIdentifierEqual()

bool mlirIdentifierEqual ( MlirIdentifier  ident,
MlirIdentifier  other 
)

Checks whether two identifiers are the same.

Definition at line 1093 of file IR.cpp.

References unwrap().

◆ mlirIdentifierGet()

MlirIdentifier mlirIdentifierGet ( MlirContext  context,
MlirStringRef  str 
)

Gets an identifier with the given string value.

Definition at line 1085 of file IR.cpp.

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

Referenced by mlir::python::PyNamedAttribute::PyNamedAttribute().

◆ mlirIdentifierGetContext()

MlirContext mlirIdentifierGetContext ( MlirIdentifier  ident)

Returns the context associated with this identifier.

Definition at line 1089 of file IR.cpp.

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

◆ mlirIdentifierStr()

MlirStringRef mlirIdentifierStr ( MlirIdentifier  ident)

Gets the string value of the identifier.

Definition at line 1097 of file IR.cpp.

References unwrap(), and wrap().

Referenced by mlir::python::PyOperation::createOpView(), and mlir::python::PyConcreteOpInterface< ConcreteIface >::PyConcreteOpInterface().

◆ mlirLocationCallSiteGet()

MlirLocation mlirLocationCallSiteGet ( MlirLocation  callee,
MlirLocation  caller 
)

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

Definition at line 257 of file IR.cpp.

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

◆ mlirLocationEqual()

bool mlirLocationEqual ( MlirLocation  l1,
MlirLocation  l2 
)

Checks if two locations are equal.

Definition at line 282 of file IR.cpp.

References unwrap().

◆ mlirLocationFileLineColGet()

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

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

Definition at line 250 of file IR.cpp.

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

◆ mlirLocationFromAttribute()

MlirLocation mlirLocationFromAttribute ( MlirAttribute  attribute)

Creates a location from a location attribute.

Definition at line 246 of file IR.cpp.

References unwrap(), and wrap().

◆ mlirLocationFusedGet()

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 261 of file IR.cpp.

References mlir::get(), unwrap(), unwrapList(), and wrap().

◆ mlirLocationGetAttribute()

MlirAttribute mlirLocationGetAttribute ( MlirLocation  location)

Returns the underlying location attribute of this location.

Definition at line 242 of file IR.cpp.

References unwrap(), and wrap().

◆ mlirLocationGetContext()

MlirContext mlirLocationGetContext ( MlirLocation  location)

Gets the context that a location was created with.

Definition at line 286 of file IR.cpp.

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

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

◆ mlirLocationNameGet()

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 269 of file IR.cpp.

References mlir::get(), mlirLocationIsNull(), unwrap(), and wrap().

◆ mlirLocationPrint()

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 290 of file IR.cpp.

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

◆ mlirLocationUnknownGet()

MlirLocation mlirLocationUnknownGet ( MlirContext  context)

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

Definition at line 278 of file IR.cpp.

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

◆ mlirModuleCreateEmpty()

MlirModule mlirModuleCreateEmpty ( MlirLocation  location)

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

Definition at line 300 of file IR.cpp.

References unwrap(), and wrap().

◆ mlirModuleCreateParse()

MlirModule mlirModuleCreateParse ( MlirContext  context,
MlirStringRef  module 
)

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

Definition at line 304 of file IR.cpp.

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

◆ mlirModuleDestroy()

void mlirModuleDestroy ( MlirModule  module)

Takes a module owned by the caller and deletes it.

Definition at line 320 of file IR.cpp.

References unwrap().

Referenced by mlir::python::PyModule::~PyModule().

◆ mlirModuleFromOperation()

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 330 of file IR.cpp.

◆ mlirModuleGetBody()

MlirBlock mlirModuleGetBody ( MlirModule  module)

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

Definition at line 316 of file IR.cpp.

References unwrap(), and wrap().

◆ mlirModuleGetContext()

MlirContext mlirModuleGetContext ( MlirModule  module)

Gets the context that a module was created with.

Definition at line 312 of file IR.cpp.

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

Referenced by mlir::python::PyModule::forModule().

◆ mlirModuleGetOperation()

MlirOperation mlirModuleGetOperation ( MlirModule  module)

Views the module as a generic operation.

Definition at line 326 of file IR.cpp.

References unwrap(), and wrap().

◆ mlirNamedAttributeGet()

MlirNamedAttribute mlirNamedAttributeGet ( MlirIdentifier  name,
MlirAttribute  attr 
)

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

Definition at line 1076 of file IR.cpp.

Referenced by mlir::python::PyNamedAttribute::PyNamedAttribute().

◆ mlirOperationClone()

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 493 of file IR.cpp.

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

◆ mlirOperationCreate()

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 447 of file IR.cpp.

◆ mlirOperationCreateParse()

MlirOperation mlirOperationCreateParse ( MlirContext  context,
MlirStringRef  sourceStr,
MlirStringRef  sourceName 
)

Parses an operation, giving ownership to the caller.

If parsing fails a null operation will be returned, and an error diagnostic emitted.

sourceStr may be either the text assembly format, or binary bytecode format. sourceName is used as the file name of the source; any IR without locations will get a FileLineColLoc location with sourceName as the file name.

Definition at line 484 of file IR.cpp.

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

◆ mlirOperationDestroy()

void mlirOperationDestroy ( MlirOperation  op)

Takes an operation owned by the caller and destroys it.

Definition at line 497 of file IR.cpp.

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

◆ mlirOperationDump()

void mlirOperationDump ( MlirOperation  op)

Prints an operation to stderr.

Definition at line 703 of file IR.cpp.

◆ mlirOperationEqual()

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 501 of file IR.cpp.

◆ mlirOperationGetAttribute()

MlirNamedAttribute mlirOperationGetAttribute ( MlirOperation  op,
intptr_t  pos 
)

Return pos-th attribute of the operation.

Deprecated, please use mlirOperationGetInherentAttribute or mlirOperationGetDiscardableAttribute.

Definition at line 650 of file IR.cpp.

◆ mlirOperationGetAttributeByName()

MlirAttribute mlirOperationGetAttributeByName ( MlirOperation  op,
MlirStringRef  name 
)

Returns an attribute attached to the operation given its name.

Deprecated, please use mlirOperationGetInherentAttributeByName or mlirOperationGetDiscardableAttributeByName.

Definition at line 655 of file IR.cpp.

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

◆ mlirOperationGetBlock()

MlirBlock mlirOperationGetBlock ( MlirOperation  op)

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

Definition at line 523 of file IR.cpp.

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

◆ mlirOperationGetContext()

MlirContext mlirOperationGetContext ( MlirOperation  op)

Gets the context this operation is associated with.

Definition at line 505 of file IR.cpp.

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

◆ mlirOperationGetDiscardableAttribute()

MlirNamedAttribute mlirOperationGetDiscardableAttribute ( MlirOperation  op,
intptr_t  pos 
)

Return pos-th discardable attribute of the operation.

Definition at line 619 of file IR.cpp.

◆ mlirOperationGetDiscardableAttributeByName()

MlirAttribute mlirOperationGetDiscardableAttributeByName ( MlirOperation  op,
MlirStringRef  name 
)

Returns a discardable attribute attached to the operation given its name.

Definition at line 625 of file IR.cpp.

◆ mlirOperationGetFirstRegion()

MlirRegion mlirOperationGetFirstRegion ( MlirOperation  op)

Returns first region attached to the operation.

Definition at line 539 of file IR.cpp.

◆ mlirOperationGetInherentAttributeByName()

MlirAttribute mlirOperationGetInherentAttributeByName ( MlirOperation  op,
MlirStringRef  name 
)

Returns an inherent attribute attached to the operation given its name.

Definition at line 600 of file IR.cpp.

◆ mlirOperationGetLocation()

MlirLocation mlirOperationGetLocation ( MlirOperation  op)

Gets the location of the operation.

Definition at line 509 of file IR.cpp.

◆ mlirOperationGetName()

MlirIdentifier mlirOperationGetName ( MlirOperation  op)

Gets the name of the operation as an identifier.

Definition at line 519 of file IR.cpp.

Referenced by mlir::python::PyOperation::createOpView(), and mlir::python::PyConcreteOpInterface< ConcreteIface >::PyConcreteOpInterface().

◆ mlirOperationGetNextInBlock()

MlirOperation mlirOperationGetNextInBlock ( MlirOperation  op)

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

Definition at line 555 of file IR.cpp.

◆ mlirOperationGetNumAttributes()

intptr_t mlirOperationGetNumAttributes ( MlirOperation  op)

Returns the number of attributes attached to the operation.

Deprecated, please use mlirOperationGetNumInherentAttributes or mlirOperationGetNumDiscardableAttributes.

Definition at line 646 of file IR.cpp.

◆ mlirOperationGetNumDiscardableAttributes()

intptr_t mlirOperationGetNumDiscardableAttributes ( MlirOperation  op)

Returns the number of discardable attributes attached to the operation.

Definition at line 615 of file IR.cpp.

◆ mlirOperationGetNumOperands()

intptr_t mlirOperationGetNumOperands ( MlirOperation  op)

Returns the number of operands of the operation.

Definition at line 559 of file IR.cpp.

◆ mlirOperationGetNumRegions()

intptr_t mlirOperationGetNumRegions ( MlirOperation  op)

Returns the number of regions attached to the given operation.

Definition at line 531 of file IR.cpp.

◆ mlirOperationGetNumResults()

intptr_t mlirOperationGetNumResults ( MlirOperation  op)

Returns the number of results of the operation.

Definition at line 578 of file IR.cpp.

◆ mlirOperationGetNumSuccessors()

intptr_t mlirOperationGetNumSuccessors ( MlirOperation  op)

Returns the number of successor blocks of the operation.

Definition at line 586 of file IR.cpp.

◆ mlirOperationGetOperand()

MlirValue mlirOperationGetOperand ( MlirOperation  op,
intptr_t  pos 
)

Returns pos-th operand of the operation.

Definition at line 563 of file IR.cpp.

◆ mlirOperationGetParentOperation()

MlirOperation mlirOperationGetParentOperation ( MlirOperation  op)

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

Definition at line 527 of file IR.cpp.

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

◆ mlirOperationGetRegion()

MlirRegion mlirOperationGetRegion ( MlirOperation  op,
intptr_t  pos 
)

Returns pos-th region attached to the operation.

Definition at line 535 of file IR.cpp.

◆ mlirOperationGetResult()

MlirValue mlirOperationGetResult ( MlirOperation  op,
intptr_t  pos 
)

Returns pos-th result of the operation.

Definition at line 582 of file IR.cpp.

◆ mlirOperationGetSuccessor()

MlirBlock mlirOperationGetSuccessor ( MlirOperation  op,
intptr_t  pos 
)

Returns pos-th successor of the operation.

Definition at line 590 of file IR.cpp.

◆ mlirOperationGetTypeID()

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 513 of file IR.cpp.

◆ mlirOperationHasInherentAttributeByName()

MLIR_CAPI_EXPORTED bool mlirOperationHasInherentAttributeByName ( MlirOperation  op,
MlirStringRef  name 
)

Returns true if this operation defines an inherent attribute with this name.

Note: the attribute can be optional, so mlirOperationGetInherentAttributeByName can still return a null attribute.

Definition at line 595 of file IR.cpp.

◆ mlirOperationMoveAfter()

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 709 of file IR.cpp.

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

◆ mlirOperationMoveBefore()

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 713 of file IR.cpp.

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

◆ mlirOperationPrint()

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 669 of file IR.cpp.

◆ mlirOperationPrintWithFlags()

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

Same as mlirOperationPrint but accepts flags controlling the printing behavior.

Definition at line 675 of file IR.cpp.

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

◆ mlirOperationPrintWithState()

void mlirOperationPrintWithState ( MlirOperation  op,
MlirAsmState  state,
MlirStringCallback  callback,
void *  userData 
)

Same as mlirOperationPrint but accepts AsmState controlling the printing behavior as well as caching computed names.

Definition at line 681 of file IR.cpp.

◆ mlirOperationRemoveAttributeByName()

bool mlirOperationRemoveAttributeByName ( MlirOperation  op,
MlirStringRef  name 
)

Removes an attribute by name.

Returns false if the attribute was not found and true if removed. Deprecated, please use mlirOperationRemoveInherentAttributeByName or mlirOperationRemoveDiscardableAttributeByName.

Definition at line 665 of file IR.cpp.

◆ mlirOperationRemoveDiscardableAttributeByName()

bool mlirOperationRemoveDiscardableAttributeByName ( MlirOperation  op,
MlirStringRef  name 
)

Removes a discardable attribute by name.

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

Definition at line 636 of file IR.cpp.

◆ mlirOperationRemoveFromParent()

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 499 of file IR.cpp.

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

◆ mlirOperationSetAttributeByName()

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.

Deprecated, please use mlirOperationSetInherentAttributeByName or mlirOperationSetDiscardableAttributeByName.

Definition at line 660 of file IR.cpp.

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

◆ mlirOperationSetDiscardableAttributeByName()

void mlirOperationSetDiscardableAttributeByName ( MlirOperation  op,
MlirStringRef  name,
MlirAttribute  attr 
)

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

The new attr Attribute is not allowed to be null, use mlirOperationRemoveDiscardableAttributeByName to remove an Attribute instead.

Definition at line 630 of file IR.cpp.

◆ mlirOperationSetInherentAttributeByName()

void mlirOperationSetInherentAttributeByName ( MlirOperation  op,
MlirStringRef  name,
MlirAttribute  attr 
)

Sets an inherent attribute by name, replacing the existing if it exists.

This has no effect if "name" does not match an inherent attribute.

Definition at line 608 of file IR.cpp.

◆ mlirOperationSetOperand()

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

Sets the pos-th operand of the operation.

Definition at line 567 of file IR.cpp.

◆ mlirOperationSetOperands()

void mlirOperationSetOperands ( MlirOperation  op,
intptr_t  nOperands,
MlirValue const *  operands 
)

Replaces the operands of the operation.

Definition at line 572 of file IR.cpp.

◆ mlirOperationSetSuccessor()

void mlirOperationSetSuccessor ( MlirOperation  op,
intptr_t  pos,
MlirBlock  block 
)

Set pos-th successor of the operation.

Definition at line 641 of file IR.cpp.

◆ mlirOperationStateAddAttributes()

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

Definition at line 379 of file IR.cpp.

◆ mlirOperationStateAddOperands()

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

Definition at line 367 of file IR.cpp.

◆ mlirOperationStateAddOwnedRegions()

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

Definition at line 371 of file IR.cpp.

◆ mlirOperationStateAddResults()

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

Adds a list of components to the operation state.

Definition at line 362 of file IR.cpp.

◆ mlirOperationStateAddSuccessors()

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

Definition at line 375 of file IR.cpp.

◆ mlirOperationStateEnableResultTypeInference()

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 384 of file IR.cpp.

◆ mlirOperationStateGet()

MlirOperationState mlirOperationStateGet ( MlirStringRef  name,
MlirLocation  loc 
)

Constructs an operation state from a name and a location.

Definition at line 338 of file IR.cpp.

◆ mlirOperationVerify()

bool mlirOperationVerify ( MlirOperation  op)

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

Definition at line 705 of file IR.cpp.

◆ mlirOperationWalk()

void mlirOperationWalk ( MlirOperation  op,
MlirOperationWalkCallback  callback,
void *  userData,
MlirWalkOrder  walkOrder 
)

Walks operation op in walkOrder and calls callback on that operation.

*userData is passed to the callback as well and can be used to tunnel some context or other data into the callback.

Definition at line 717 of file IR.cpp.

◆ mlirOperationWriteBytecode()

void mlirOperationWriteBytecode ( MlirOperation  op,
MlirStringCallback  callback,
void *  userData 
)

Same as mlirOperationPrint but writing the bytecode format.

Definition at line 689 of file IR.cpp.

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

◆ mlirOperationWriteBytecodeWithConfig()

MlirLogicalResult mlirOperationWriteBytecodeWithConfig ( MlirOperation  op,
MlirBytecodeWriterConfig  config,
MlirStringCallback  callback,
void *  userData 
)

Same as mlirOperationWriteBytecode but with writer config and returns failure only if desired bytecode could not be honored.

Definition at line 696 of file IR.cpp.

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

◆ mlirOpOperandGetNextUse()

MlirOpOperand mlirOpOperandGetNextUse ( MlirOpOperand  opOperand)

Returns an op operand representing the next use of the value, or a null op operand if there is no next use.

Definition at line 993 of file IR.cpp.

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

◆ mlirOpOperandGetOperandNumber()

unsigned mlirOpOperandGetOperandNumber ( MlirOpOperand  opOperand)

Returns the operand number of an op operand.

Definition at line 989 of file IR.cpp.

References unwrap().

◆ mlirOpOperandGetOwner()

MlirOperation mlirOpOperandGetOwner ( MlirOpOperand  opOperand)

Returns the owner operation of an op operand.

Definition at line 985 of file IR.cpp.

References unwrap(), and wrap().

◆ mlirOpOperandIsNull()

bool mlirOpOperandIsNull ( MlirOpOperand  opOperand)

Returns whether the op operand is null.

Definition at line 983 of file IR.cpp.

Referenced by mlirOpOperandGetNextUse().

◆ mlirOpPrintingFlagsAssumeVerified()

void mlirOpPrintingFlagsAssumeVerified ( MlirOpPrintingFlags  flags)

Do not verify the operation when using custom operation printers.

Definition at line 217 of file IR.cpp.

References unwrap().

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

◆ mlirOpPrintingFlagsCreate()

MlirOpPrintingFlags mlirOpPrintingFlagsCreate ( void  )

Creates new printing flags with defaults, intended for customization.

Must be freed with a call to mlirOpPrintingFlagsDestroy().

Definition at line 191 of file IR.cpp.

References wrap().

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

◆ mlirOpPrintingFlagsDestroy()

void mlirOpPrintingFlagsDestroy ( MlirOpPrintingFlags  flags)

Destroys printing flags created with mlirOpPrintingFlagsCreate.

Definition at line 195 of file IR.cpp.

References unwrap().

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

◆ mlirOpPrintingFlagsElideLargeElementsAttrs()

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 199 of file IR.cpp.

References unwrap().

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

◆ mlirOpPrintingFlagsEnableDebugInfo()

void mlirOpPrintingFlagsEnableDebugInfo ( MlirOpPrintingFlags  flags,
bool  enable,
bool  prettyForm 
)

Enable or disable printing of debug information (based on enable).

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 204 of file IR.cpp.

References unwrap().

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

◆ mlirOpPrintingFlagsPrintGenericOpForm()

void mlirOpPrintingFlagsPrintGenericOpForm ( MlirOpPrintingFlags  flags)

Always print operations in the generic form.

Definition at line 209 of file IR.cpp.

References unwrap().

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

◆ mlirOpPrintingFlagsUseLocalScope()

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 213 of file IR.cpp.

References unwrap().

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

◆ mlirOpResultGetOwner()

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 933 of file IR.cpp.

References unwrap(), and wrap().

Referenced by mlir::python::PyValue::createFromCapsule().

◆ mlirOpResultGetResultNumber()

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 937 of file IR.cpp.

References unwrap().

◆ mlirRegionAppendOwnedBlock()

void mlirRegionAppendOwnedBlock ( MlirRegion  region,
MlirBlock  block 
)

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

Definition at line 748 of file IR.cpp.

References unwrap().

Referenced by mlirRegionInsertOwnedBlockBefore().

◆ mlirRegionCreate()

MlirRegion mlirRegionCreate ( void  )

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

Definition at line 735 of file IR.cpp.

References wrap().

◆ mlirRegionDestroy()

void mlirRegionDestroy ( MlirRegion  region)

Takes a region owned by the caller and destroys it.

Definition at line 783 of file IR.cpp.

◆ mlirRegionEqual()

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 737 of file IR.cpp.

References unwrap().

◆ mlirRegionGetFirstBlock()

MlirBlock mlirRegionGetFirstBlock ( MlirRegion  region)

Gets the first block in the region.

Definition at line 741 of file IR.cpp.

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

◆ mlirRegionGetNextInOperation()

MlirRegion mlirRegionGetNextInOperation ( MlirRegion  region)

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

Definition at line 546 of file IR.cpp.

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

◆ mlirRegionInsertOwnedBlock()

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 752 of file IR.cpp.

References unwrap().

◆ mlirRegionInsertOwnedBlockAfter()

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 758 of file IR.cpp.

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

◆ mlirRegionInsertOwnedBlockBefore()

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 772 of file IR.cpp.

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

◆ mlirRegionTakeBody()

void mlirRegionTakeBody ( MlirRegion  target,
MlirRegion  source 
)

Moves the entire content of the source region to the target region.

Definition at line 787 of file IR.cpp.

References unwrap().

◆ mlirSymbolTableCreate()

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 1113 of file IR.cpp.

References unwrap(), and wrap().

Referenced by mlir::python::PySymbolTable::PySymbolTable().

◆ mlirSymbolTableDestroy()

void mlirSymbolTableDestroy ( MlirSymbolTable  symbolTable)

Destroys the symbol table created with mlirSymbolTableCreate.

This does not affect the operations in the table.

Definition at line 1119 of file IR.cpp.

References unwrap().

Referenced by mlir::python::PySymbolTable::~PySymbolTable().

◆ mlirSymbolTableErase()

void mlirSymbolTableErase ( MlirSymbolTable  symbolTable,
MlirOperation  operation 
)

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

Definition at line 1133 of file IR.cpp.

References unwrap().

Referenced by mlir::python::PySymbolTable::erase().

◆ mlirSymbolTableGetSymbolAttributeName()

MlirStringRef mlirSymbolTableGetSymbolAttributeName ( void  )

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

Definition at line 1105 of file IR.cpp.

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

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

◆ mlirSymbolTableGetVisibilityAttributeName()

MlirStringRef mlirSymbolTableGetVisibilityAttributeName ( void  )

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

Definition at line 1109 of file IR.cpp.

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

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

◆ mlirSymbolTableInsert()

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 1128 of file IR.cpp.

References unwrap(), and wrap().

Referenced by mlir::python::PySymbolTable::insert().

◆ mlirSymbolTableLookup()

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 1123 of file IR.cpp.

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

Referenced by mlir::python::PySymbolTable::dunderGetItem().

◆ mlirSymbolTableReplaceAllSymbolUses()

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 1138 of file IR.cpp.

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

Referenced by mlir::python::PySymbolTable::replaceAllSymbolUses().

◆ mlirSymbolTableWalkSymbolTables()

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 1149 of file IR.cpp.

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

Referenced by mlir::python::PySymbolTable::walkSymbolTables().

◆ mlirTypeDump()

void mlirTypeDump ( MlirType  type)

Prints the type to the standard error stream.

Definition at line 1035 of file IR.cpp.

References unwrap().

◆ mlirTypeEqual()

bool mlirTypeEqual ( MlirType  t1,
MlirType  t2 
)

Checks if two types are equal.

Definition at line 1026 of file IR.cpp.

References unwrap().

Referenced by mlir::python::PyType::operator==().

◆ mlirTypeGetContext()

MlirContext mlirTypeGetContext ( MlirType  type)

Gets the context that a type was created with.

Definition at line 1014 of file IR.cpp.

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

Referenced by mlir::python::PyType::createFromCapsule().

◆ mlirTypeGetDialect()

MlirDialect mlirTypeGetDialect ( MlirType  type)

Gets the dialect a type belongs to.

Definition at line 1022 of file IR.cpp.

References unwrap(), and wrap().

Referenced by mlir::python::PyValue::maybeDownCast().

◆ mlirTypeGetTypeID()

MlirTypeID mlirTypeGetTypeID ( MlirType  type)

Gets the type ID of the type.

Definition at line 1018 of file IR.cpp.

References unwrap(), and wrap().

Referenced by mlir::python::PyValue::maybeDownCast().

◆ mlirTypeParseGet()

MlirType mlirTypeParseGet ( MlirContext  context,
MlirStringRef  type 
)

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

Definition at line 1010 of file IR.cpp.

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

◆ mlirTypePrint()

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 1030 of file IR.cpp.

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

Referenced by mlir::python::PyConcreteType< DerivedTy, BaseTy >::bind().

◆ mlirValueDump()

void mlirValueDump ( MlirValue  value)

Prints the value to the standard error stream.

Definition at line 950 of file IR.cpp.

References unwrap().

◆ mlirValueEqual()

bool mlirValueEqual ( MlirValue  value1,
MlirValue  value2 
)

Returns 1 if two values are equal, 0 otherwise.

Definition at line 908 of file IR.cpp.

References unwrap().

◆ mlirValueGetFirstUse()

MlirOpOperand mlirValueGetFirstUse ( MlirValue  value)

Returns an op operand representing the first use of the value, or a null op operand if there are no uses.

Definition at line 965 of file IR.cpp.

References mlir::ValueUseIterator< OperandType >::getOperand(), unwrap(), mlir::Value::use_begin(), mlir::Value::use_empty(), and wrap().

◆ mlirValueGetType()

MlirType mlirValueGetType ( MlirValue  value)

Returns the type of the value.

Definition at line 942 of file IR.cpp.

References unwrap(), and wrap().

Referenced by mlir::python::PyValue::maybeDownCast().

◆ mlirValueIsABlockArgument()

bool mlirValueIsABlockArgument ( MlirValue  value)

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

Definition at line 912 of file IR.cpp.

References unwrap().

Referenced by mlir::python::PyValue::createFromCapsule().

◆ mlirValueIsAOpResult()

bool mlirValueIsAOpResult ( MlirValue  value)

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

Definition at line 916 of file IR.cpp.

References unwrap().

Referenced by mlir::python::PyValue::createFromCapsule().

◆ mlirValuePrint()

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 952 of file IR.cpp.

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

◆ mlirValuePrintAsOperand()

void mlirValuePrintAsOperand ( MlirValue  value,
MlirAsmState  state,
MlirStringCallback  callback,
void *  userData 
)

Prints a value as an operand (i.e., the ValueID).

Definition at line 958 of file IR.cpp.

◆ mlirValueReplaceAllUsesOfWith()

void mlirValueReplaceAllUsesOfWith ( MlirValue  of,
MlirValue  with 
)

Replace all uses of 'of' value with the 'with' value, updating anything in the IR that uses 'of' to use the other value instead.

When this returns there are zero uses of 'of'.

Definition at line 975 of file IR.cpp.

References unwrap().

◆ mlirValueSetType()

void mlirValueSetType ( MlirValue  value,
MlirType  type 
)

Set the type of the value.

Definition at line 946 of file IR.cpp.

References unwrap().

◆ toThreadingEnum()

static MLIRContext::Threading toThreadingEnum ( bool  threadingEnabled)
inlinestatic