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

FailureOr< InstantiationLayoutbuildInstantiationLayout (TemplateOp parentTemplate, ArrayAttr callParams, const DenseMap< Attribute, Attribute > &paramNameToConcrete)
void setInstantiationNamePattern (TemplateOp templateOp, ArrayAttr namePattern)
std::string buildOpaqueInstantiationName (StringRef baseName, ArrayRef< Attribute > concreteAttrs)
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.
mlir::FailureOr< InstantiationLayoutbuildInstantiationLayout (TemplateOp parentTemplate, mlir::ArrayAttr callParams, const llvm::DenseMap< mlir::Attribute, mlir::Attribute > &paramNameToConcrete)
 Derive the instantiated template name, remaining explicit parameters, and refined literal pattern.
void setInstantiationNamePattern (TemplateOp templateOp, mlir::ArrayAttr namePattern)
 Clear inherited pattern state from a fully concrete template, or attach refined chunks before a partial template is inserted into a symbol table.
std::string buildOpaqueInstantiationName (llvm::StringRef baseName, llvm::ArrayRef< mlir::Attribute > concreteAttrs)
 Append concrete attributes to an opaque physical base name without interpreting its bytes.
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() [1/2]

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

Definition at line 45 of file SharedImpl.cpp.

◆ buildInstantiationLayout() [2/2]

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

Derive the instantiated template name, remaining explicit parameters, and refined literal pattern.

A malformed pattern is rejected even though TemplateOp verification normally runs before a transform; this keeps the owner boundary safe for programmatically built IR too.

◆ buildOpaqueInstantiationName() [1/2]

std::string llzk::polymorphic::detail::buildOpaqueInstantiationName ( llvm::StringRef baseName,
llvm::ArrayRef< mlir::Attribute > concreteAttrs )

Append concrete attributes to an opaque physical base name without interpreting its bytes.

◆ buildOpaqueInstantiationName() [2/2]

std::string llzk::polymorphic::detail::buildOpaqueInstantiationName ( StringRef baseName,
ArrayRef< Attribute > concreteAttrs )

Definition at line 160 of file SharedImpl.cpp.

◆ flattenInstantiatedArrayType()

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.

◆ 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.

◆ newBaseTarget()

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

Return a new ConversionTarget allowing all LLZK-required dialects.

◆ 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 183 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 199 of file SharedImpl.h.

◆ setInstantiationNamePattern() [1/2]

void llzk::polymorphic::detail::setInstantiationNamePattern ( TemplateOp templateOp,
ArrayAttr namePattern )

Definition at line 152 of file SharedImpl.cpp.

◆ setInstantiationNamePattern() [2/2]

void llzk::polymorphic::detail::setInstantiationNamePattern ( TemplateOp templateOp,
mlir::ArrayAttr namePattern )

Clear inherited pattern state from a fully concrete template, or attach refined chunks before a partial template is inserted into a symbol table.