LLZK 3.0.0
An open-source IR for Zero Knowledge (ZK) circuits
Loading...
Searching...
No Matches
llzk::polymorphic::detail Namespace Reference

Classes

class  ApplyMapOpGenericAdaptorBase
class  CleanupBase
 Shared state for post-instantiation cleanup helpers. More...
class  ConstReadOpGenericAdaptorBase
class  EmptyLegalityCheckCallback
class  FromEraseSet
 Removes parameterized definitions whose instantiated replacements now cover every remaining use. More...
struct  InstantiationLayout
 Groups the information needed after concrete parameters have been chosen to decide how to name a new instantiated template and how to rewrite the remaining argument list at the use site. More...
class  LegalityCheckCallback
class  TemplateExprOpGenericAdaptorBase
class  TemplateOpGenericAdaptorBase
class  TemplateParamOpGenericAdaptorBase
struct  TemplateSymbolBindingOpInterfaceInterfaceTraits
struct  TemplateSymbolBindingOpInterfaceTrait
struct  TypeVarTypeStorage
class  UnifiableCastOpGenericAdaptorBase
class  YieldOpGenericAdaptorBase

Functions

mlir::ConversionTarget newBaseTarget (mlir::MLIRContext *ctx)
 Return a new ConversionTarget allowing all LLZK-required dialects.
bool isErasableDefinition (mlir::Operation *op)
 Return true iff op is a cleanup candidate.
array::ArrayType flattenInstantiatedArrayType (array::ArrayType inputTy, mlir::Type convertedElemTy)
 Merge nested array dimensions produced by replacing an array element type.
component::StructType getStructTypeWithParams (mlir::SymbolRefAttr nameRef, mlir::ArrayAttr params)
 Build a struct type while representing an empty parameter list as absent.
component::StructType getStructTypeWithParams (mlir::SymbolRefAttr nameRef, mlir::MLIRContext *ctx, mlir::ArrayRef< mlir::Attribute > params)
 Build a struct type while representing an empty parameter list as absent.
InstantiationLayout buildInstantiationLayout (TemplateOp parentTemplate, mlir::ArrayAttr callParams, const llvm::DenseMap< mlir::Attribute, mlir::Attribute > &paramNameToConcrete)
 Derive the instantiated template name and the remaining explicit parameters that should stay on the rewritten use site.
template<typename... AdditionalOpClasses, typename... AdditionalChecks>
mlir::ConversionTarget newConverterDefinedTarget (mlir::TypeConverter &tyConv, mlir::MLIRContext *ctx, AdditionalChecks &&...checks)
 Return a new ConversionTarget allowing all LLZK-required dialects and defining Op legality based on the given TypeConverter for Ops listed in both members of OpClassesWithStructTypes and in AdditionalOpClasses.
template<typename... AdditionalOpClasses, typename... AdditionalChecks>
mlir::ConversionTarget newConverterDefinedTargetWithCallback (mlir::TypeConverter &tyConv, mlir::MLIRContext *ctx, LegalityCheckCallback &cb, AdditionalChecks &&...checks)
 Return a new ConversionTarget allowing all LLZK-required dialects and defining Op legality based on the given TypeConverter for Ops listed in both members of OpClassesWithStructTypes and in AdditionalOpClasses.

Function Documentation

◆ buildInstantiationLayout()

InstantiationLayout llzk::polymorphic::detail::buildInstantiationLayout ( TemplateOp parentTemplate,
mlir::ArrayAttr callParams,
const llvm::DenseMap< mlir::Attribute, mlir::Attribute > & paramNameToConcrete )
inline

Derive the instantiated template name and the remaining explicit parameters that should stay on the rewritten use site.

Partially-instantiated names contain the BuildShortTypeString placeholder character at the position of each non-concrete parameter.

Definition at line 145 of file SharedImpl.h.

◆ flattenInstantiatedArrayType()

llzk::array::ArrayType llzk::polymorphic::detail::flattenInstantiatedArrayType ( array::ArrayType inputTy,
mlir::Type convertedElemTy )

Merge nested array dimensions produced by replacing an array element type.

If array<4 x !poly.tvar<@T>> is rewritten with @T -> array<8 x index>, the canonical aggregate shape should become array<4,8 x index> rather than an array whose element type is another array because the latter is not allowed in LLZK IR.

Definition at line 189 of file SharedImpl.cpp.

◆ getStructTypeWithParams() [1/2]

component::StructType llzk::polymorphic::detail::getStructTypeWithParams ( mlir::SymbolRefAttr nameRef,
mlir::ArrayAttr params )
inline

Build a struct type while representing an empty parameter list as absent.

Definition at line 121 of file SharedImpl.h.

◆ getStructTypeWithParams() [2/2]

component::StructType llzk::polymorphic::detail::getStructTypeWithParams ( mlir::SymbolRefAttr nameRef,
mlir::MLIRContext * ctx,
mlir::ArrayRef< mlir::Attribute > params )
inline

Build a struct type while representing an empty parameter list as absent.

Definition at line 127 of file SharedImpl.h.

◆ isErasableDefinition()

bool llzk::polymorphic::detail::isErasableDefinition ( mlir::Operation * op)

Return true iff op is a cleanup candidate.

Definition at line 51 of file SharedImpl.cpp.

◆ newBaseTarget()

mlir::ConversionTarget llzk::polymorphic::detail::newBaseTarget ( mlir::MLIRContext * ctx)

Return a new ConversionTarget allowing all LLZK-required dialects.

Definition at line 33 of file SharedImpl.cpp.

◆ newConverterDefinedTarget()

template<typename... AdditionalOpClasses, typename... AdditionalChecks>
mlir::ConversionTarget llzk::polymorphic::detail::newConverterDefinedTarget ( mlir::TypeConverter & tyConv,
mlir::MLIRContext * ctx,
AdditionalChecks &&... checks )

Return a new ConversionTarget allowing all LLZK-required dialects and defining Op legality based on the given TypeConverter for Ops listed in both members of OpClassesWithStructTypes and in AdditionalOpClasses.

Additional legality checks can be included for certain ops that will run along with the default check. For an op to be considered legal all checks (default plus additional checks if any) must return true.

Definition at line 201 of file SharedImpl.h.

◆ newConverterDefinedTargetWithCallback()

template<typename... AdditionalOpClasses, typename... AdditionalChecks>
mlir::ConversionTarget llzk::polymorphic::detail::newConverterDefinedTargetWithCallback ( mlir::TypeConverter & tyConv,
mlir::MLIRContext * ctx,
LegalityCheckCallback & cb,
AdditionalChecks &&... checks )

Return a new ConversionTarget allowing all LLZK-required dialects and defining Op legality based on the given TypeConverter for Ops listed in both members of OpClassesWithStructTypes and in AdditionalOpClasses.

Additional legality checks can be included for certain ops that will run along with the default check. For an op to be considered legal all checks (default plus additional checks if any) must return true.

Definition at line 217 of file SharedImpl.h.