MLIR  16.0.0git
Classes | Macros | Typedefs | Functions
Support.h File Reference
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
+ Include dependency graph for Support.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  MlirStringRef
 A pointer to a sized fragment of a string, not necessarily null-terminated. More...
 
struct  MlirLogicalResult
 A logical result value, essentially a boolean with named states. More...
 

Macros

#define MLIR_CAPI_EXPORTED   __attribute__((visibility("default")))
 
#define DEFINE_C_API_STRUCT(name, storage)
 

Typedefs

typedef struct MlirStringRef MlirStringRef
 
typedef void(* MlirStringCallback) (MlirStringRef, void *)
 A callback for returning string references. More...
 
typedef struct MlirLogicalResult MlirLogicalResult
 

Functions

 DEFINE_C_API_STRUCT (MlirTypeID, const void)
 
 DEFINE_C_API_STRUCT (MlirTypeIDAllocator, void)
 
static MlirStringRef mlirStringRefCreate (const char *str, size_t length)
 Constructs a string reference from the pointer and length. More...
 
MLIR_CAPI_EXPORTED MlirStringRef mlirStringRefCreateFromCString (const char *str)
 Constructs a string reference from a null-terminated C string. More...
 
MLIR_CAPI_EXPORTED bool mlirStringRefEqual (MlirStringRef string, MlirStringRef other)
 Returns true if two string references are equal, false otherwise. More...
 
static bool mlirLogicalResultIsSuccess (MlirLogicalResult res)
 Checks if the given logical result represents a success. More...
 
static bool mlirLogicalResultIsFailure (MlirLogicalResult res)
 Checks if the given logical result represents a failure. More...
 
static MlirLogicalResult mlirLogicalResultSuccess ()
 Creates a logical result representing a success. More...
 
static MlirLogicalResult mlirLogicalResultFailure ()
 Creates a logical result representing a failure. More...
 
MLIR_CAPI_EXPORTED MlirTypeID mlirTypeIDCreate (const void *ptr)
 ptr must be 8 byte aligned and unique to a type valid for the duration of the returned type id's usage More...
 
static bool mlirTypeIDIsNull (MlirTypeID typeID)
 Checks whether a type id is null. More...
 
MLIR_CAPI_EXPORTED bool mlirTypeIDEqual (MlirTypeID typeID1, MlirTypeID typeID2)
 Checks if two type ids are equal. More...
 
MLIR_CAPI_EXPORTED size_t mlirTypeIDHashValue (MlirTypeID typeID)
 Returns the hash value of the type id. More...
 
MLIR_CAPI_EXPORTED MlirTypeIDAllocator mlirTypeIDAllocatorCreate ()
 Creates a type id allocator for dynamic type id creation. More...
 
MLIR_CAPI_EXPORTED void mlirTypeIDAllocatorDestroy (MlirTypeIDAllocator allocator)
 Deallocates the allocator and all allocated type ids. More...
 
MLIR_CAPI_EXPORTED MlirTypeID mlirTypeIDAllocatorAllocateTypeID (MlirTypeIDAllocator allocator)
 Allocates a type id that is valid for the lifetime of the allocator. More...
 

Macro Definition Documentation

◆ DEFINE_C_API_STRUCT

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

Definition at line 53 of file Support.h.

◆ MLIR_CAPI_EXPORTED

#define MLIR_CAPI_EXPORTED   __attribute__((visibility("default")))

Typedef Documentation

◆ MlirLogicalResult

Definition at line 117 of file Support.h.

◆ MlirStringCallback

typedef void(* MlirStringCallback) (MlirStringRef, void *)

A callback for returning string references.

This function is called back by the functions that need to return a reference to the portion of the string with the following arguments:

  • an MlirStringRef representing the current portion of the string
  • a pointer to user data forwarded from the printing call.

Definition at line 103 of file Support.h.

◆ MlirStringRef

typedef struct MlirStringRef MlirStringRef

Definition at line 75 of file Support.h.

Function Documentation

◆ DEFINE_C_API_STRUCT() [1/2]

DEFINE_C_API_STRUCT ( MlirTypeID  ,
const void   
)

◆ DEFINE_C_API_STRUCT() [2/2]

DEFINE_C_API_STRUCT ( MlirTypeIDAllocator  ,
void   
)

