LLZK 0.1.0
Veridise's ZK Language IR
Loading...
Searching...
No Matches
TypeHelper.h File Reference
#include "llzk/Util/ErrorHelper.h"
#include <mlir/IR/OpImplementation.h>
#include <mlir/IR/Operation.h>
#include <mlir/IR/SymbolTable.h>
#include <llvm/ADT/ArrayRef.h>
#include <llvm/ADT/DenseMap.h>
#include <llvm/ADT/StringRef.h>
Include dependency graph for TypeHelper.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  llzk::BuildShortTypeString
 Note: If any symbol refs in an input Type/Attribute use any of the special characters that this class generates, they are not escaped. More...
 
struct  llvm::DenseMapInfo< llzk::Side >
 

Namespaces

namespace  llzk
 
namespace  llzk::component
 
namespace  llzk::array
 
namespace  llvm
 

Typedefs

using llzk::UnificationMap = mlir::DenseMap<std::pair<mlir::SymbolRefAttr, Side>, mlir::Attribute>
 Optional result from type unifications.
 

Enumerations

enum class  llzk::Side { llzk::EMPTY = 0 , llzk::LHS , llzk::RHS , llzk::TOMB }
 

Functions

void llzk::assertValidAttrForParamOfType (mlir::Attribute attr)
 
bool llzk::isValidType (mlir::Type type)
 valid types: {I1, Index, String, FeltType, StructType, ArrayType, TypeVarType}
 
bool llzk::isValidColumnType (mlir::Type type, mlir::SymbolTableCollection &symbolTable, mlir::Operation *op)
 valid types: {FeltType, StructType (with columns), ArrayType (that contains a valid column type)}
 
bool llzk::isValidGlobalType (mlir::Type type)
 valid types: isValidType() - {TypeVarType} - {types with variable parameters}
 
bool llzk::isValidEmitEqType (mlir::Type type)
 valid types: isValidType() - {String, StructType} (excluded via any type parameter nesting)
 
bool llzk::isValidConstReadType (mlir::Type type)
 valid types: {I1, Index, FeltType, TypeVarType}
 
bool llzk::isValidArrayElemType (mlir::Type type)
 valid types: isValidType() - {ArrayType}
 
bool llzk::isValidArrayType (mlir::Type type)
 Checks if the type is a LLZK Array and it also contains a valid LLZK type.
 
bool llzk::isConcreteType (mlir::Type type, bool allowStructParams=true)
 Return false iff the type contains any TypeVarType
 
mlir::LogicalResult llzk::checkValidType (EmitErrorFn emitError, mlir::Type type)
 
bool llzk::isSignalType (mlir::Type type)
 Return true iff the given type is a StructType referencing the COMPONENT_NAME_SIGNAL struct.
 
bool llzk::isSignalType (component::StructType sType)
 Return true iff the given StructType is referencing the COMPONENT_NAME_SIGNAL struct.
 
bool llzk::hasAffineMapAttr (mlir::Type type)
 Return true iff the given type contains an AffineMapAttr.
 
Side llzk::reverse (Side in)
 
bool llzk::isDynamic (mlir::IntegerAttr intAttr)
 
bool llzk::typeParamsUnify (const mlir::ArrayRef< mlir::Attribute > &lhsParams, const mlir::ArrayRef< mlir::Attribute > &rhsParams, UnificationMap *unifications=nullptr)
 Return true iff the two ArrayRef instances containing StructType or ArrayType parameters are equivalent or could be equivalent after full instantiation of struct parameters.
 
bool llzk::typeParamsUnify (const mlir::ArrayAttr &lhsParams, const mlir::ArrayAttr &rhsParams, UnificationMap *unifications=nullptr)
 Return true iff the two ArrayAttr instances containing StructType or ArrayType parameters are equivalent or could be equivalent after full instantiation of struct parameters.
 
bool llzk::arrayTypesUnify (array::ArrayType lhs, array::ArrayType rhs, mlir::ArrayRef< llvm::StringRef > rhsReversePrefix={}, UnificationMap *unifications=nullptr)
 Return true iff the two ArrayType instances are equivalent or could be equivalent after full instantiation of struct parameters.
 
bool llzk::structTypesUnify (component::StructType lhs, component::StructType rhs, mlir::ArrayRef< llvm::StringRef > rhsReversePrefix={}, UnificationMap *unifications=nullptr)
 Return true iff the two StructType instances are equivalent or could be equivalent after full instantiation of struct parameters.
 
bool llzk::typesUnify (mlir::Type lhs, mlir::Type rhs, mlir::ArrayRef< llvm::StringRef > rhsReversePrefix={}, UnificationMap *unifications=nullptr)
 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).
 
template<typename Iter1, typename Iter2>
bool llzk::typeListsUnify (Iter1 lhs, Iter2 rhs, mlir::ArrayRef< llvm::StringRef > rhsReversePrefix={}, UnificationMap *unifications=nullptr)
 Return true iff the two lists of Type instances are equivalent or could be equivalent after full instantiation of struct parameters (if applicable within the given types).
 
template<typename Iter1, typename Iter2>
bool llzk::singletonTypeListsUnify (Iter1 lhs, Iter2 rhs, mlir::ArrayRef< llvm::StringRef > rhsReversePrefix={}, UnificationMap *unifications=nullptr)
 
bool llzk::isMoreConcreteUnification (mlir::Type oldTy, mlir::Type newTy, llvm::function_ref< bool(mlir::Type oldTy, mlir::Type newTy)> knownOldToNew=nullptr)
 Return true iff the types unify and newTy is "more concrete" than oldTy.
 
template<typename TypeClass>
TypeClass llzk::getIfSingleton (mlir::TypeRange types)
 
template<typename TypeClass>
TypeClass llzk::getAtIndex (mlir::TypeRange types, size_t index)
 
mlir::IntegerAttr llzk::forceIntType (mlir::IntegerAttr attr)
 Convert an IntegerAttr with a type other than IndexType to use IndexType.
 
mlir::Attribute llzk::forceIntAttrType (mlir::Attribute attr)
 Convert any IntegerAttr with a type other than IndexType to use IndexType.
 
llvm::SmallVector< mlir::Attribute > llzk::forceIntAttrTypes (llvm::ArrayRef< mlir::Attribute > attrList)
 Convert any IntegerAttr with a type other than IndexType to use IndexType.
 
mlir::LogicalResult llzk::verifyIntAttrType (EmitErrorFn emitError, mlir::Attribute in)
 Verify that all IntegerAttr have type IndexType.
 
mlir::LogicalResult llzk::verifyAffineMapAttrType (EmitErrorFn emitError, mlir::Attribute in)
 Verify that all AffineMapAttr only have a single result.
 
mlir::LogicalResult llzk::verifyStructTypeParams (EmitErrorFn emitError, mlir::ArrayAttr params)
 Verify that the StructType parameters are valid.
 
mlir::LogicalResult llzk::verifyArrayDimSizes (EmitErrorFn emitError, mlir::ArrayRef< mlir::Attribute > dimensionSizes)
 Verify that the array dimensions are valid.
 
mlir::LogicalResult llzk::verifyArrayType (EmitErrorFn emitError, mlir::Type elementType, mlir::ArrayRef< mlir::Attribute > dimensionSizes)
 Verify that the ArrayType is valid.