LLZK 0.1.0
Veridise's ZK Language IR
Loading...
Searching...
No Matches
Typing.h File Reference
#include <mlir-c/IR.h>
#include <mlir-c/Support.h>
Include dependency graph for Typing.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

MLIR_CAPI_EXPORTED void llzkAssertValidAttrForParamOfType (MlirAttribute attr)
 This function asserts that the given Attribute kind is legal within the LLZK types that can contain Attribute parameters (i.e., ArrayType, StructType, and TypeVarType).
 
MLIR_CAPI_EXPORTED bool llzkIsValidType (MlirType type)
 valid types: {I1, Index, String, FeltType, StructType, ArrayType, TypeVarType}
 
MLIR_CAPI_EXPORTED bool llzkIsValidColumnType (MlirType type, MlirOperation op)
 valid types: {FeltType, StructType (with columns), ArrayType (that contains a valid column type)}
 
MLIR_CAPI_EXPORTED bool llzkIsValidGlobalType (MlirType type)
 valid types: isValidType() - {TypeVarType} - {types with variable parameters}
 
MLIR_CAPI_EXPORTED bool llzkIsValidEmitEqType (MlirType type)
 valid types: isValidType() - {String, StructType} (excluded via any type parameter nesting)
 
MLIR_CAPI_EXPORTED bool llzkIsValidConstReadType (MlirType type)
 valid types: {I1, Index, FeltType, TypeVarType}
 
MLIR_CAPI_EXPORTED bool llzkIsValidArrayElemType (MlirType type)
 valid types: isValidType() - {ArrayType}
 
MLIR_CAPI_EXPORTED bool llzkIsValidArrayType (MlirType type)
 Checks if the type is a LLZK Array and it also contains a valid LLZK type.
 
MLIR_CAPI_EXPORTED bool llzkIsConcreteType (MlirType type, bool allowStructParams)
 Return false iff the type contains any TypeVarType
 
MLIR_CAPI_EXPORTED bool llzkIsSignalType (MlirType type)
 Return true iff the given type is a StructType referencing the COMPONENT_NAME_SIGNAL struct.
 
MLIR_CAPI_EXPORTED bool llzkHasAffineMapAttr (MlirType type)
 Return true iff the given type contains an AffineMapAttr.
 
MLIR_CAPI_EXPORTED bool llzkTypeParamsUnify (intptr_t, MlirAttribute const *lhsParams, intptr_t, MlirAttribute const *rhsParams)
 Return true iff the two ArrayRef instances containing StructType or ArrayType parameters are equivalent or could be equivalent after full instantiation of struct parameters.
 
MLIR_CAPI_EXPORTED bool llzkArrayAttrTypeParamsUnify (MlirAttribute lhsParams, MlirAttribute rhsParams)
 Return true iff the two ArrayAttr instances containing StructType or ArrayType parameters are equivalent or could be equivalent after full instantiation of struct parameters.
 
MLIR_CAPI_EXPORTED bool llzkTypesUnify (MlirType lhs, MlirType rhs, intptr_t nRhsReversePrefix, MlirStringRef const *rhsReversePrefix)
 Return true iff the two Type instances are equivalent or could be equivalent after full instantiation of struct parameters (if applicable within the given types).
 
MLIR_CAPI_EXPORTED bool llzkIsMoreConcreteUnification (MlirType oldTy, MlirType newTy, bool(*knownOldToNew)(MlirType, MlirType, void *), void *data)
 Return true iff the types unify and newTy is "more concrete" than oldTy.
 
MLIR_CAPI_EXPORTED MlirAttribute llzkForceIntAttrType (MlirAttribute attr)
 Convert any IntegerAttr with a type other than IndexType to use IndexType.
 

Function Documentation

◆ llzkArrayAttrTypeParamsUnify()

MLIR_CAPI_EXPORTED bool llzkArrayAttrTypeParamsUnify ( MlirAttribute lhsParams,
MlirAttribute rhsParams )

Return true iff the two ArrayAttr instances containing StructType or ArrayType parameters are equivalent or could be equivalent after full instantiation of struct parameters.

Definition at line 60 of file Typing.cpp.

◆ llzkAssertValidAttrForParamOfType()

MLIR_CAPI_EXPORTED void llzkAssertValidAttrForParamOfType ( MlirAttribute attr)

This function asserts that the given Attribute kind is legal within the LLZK types that can contain Attribute parameters (i.e., ArrayType, StructType, and TypeVarType).

This should be used in any function that examines the attribute parameters within parameterized LLZK types to ensure that the function handles all possible cases properly, especially if more legal attributes are added in the future. Throw a fatal error if anything illegal is found, indicating that the caller of this function should be updated.