◆ mlirLogicalResultFailure()

static MlirLogicalResult mlirLogicalResultFailure ( )
inlinestatic

Creates a logical result representing a failure.

Definition at line 136 of file Support.h.

Referenced by mlir::python::PyMlirContext::attachDiagnosticHandler(), and mlirInferTypeOpInterfaceInferReturnTypes().

◆ mlirLogicalResultIsFailure()

static bool mlirLogicalResultIsFailure ( MlirLogicalResult  res)
inlinestatic

Checks if the given logical result represents a failure.

Definition at line 125 of file Support.h.

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

◆ mlirLogicalResultIsSuccess()

static bool mlirLogicalResultIsSuccess ( MlirLogicalResult  res)
inlinestatic

Checks if the given logical result represents a success.

Definition at line 120 of file Support.h.

◆ mlirLogicalResultSuccess()

static MlirLogicalResult mlirLogicalResultSuccess ( )
inlinestatic

Creates a logical result representing a success.

Definition at line 130 of file Support.h.

Referenced by mlir::python::PyMlirContext::attachDiagnosticHandler(), and mlirInferTypeOpInterfaceInferReturnTypes().

◆ mlirStringRefCreate()

static MlirStringRef mlirStringRefCreate ( const char *  str,
size_t  length 
)
inlinestatic

◆ mlirStringRefCreateFromCString()

MLIR_CAPI_EXPORTED MlirStringRef mlirStringRefCreateFromCString ( const char *  str)

Constructs a string reference from a null-terminated C string.

Prefer mlirStringRefCreate if the length of the string is known.

Definition at line 14 of file Support.cpp.

References mlirStringRefCreate().

Referenced by mlirStringRefCreate().

◆ mlirStringRefEqual()

MLIR_CAPI_EXPORTED bool mlirStringRefEqual ( MlirStringRef  string,
MlirStringRef  other 
)

Returns true if two string references are equal, false otherwise.

Definition at line 18 of file Support.cpp.

References MlirStringRef::data, and MlirStringRef::length.

Referenced by mlirStringRefCreate().

◆ mlirTypeIDAllocatorAllocateTypeID()

MLIR_CAPI_EXPORTED MlirTypeID mlirTypeIDAllocatorAllocateTypeID ( MlirTypeIDAllocator  allocator)

Allocates a type id that is valid for the lifetime of the allocator.

Definition at line 56 of file Support.cpp.

References unwrap(), and wrap().

Referenced by mlirTypeIDIsNull().

◆ mlirTypeIDAllocatorCreate()

MLIR_CAPI_EXPORTED MlirTypeIDAllocator mlirTypeIDAllocatorCreate ( )

Creates a type id allocator for dynamic type id creation.

Definition at line 48 of file Support.cpp.

References wrap().

Referenced by mlirTypeIDIsNull().

◆ mlirTypeIDAllocatorDestroy()

MLIR_CAPI_EXPORTED void mlirTypeIDAllocatorDestroy ( MlirTypeIDAllocator  allocator)

Deallocates the allocator and all allocated type ids.

Definition at line 52 of file Support.cpp.

References unwrap().

Referenced by mlirTypeIDIsNull().

◆ mlirTypeIDCreate()

MLIR_CAPI_EXPORTED MlirTypeID mlirTypeIDCreate ( const void ptr)

ptr must be 8 byte aligned and unique to a type valid for the duration of the returned type id's usage

Definition at line 27 of file Support.cpp.

References mlir::TypeID::getFromOpaquePointer(), and wrap().

◆ mlirTypeIDEqual()

MLIR_CAPI_EXPORTED bool mlirTypeIDEqual ( MlirTypeID  typeID1,
MlirTypeID  typeID2 
)

Checks if two type ids are equal.

Definition at line 36 of file Support.cpp.

References unwrap().

Referenced by mlirTypeIDIsNull().

◆ mlirTypeIDHashValue()

MLIR_CAPI_EXPORTED size_t mlirTypeIDHashValue ( MlirTypeID  typeID)

Returns the hash value of the type id.

Definition at line 40 of file Support.cpp.

References mlir::presburger::hash_value(), and unwrap().

Referenced by mlirTypeIDIsNull().

◆ mlirTypeIDIsNull()

static bool mlirTypeIDIsNull ( MlirTypeID  typeID)
inlinestatic