Definition at line 21 of file Typing.cpp.

◆ llzkForceIntAttrType()

MLIR_CAPI_EXPORTED MlirAttribute llzkForceIntAttrType ( MlirAttribute attr)

Convert any IntegerAttr with a type other than IndexType to use IndexType.

Definition at line 87 of file Typing.cpp.

◆ llzkHasAffineMapAttr()

MLIR_CAPI_EXPORTED bool llzkHasAffineMapAttr ( MlirType type)

Return true iff the given type contains an AffineMapAttr.

Definition at line 48 of file Typing.cpp.

◆ llzkIsConcreteType()

MLIR_CAPI_EXPORTED bool llzkIsConcreteType ( MlirType type,
bool allowStructParams )

Return false iff the type contains any TypeVarType

Definition at line 42 of file Typing.cpp.

◆ llzkIsMoreConcreteUnification()

MLIR_CAPI_EXPORTED bool llzkIsMoreConcreteUnification ( MlirType oldTy,
MlirType newTy,
bool(* knownOldToNew )(MlirType, MlirType, void *),
void * data )

Return true iff the types unify and newTy is "more concrete" than oldTy.

The types i1, index, felt.type, and string.type are concrete whereas poly.tvar is not (because it may be substituted with any type during struct instantiation). When considering the attributes with array.type and struct.type types, we define IntegerAttr and TypeAttr as concrete, AffineMapAttr as less concrete than those, and SymbolRefAttr as least concrete.

Definition at line 75 of file Typing.cpp.

◆ llzkIsSignalType()

MLIR_CAPI_EXPORTED bool llzkIsSignalType ( MlirType type)

Return true iff the given type is a StructType referencing the COMPONENT_NAME_SIGNAL struct.

Definition at line 46 of file Typing.cpp.

◆ llzkIsValidArrayElemType()

MLIR_CAPI_EXPORTED bool llzkIsValidArrayElemType ( MlirType type)

valid types: isValidType() - {ArrayType}

Definition at line 38 of file Typing.cpp.

◆ llzkIsValidArrayType()

MLIR_CAPI_EXPORTED bool llzkIsValidArrayType ( MlirType type)

Checks if the type is a LLZK Array and it also contains a valid LLZK type.

Definition at line 40 of file Typing.cpp.

◆ llzkIsValidColumnType()

MLIR_CAPI_EXPORTED bool llzkIsValidColumnType ( MlirType type,
MlirOperation op )

valid types: {FeltType, StructType (with columns), ArrayType (that contains a valid column type)}

Definition at line 27 of file Typing.cpp.

◆ llzkIsValidConstReadType()

MLIR_CAPI_EXPORTED bool llzkIsValidConstReadType ( MlirType type)

valid types: {I1, Index, FeltType, TypeVarType}

Definition at line 36 of file Typing.cpp.

◆ llzkIsValidEmitEqType()

MLIR_CAPI_EXPORTED bool llzkIsValidEmitEqType ( MlirType type)

valid types: isValidType() - {String, StructType} (excluded via any type parameter nesting)

Definition at line 34 of file Typing.cpp.

◆ llzkIsValidGlobalType()

MLIR_CAPI_EXPORTED bool llzkIsValidGlobalType ( MlirType type)

valid types: isValidType() - {TypeVarType} - {types with variable parameters}

Definition at line 32 of file Typing.cpp.

◆ llzkIsValidType()

MLIR_CAPI_EXPORTED bool llzkIsValidType ( MlirType type)

valid types: {I1, Index, String, FeltType, StructType, ArrayType, TypeVarType}

Definition at line 25 of file Typing.cpp.

◆ llzkTypeParamsUnify()

MLIR_CAPI_EXPORTED bool llzkTypeParamsUnify ( intptr_t numLhsParams,
MlirAttribute const * lhsParams,
intptr_t numRhsParams,
MlirAttribute const * rhsParams )

Return true iff the two ArrayRef instances containing StructType or ArrayType parameters are equivalent or could be equivalent after full instantiation of struct parameters.

Definition at line 50 of file Typing.cpp.

◆ llzkTypesUnify()

MLIR_CAPI_EXPORTED bool llzkTypesUnify ( MlirType lhs,
MlirType rhs,
intptr_t nRhsReversePrefix,
MlirStringRef const * rhsReversePrefix )

Return true iff the two Type instances are equivalent or could be equivalent after full instantiation of struct parameters (if applicable within the given types).

Definition at line 66 of file Typing.cpp.