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

Namespaces

namespace  affineMapHelpers
 Group together all implementation related to AffineMap type parameters.
namespace  alignmentHelpers
namespace  array
namespace  boolean
namespace  cast
namespace  component
namespace  constrain
namespace  dataflow
namespace  debug
namespace  detail
namespace  felt
namespace  function
namespace  global
namespace  impl
namespace  include
namespace  pod
namespace  polymorphic
namespace  ram
namespace  smt
namespace  string

Classes

struct  AuxAssignment
class  BaseBuilder
class  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...
class  CallGraph
 This is a port of mlir::CallGraph that has been adapted to use the custom symbol lookup helpers (see SymbolHelper.h). More...
class  CallGraphAnalysis
 An analysis wrapper to compute the CallGraph for a Module. More...
class  CallGraphNode
 This is a simple port of the mlir::CallGraphNode with llzk::CallGraph as a friend class, for mlir::CallGraphNode has a private constructor and can only be constructed by mlir::CallGraph. More...
class  CallGraphPrinterPass
class  CallGraphReachabilityAnalysis
 Lazily-constructed reachability analysis. More...
class  CallGraphSCCsPrinterPass
struct  CDGAnalysisContext
 Parameters and shared objects to pass to child analyses. More...
struct  CommutativeMatcher
 This matcher will either match on lhs op rhs or rhs op lhs. More...
class  ComputeConstrainToProductPass
struct  ComputeConstrainToProductPassOptions
struct  ConstantCapture
 Matches and optionally captures a felt constant. More...
class  ConstraintDependencyGraph
 A dependency graph of constraints enforced by an LLZK struct. More...
class  ConstraintDependencyGraphModuleAnalysis
 A module-level analysis for constructing ConstraintDependencyGraph objects for all structs in the given LLZK module. More...
class  ConstraintDependencyGraphPrinterPass
struct  ConstraintDependencyGraphPrinterPassOptions
class  ConstraintDependencyGraphStructAnalysis
 An analysis wrapper around the ConstraintDependencyGraph for a given struct. More...
class  EnforceNoMemberOverwritePass
class  ExpressionValue
 Tracks a solver expression and an interval range for that expression. More...
class  Field
 Information about the prime finite field used for the interval analysis. More...
struct  FileLineColLocComparator
class  filtered_raw_ostream
 Wrapper for llvm::raw_ostream that filters out certain characters selected by a function. More...
struct  FullPolyLoweringOptions
class  FunctionTypeConverter
 General helper for converting a FuncDefOp by changing its input and/or result types and the associated attributes for those types. More...
class  FuseProductLoopsPass
class  FuzzySet
 Represents a set where the membership predicate can take three values: true, false, and "unknown". More...
class  GlobalSourceMgr
class  InFlightDiagnosticWrapper
 Wrapper around InFlightDiagnostic that can either be a regular InFlightDiagnostic or a special version that asserts false after reporting the diagnostic. More...
struct  InlineStructsPassOptions
class  Interval
 Intervals over a finite field. More...
struct  IntervalAnalysisContext
 Parameters and shared objects to pass to child analyses. More...
class  IntervalAnalysisLattice
class  IntervalAnalysisLatticeValue
class  IntervalAnalysisPrinterPass
struct  IntervalAnalysisPrinterPassOptions
class  IntervalDataFlowAnalysis
class  LightweightSignalEquivalenceAnalysis
class  LLZKDialect
struct  LLZKDialectBytecodeInterface
 This implements the bytecode interface for the LLZK dialect. More...
struct  LLZKDialectVersion
class  LLZKSymbolTableImplTrait
 See LLZKSymbolTable ODS documentation for details. More...
struct  LLZKTypeSwitch
 Template pattern for performing some operation by cases based on a given LLZK type. More...
struct  LocationComparator
class  MemberOverwriteAnalysis
class  MemberOverwriteLattice
class  ModuleAnalysis
 An analysis wrapper that runs the given StructAnalysisTy struct analysis over all of the struct contained within the module. More...
class  ModuleBuilder
 Builds out a LLZK-compliant module and provides utilities for populating that module. More...
class  ModuleIntervalAnalysis
class  ModuleLikeBuilder
struct  NamedOpLocationLess
struct  NoContext
 An empty struct that is used for convenience for analyses that do not require any context. More...
class  NonDetOp
class  NonDetOpAdaptor
class  NonDetOpGenericAdaptor
struct  OpClassesWithStructTypes
 Lists all LLZK op classes that may contain a StructType in their results or attributes.
struct  OpHash
struct  OpLocationLess
struct  PolyLoweringPassOptions
class  PredecessorAnalysis
class  PredecessorLattice
class  PredecessorPrinterPass
struct  PredecessorPrinterPassOptions
class  ProductAligner
struct  RefValueCapture
 Matches and optionally captures a SourceRef base value, which is either a member read or a block argument (i.e., an input to a @constrain or @compute function). More...
class  SourceRef
 A reference to a "source", which is the base value from which other SSA values are derived. More...
class  SourceRefAnalysis
 The dataflow analysis that computes the set of references that LLZK operations use and produce. More...
class  SourceRefIndex
 Defines an index into an LLZK object. More...
class  SourceRefLattice
 Sparse SSA-value lattice for SourceRef propagation. More...
class  SourceRefLatticeValue
 A value at a given point of the SourceRefLattice. More...
class  SourceRefSet
class  StructAnalysis
 This is the base class for a dataflow analysis designed to run on a single struct (i.e., a single component). More...
class  StructIntervalAnalysis
class  StructIntervals
class  SymbolDefTree
 Builds a tree structure representing the symbol table structure. More...
class  SymbolDefTreeNode
class  SymbolDefTreePass
struct  SymbolDefTreePrinterPassOptions
class  SymbolLookupResult
class  SymbolLookupResultUntyped
class  SymbolUseGraph
 Builds a graph structure representing the relationships between symbols and their uses. More...
class  SymbolUseGraphNode
class  SymbolUseGraphPass
struct  SymbolUseGraphPrinterPassOptions
class  TemplateBuilder
 Builds out a LLZK-compliant template and provides utilities for populating that template. More...
class  UnreducedInterval
 An inclusive interval [a, b] where a and b are arbitrary integers not necessarily bound to a given field. More...
struct  UnusedDeclarationEliminationPassOptions
struct  ValueLess
struct  VerifySizesForMultiAffineOps
 Produces errors if there is an inconsistency in the various attributes/values that are used to support affine map instantiation in the Op marked with this Trait. More...
class  Within

Concepts

concept  ContextType
concept  StructAnalysisType
 Any type that is a subclass of StructAnalysis and provided a Context that matches ContextType.
concept  OpComparable
concept  NamedOpComparable
concept  OpHashable

Typedefs

using SourceRefRemappings = std::vector<std::pair<SourceRef, SourceRefLatticeValue>>
using Overwrite = std::pair<component::MemberWriteOp, component::MemberWriteOp>
using TranslationMap = std::unordered_map<SourceRef, SourceRefLatticeValue, SourceRef::Hash>
using EmitErrorFn = llvm::function_ref<InFlightDiagnosticWrapper()>
 Callback to produce an error diagnostic.
using OwningEmitErrorFn = std::function<InFlightDiagnosticWrapper()>
 This type is required in cases like the functions below to take ownership of the lambda so it is not destroyed upon return from the function.
using FieldRef = std::reference_wrapper<const Field>
 Typealias for a stable reference to a known Field.
using FieldSet = llvm::SmallSet<FieldRef, 2>
 Typealias for a set of Fields.
using ManagedResources
using UnificationMap = mlir::DenseMap<std::pair<mlir::SymbolRefAttr, Side>, mlir::Attribute>
 Optional result from type unifications.

Enumerations

enum class  OutputStream : uint32_t { Outs = 1 , Errs = 2 , Dbgs = 3 }
enum class  Side : std::uint8_t { EMPTY = 0 , LHS , RHS , TOMB }

Functions

llvm::raw_ostream & toStream (OutputStream val)
std::unique_ptr< mlir::Pass > createCallGraphPrinterPass (llvm::raw_ostream &os=llvm::errs())
std::unique_ptr< mlir::Pass > createCallGraphSCCsPrinterPass (llvm::raw_ostream &os=llvm::errs())
std::unique_ptr< mlir::Pass > createConstraintDependencyGraphPrinterPass (llvm::raw_ostream &os=llvm::errs())
llvm::SMTExprRef createFieldInverseExpr (const llvm::SMTSolverRef &solver, Operation *op, const ExpressionValue &val, StringRef suffix="")
ExpressionValue boolToFelt (const llvm::SMTSolverRef &solver, const ExpressionValue &expr, unsigned bitwidth)
ExpressionValue selectValue (const llvm::SMTSolverRef &solver, const ExpressionValue &cond, const ExpressionValue &trueVal, const ExpressionValue &falseVal)
ExpressionValue intersection (const llvm::SMTSolverRef &solver, const ExpressionValue &lhs, const ExpressionValue &rhs)
ExpressionValue add (const llvm::SMTSolverRef &solver, const ExpressionValue &lhs, const ExpressionValue &rhs)
ExpressionValue sub (const llvm::SMTSolverRef &solver, const ExpressionValue &lhs, const ExpressionValue &rhs)
ExpressionValue mul (const llvm::SMTSolverRef &solver, const ExpressionValue &lhs, const ExpressionValue &rhs)
ExpressionValue div (const llvm::SMTSolverRef &solver, Operation *op, const ExpressionValue &lhs, const ExpressionValue &rhs)
ExpressionValue uintDiv (const llvm::SMTSolverRef &solver, Operation *op, const ExpressionValue &lhs, const ExpressionValue &rhs)
ExpressionValue sintDiv (const llvm::SMTSolverRef &solver, Operation *op, const ExpressionValue &lhs, const ExpressionValue &rhs)
ExpressionValue mod (const llvm::SMTSolverRef &solver, const ExpressionValue &lhs, const ExpressionValue &rhs)
ExpressionValue bitAnd (const llvm::SMTSolverRef &solver, const ExpressionValue &lhs, const ExpressionValue &rhs)
ExpressionValue bitOr (const llvm::SMTSolverRef &solver, const ExpressionValue &lhs, const ExpressionValue &rhs)
ExpressionValue bitXor (const llvm::SMTSolverRef &solver, const ExpressionValue &lhs, const ExpressionValue &rhs)
ExpressionValue shiftLeft (const llvm::SMTSolverRef &solver, const ExpressionValue &lhs, const ExpressionValue &rhs)
ExpressionValue shiftRight (const llvm::SMTSolverRef &solver, const ExpressionValue &lhs, const ExpressionValue &rhs)
ExpressionValue cmp (const llvm::SMTSolverRef &solver, boolean::CmpOp op, const ExpressionValue &lhs, const ExpressionValue &rhs)
ExpressionValue boolAnd (const llvm::SMTSolverRef &solver, const ExpressionValue &lhs, const ExpressionValue &rhs)
ExpressionValue boolOr (const llvm::SMTSolverRef &solver, const ExpressionValue &lhs, const ExpressionValue &rhs)
ExpressionValue boolXor (const llvm::SMTSolverRef &solver, const ExpressionValue &lhs, const ExpressionValue &rhs)
ExpressionValue neg (const llvm::SMTSolverRef &solver, const ExpressionValue &val)
ExpressionValue notOp (const llvm::SMTSolverRef &solver, const ExpressionValue &val)
ExpressionValue boolNot (const llvm::SMTSolverRef &solver, const ExpressionValue &val)
ExpressionValue fallbackUnaryOp (const llvm::SMTSolverRef &solver, Operation *op, const ExpressionValue &val)
std::unique_ptr< mlir::Pass > createIntervalAnalysisPrinterPass (llvm::raw_ostream &os=llvm::errs())
UnreducedInterval operator+ (const UnreducedInterval &lhs, const UnreducedInterval &rhs)
UnreducedInterval operator- (const UnreducedInterval &lhs, const UnreducedInterval &rhs)
UnreducedInterval operator* (const UnreducedInterval &lhs, const UnreducedInterval &rhs)
std::strong_ordering operator<=> (const UnreducedInterval &lhs, const UnreducedInterval &rhs)
const FieldcheckFields (const Interval &lhs, const Interval &rhs)
Interval operator+ (const Interval &lhs, const Interval &rhs)
Interval operator- (const Interval &lhs, const Interval &rhs)
Interval operator* (const Interval &lhs, const Interval &rhs)
FailureOr< IntervalfeltDiv (const Interval &lhs, const Interval &rhs)
 Computes finite-field division by multiplying the dividend by the multiplicative inverse of the divisor.
FailureOr< IntervalunsignedIntDiv (const Interval &lhs, const Interval &rhs)
 Computes unsigned integer division with possibly non-Degenerate divisors.
FailureOr< IntervalsignedIntDiv (const Interval &lhs, const Interval &rhs)
 Computes signed integer division with possibly non-Degenerate divisors.
Interval operator% (const Interval &lhs, const Interval &rhs)
Interval operator& (const Interval &lhs, const Interval &rhs)
Interval operator| (const Interval &lhs, const Interval &rhs)
Interval operator^ (const Interval &lhs, const Interval &rhs)
Interval operator<< (const Interval &lhs, const Interval &rhs)
Interval operator>> (const Interval &lhs, const Interval &rhs)
Interval boolAnd (const Interval &lhs, const Interval &rhs)
Interval boolOr (const Interval &lhs, const Interval &rhs)
Interval boolXor (const Interval &lhs, const Interval &rhs)
Interval boolNot (const Interval &iv)
Value replaceReadWithWrite (Value v)
llvm::raw_ostream & operator<< (llvm::raw_ostream &os, const MemberOverwriteLattice &lat)
llvm::FailureOr< std::pair< llvm::SetVector< Overwrite >, FuzzySet > > analyzeStruct (component::StructDefOp structDef)
raw_ostream & printRegionless (raw_ostream &os, Operation *op, bool withParent=false)
 Prints op without region.
std::unique_ptr< mlir::Pass > createPredecessorPrinterPass ()
SymbolLookupResult< StructDefOpgetStructDef (SymbolTableCollection &tables, ModuleOp mod, StructType ty)
 Lookup a StructDefOp from a given StructType.
std::vector< SourceRefgetAllChildren (SymbolTableCollection &, ModuleOp, ArrayType arrayTy, const SourceRef &root)
std::vector< SourceRefgetAllChildren (SymbolTableCollection &tables, ModuleOp mod, SymbolLookupResult< StructDefOp > structDefRes, const SourceRef &root)
raw_ostream & operator<< (raw_ostream &os, const SourceRef &rhs)
raw_ostream & operator<< (raw_ostream &os, const SourceRefSet &rhs)
mlir::raw_ostream & operator<< (mlir::raw_ostream &os, const SourceRefLatticeValue &v)
std::unique_ptr< mlir::Pass > createSymbolDefTreePrinterPass ()
std::unique_ptr< mlir::Pass > createSymbolUseGraphPrinterPass ()
void registerAllDialects (mlir::DialectRegistry &registry)
void printAttrs (AsmPrinter &printer, ArrayRef< Attribute > attrs, const StringRef &separator)
OwningOpRef< ModuleOp > createLLZKModule (MLIRContext *, Location loc)
void addLangAttrForLLZKDialect (ModuleOp mod)
bool isValidRoot (StructDefOp root)
LogicalResult alignStartingAt (component::StructDefOp root, SymbolTableCollection &tables, LightweightSignalEquivalenceAnalysis &equivalence)
std::unique_ptr< Pass > createComputeConstrainToProductPass ()
std::unique_ptr< mlir::Pass > createNoOverwritesPass ()
llvm::SMTExprRef mkExpr (mlir::Value value, llvm::SMTSolver *solver)
llvm::SMTExprRef tripCount (mlir::scf::ForOp op, llvm::SMTSolver *solver)
mlir::LogicalResult fuseMatchingLoopPairs (mlir::Region &body, mlir::MLIRContext *context)
 Identify pairs of scf.for loops that can be fused, fuse them, and then recurse to fuse nested loops.
std::unique_ptr< mlir::Pass > createFuseProductLoopsPass ()
void registerInliningExtensions (DialectRegistry &registry)
Value rebuildExprInCompute (Value val, FuncDefOp computeFunc, OpBuilder &builder, DenseMap< Value, Value > &memo)
LogicalResult checkForAuxMemberConflicts (StructDefOp structDef, StringRef prefix)
void replaceSubsequentUsesWith (Value oldVal, Value newVal, Operation *afterOp)
MemberDefOp addAuxMember (StructDefOp structDef, StringRef name)
unsigned getFeltDegree (Value val, DenseMap< Value, unsigned > &memo)
void addRemoveUnnecessaryOpsAndDefsPipeline (OpPassManager &pm)
void registerTransformationPassPipelines ()
DynamicAPInt operator& (const DynamicAPInt &lhs, const DynamicAPInt &rhs)
DynamicAPInt operator| (const DynamicAPInt &lhs, const DynamicAPInt &rhs)
DynamicAPInt operator^ (const DynamicAPInt &lhs, const DynamicAPInt &rhs)
DynamicAPInt operator<< (const DynamicAPInt &lhs, const DynamicAPInt &rhs)
DynamicAPInt operator>> (const DynamicAPInt &lhs, const DynamicAPInt &rhs)
DynamicAPInt toDynamicAPInt (StringRef str)
DynamicAPInt toDynamicAPInt (const APSInt &i)
APSInt toAPSInt (const DynamicAPInt &i)
APInt toAPInt (const DynamicAPInt &val, unsigned bitWidth)
DynamicAPInt modExp (const DynamicAPInt &base, const DynamicAPInt &exp, const DynamicAPInt &mod)
DynamicAPInt modInversePrime (const DynamicAPInt &f, const DynamicAPInt &p)
LogicalResult addSpecifiedFields (ModuleOp modOp)
llvm::SmallVector< StringRef > getNames (SymbolRefAttr ref)
llvm::SmallVector< FlatSymbolRefAttr > getPieces (SymbolRefAttr ref)
SymbolRefAttr replaceLeaf (SymbolRefAttr orig, FlatSymbolRefAttr newLeaf)
SymbolRefAttr appendLeaf (SymbolRefAttr orig, FlatSymbolRefAttr newLeaf)
SymbolRefAttr appendLeafName (SymbolRefAttr orig, const Twine &newLeafSuffix)
FailureOr< ModuleOp > getRootModule (Operation *from)
FailureOr< SymbolRefAttr > getPathFromRoot (SymbolOpInterface to, ModuleOp *foundRoot)
FailureOr< SymbolRefAttr > getPathFromRoot (TemplateOp &to, ModuleOp *foundRoot)
FailureOr< SymbolRefAttr > getPathFromRoot (StructDefOp &to, ModuleOp *foundRoot)
FailureOr< SymbolRefAttr > getPathFromRoot (MemberDefOp &to, ModuleOp *foundRoot)
FailureOr< SymbolRefAttr > getPathFromRoot (FuncDefOp &to, ModuleOp *foundRoot)
FailureOr< ModuleOp > getTopRootModule (Operation *from)
FailureOr< SymbolRefAttr > getPathFromTopRoot (SymbolOpInterface to, ModuleOp *foundRoot)
FailureOr< SymbolRefAttr > getPathFromTopRoot (TemplateOp &to, ModuleOp *foundRoot)
FailureOr< SymbolRefAttr > getPathFromTopRoot (StructDefOp &to, ModuleOp *foundRoot)
FailureOr< SymbolRefAttr > getPathFromTopRoot (MemberDefOp &to, ModuleOp *foundRoot)
FailureOr< SymbolRefAttr > getPathFromTopRoot (FuncDefOp &to, ModuleOp *foundRoot)
FailureOr< StructTypegetMainInstanceType (Operation *lookupFrom)
FailureOr< SymbolLookupResult< StructDefOp > > getMainInstanceDef (SymbolTableCollection &symbolTable, Operation *lookupFrom)
LogicalResult verifyParamOfType (SymbolTableCollection &tables, SymbolRefAttr param, Type parameterizedType, Operation *origin)
LogicalResult verifyParamsOfType (SymbolTableCollection &tables, ArrayRef< Attribute > tyParams, Type parameterizedType, Operation *origin)
FailureOr< StructDefOpverifyStructTypeResolution (SymbolTableCollection &tables, StructType ty, Operation *origin)
LogicalResult verifyTypeResolution (SymbolTableCollection &tables, Operation *origin, Type ty)
bool isValidType (Type type)
bool isValidColumnType (Type type, SymbolTableCollection &symbolTable, Operation *op)
bool isValidGlobalType (Type type)
bool isValidEmitEqType (Type type)
bool isValidConstReadType (Type type)
bool isValidArrayElemType (Type type)
bool isValidArrayType (Type type)
bool isConcreteType (Type type, bool allowStructParams)
bool hasAffineMapAttr (Type type)
bool isDynamic (IntegerAttr intAttr)
uint64_t computeEmitEqCardinality (Type type)
bool typeParamsUnify (const ArrayRef< Attribute > &lhsParams, const ArrayRef< Attribute > &rhsParams, UnificationMap *unifications)
bool typeParamsUnify (const ArrayAttr &lhsParams, const ArrayAttr &rhsParams, UnificationMap *unifications)
 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 arrayTypesUnify (ArrayType lhs, ArrayType rhs, ArrayRef< StringRef > rhsReversePrefix, UnificationMap *unifications)
bool structTypesUnify (StructType lhs, StructType rhs, ArrayRef< StringRef > rhsReversePrefix, UnificationMap *unifications)
bool podTypesUnify (PodType lhs, PodType rhs, ArrayRef< StringRef > rhsReversePrefix, UnificationMap *unifications)
bool functionTypesUnify (FunctionType lhs, FunctionType rhs, ArrayRef< StringRef > rhsReversePrefix, UnificationMap *unifications)
bool typesUnify (Type lhs, Type rhs, ArrayRef< StringRef > rhsReversePrefix, UnificationMap *unifications)
bool isMoreConcreteUnification (Type oldTy, Type newTy, llvm::function_ref< bool(Type oldTy, Type newTy)> knownOldToNew)
FailureOr< IntegerAttr > forceIntType (IntegerAttr attr, EmitErrorFn emitError)
 Convert an IntegerAttr with a type other than IndexType to use IndexType.
FailureOr< Attribute > forceIntAttrType (Attribute attr, EmitErrorFn emitError)
FailureOr< SmallVector< Attribute > > forceIntAttrTypes (ArrayRef< Attribute > attrList, EmitErrorFn emitError)
LogicalResult verifyIntAttrType (EmitErrorFn emitError, Attribute in)
LogicalResult verifyAffineMapAttrType (EmitErrorFn emitError, Attribute in)
LogicalResult verifyStructTypeParams (EmitErrorFn emitError, ArrayAttr params)
LogicalResult verifyArrayDimSizes (EmitErrorFn emitError, ArrayRef< Attribute > dimensionSizes)
LogicalResult verifyArrayType (EmitErrorFn emitError, Type elementType, ArrayRef< Attribute > dimensionSizes)
void assertValidAttrForParamOfType (Attribute attr)
LogicalResult verifySubArrayType (EmitErrorFn emitError, array::ArrayType arrayType, array::ArrayType subArrayType)
 Determine if the subArrayType is a valid subarray of arrayType.
LogicalResult verifySubArrayOrElementType (EmitErrorFn emitError, ArrayType arrayType, Type subArrayOrElemType)
bool isFeltOrSimpleFeltAggregate (Type ty)
bool isValidMainSignalType (Type pType)
::llvm::StringRef stringifyOutputStream (OutputStream val)
::std::optional< OutputStreamsymbolizeOutputStream (::llvm::StringRef str)
::std::optional< OutputStreamsymbolizeOutputStream (uint32_t value)
constexpr unsigned getMaxEnumValForOutputStream ()
inline ::llvm::StringRef stringifyEnum (OutputStream enumValue)
template<typename EnumType>
::std::optional< EnumType > symbolizeEnum (::llvm::StringRef)
template<>
inline ::std::optional< OutputStreamsymbolizeEnum< OutputStream > (::llvm::StringRef str)
llvm::raw_ostream & toStream (mlir::Pass::Option< OutputStream > &val)
void registerCallGraphPrinterPass ()
void registerCallGraphPrinterPassPass ()
void registerCallGraphSCCsPrinterPass ()
void registerCallGraphSCCsPrinterPassPass ()
void registerConstraintDependencyGraphPrinterPass ()
void registerConstraintDependencyGraphPrinterPassPass ()
void registerIntervalAnalysisPrinterPass ()
void registerIntervalAnalysisPrinterPassPass ()
void registerPredecessorPrinterPass ()
void registerPredecessorPrinterPassPass ()
void registerSymbolDefTreePrinterPass ()
void registerSymbolDefTreePrinterPassPass ()
void registerSymbolUseGraphPrinterPass ()
void registerSymbolUseGraphPrinterPassPass ()
void registerAnalysisPasses ()
template<typename GraphT>
bool hasCycle (const GraphT &G)
template<typename OpType, typename LhsMatcher, typename RhsMatcher>
auto m_CommutativeOp (LhsMatcher lhs, RhsMatcher rhs)
RefValueCapture m_RefValue ()
RefValueCapture m_RefValue (mlir::Value *capture)
ConstantCapture m_Constant ()
ConstantCapture m_Constant (felt::FeltConstantOp *capture)
llvm::raw_ostream & operator<< (llvm::raw_ostream &os, const FuzzySet &set)
mlir::raw_ostream & operator<< (mlir::raw_ostream &os, const SourceRef &rhs)
template<typename OpT>
mlir::RegisteredOperationName getCheckRegisteredInfo (mlir::MLIRContext *ctx)
template<typename OpTy, typename... Args>
mlir::Operation * create (MlirOpBuilder cBuilder, MlirLocation cLocation, Args &&...args)
 Creates a new operation using an ODS build method.
llvm::APInt toAPInt (int64_t i)
int64_t fromAPInt (const llvm::APInt &i)
bool isNullOrEmpty (mlir::ArrayAttr a)
bool isNullOrEmpty (mlir::DenseArrayAttr a)
bool isNullOrEmpty (mlir::DictionaryAttr a)
void appendWithoutType (mlir::raw_ostream &os, mlir::Attribute a)
std::string stringWithoutType (mlir::Attribute a)
void printAttrs (mlir::AsmPrinter &printer, mlir::ArrayRef< mlir::Attribute > attrs, const mlir::StringRef &separator)
mlir::Location getUnknownLoc (mlir::MLIRContext *context)
mlir::OwningOpRef< mlir::ModuleOp > createLLZKModule (mlir::MLIRContext *context, mlir::Location loc)
mlir::OwningOpRef< mlir::ModuleOp > createLLZKModule (mlir::MLIRContext *context)
void addLangAttrForLLZKDialect (mlir::ModuleOp mod)
template<typename OpClass>
llvm::StringLiteral getOperationName ()
 Get the operation name, like "constrain.eq" for the given OpClass.
template<typename OpClass>
OpClass getSelfOrParentOfType (mlir::Operation *op)
 Return the closest operation that is of type 'OpClass', either the op itself or an ancestor.
template<typename OpClass>
OpClass getParentOfType (mlir::Operation *op)
 Return the closest surrounding parent operation that is of type 'OpClass'.
template<unsigned N>
mlir::ParseResult parseDimAndSymbolList (mlir::OpAsmParser &parser, mlir::SmallVector< mlir::OpAsmParser::UnresolvedOperand, N > &mapOperands, mlir::IntegerAttr &numDims)
void printDimAndSymbolList (mlir::OpAsmPrinter &printer, mlir::Operation *op, mlir::OperandRange mapOperands, mlir::IntegerAttr numDims)
mlir::ParseResult parseMultiDimAndSymbolList (mlir::OpAsmParser &parser, mlir::SmallVector< mlir::SmallVector< mlir::OpAsmParser::UnresolvedOperand > > &multiMapOperands, mlir::DenseI32ArrayAttr &numDimsPerMap)
void printMultiDimAndSymbolList (mlir::OpAsmPrinter &printer, mlir::Operation *op, mlir::OperandRangeRange multiMapOperands, mlir::DenseI32ArrayAttr numDimsPerMap)
mlir::ParseResult parseAttrDictWithWarnings (mlir::OpAsmParser &parser, mlir::NamedAttrList &extraAttrs, mlir::OperationState &state)
template<typename ConcreteOp>
void printAttrDictWithWarnings (mlir::OpAsmPrinter &printer, ConcreteOp op, mlir::DictionaryAttr extraAttrs, typename mlir::PropertiesSelector< ConcreteOp >::type state)
mlir::ParseResult parseTemplateParams (mlir::AsmParser &parser, mlir::ArrayAttr &value)
void printTemplateParams (mlir::AsmPrinter &printer, mlir::ArrayAttr value)
void printTemplateParams (mlir::AsmPrinter &printer, void *, mlir::ArrayAttr value)
bool defaultLegalityCheck (const mlir::TypeConverter &tyConv, mlir::Operation *op)
 Check whether an op is legal with respect to the given type converter, including TypeAttr attributes (with special handling for FunctionType stored inside a TypeAttr).
template<typename OpClass, typename Rewriter, typename... Args>
OpClass replaceOpWithNewOp (Rewriter &rewriter, mlir::Operation *op, Args &&...args)
 Wrapper for PatternRewriter::replaceOpWithNewOp() that automatically copies discardable attributes (i.e., attributes other than those specifically defined as part of the op in ODS).
template<typename... AdditionalOpClasses>
mlir::RewritePatternSet newGeneralRewritePatternSet (mlir::TypeConverter &tyConv, mlir::MLIRContext *ctx, mlir::ConversionTarget &target)
 Return a new RewritePatternSet covering all LLZK op types that may contain a StructType.
mlir::LogicalResult alignStartingAt (component::StructDefOp root, mlir::SymbolTableCollection &tables, LightweightSignalEquivalenceAnalysis &equivalence)
mlir::Value rebuildExprInCompute (mlir::Value val, function::FuncDefOp computeFunc, mlir::OpBuilder &builder, llvm::DenseMap< mlir::Value, mlir::Value > &memo)
mlir::LogicalResult checkForAuxMemberConflicts (component::StructDefOp structDef, llvm::StringRef auxPrefix)
component::MemberDefOp addAuxMember (component::StructDefOp structDef, llvm::StringRef name)
unsigned getFeltDegree (mlir::Value val, llvm::DenseMap< mlir::Value, unsigned > &memo)
void replaceSubsequentUsesWith (mlir::Value oldVal, mlir::Value newVal, mlir::Operation *afterOp)
 Replaces all subsequent uses of oldVal with newVal, starting after afterOp.
void addRemoveUnnecessaryOpsAndDefsPipeline (mlir::OpPassManager &pm)
std::unique_ptr< mlir::Pass > createFlatteningPass ()
std::unique_ptr< mlir::Pass > createRedundantReadAndWriteEliminationPass ()
std::unique_ptr< mlir::Pass > createRedundantOperationEliminationPass ()
std::unique_ptr< mlir::Pass > createUnusedDeclarationEliminationPass ()
std::unique_ptr< mlir::Pass > createArrayToScalarPass ()
std::unique_ptr< mlir::Pass > createPolyLoweringPass ()
std::unique_ptr< mlir::Pass > createPolyLoweringPass (unsigned maxDegree)
std::unique_ptr< mlir::Pass > createInlineStructsPass ()
void registerInliningExtensions (mlir::DialectRegistry &registry)
void registerComputeConstrainToProductPass ()
void registerComputeConstrainToProductPassPass ()
void registerEnforceNoMemberOverwritePass ()
void registerEnforceNoMemberOverwritePassPass ()
void registerFuseProductLoopsPass ()
void registerFuseProductLoopsPassPass ()
void registerInlineStructsPass ()
void registerInlineStructsPassPass ()
void registerPolyLoweringPass ()
void registerPolyLoweringPassPass ()
void registerRedundantOperationEliminationPass ()
void registerRedundantOperationEliminationPassPass ()
void registerRedundantReadAndWriteEliminationPass ()
void registerRedundantReadAndWriteEliminationPassPass ()
void registerUnusedDeclarationEliminationPass ()
void registerUnusedDeclarationEliminationPassPass ()
void registerTransformationPasses ()
template<typename OpClass, typename... Args>
OpClass delegate_to_build (mlir::Location location, Args &&...args)
template<OpComparable Op>
mlir::FailureOr< bool > isLocationLess (const Op &l, const Op &r)
template<typename T, typename U>
constexpr T checkedCast (U u) noexcept
llvm::DynamicAPInt operator& (const llvm::DynamicAPInt &lhs, const llvm::DynamicAPInt &rhs)
llvm::DynamicAPInt operator| (const llvm::DynamicAPInt &lhs, const llvm::DynamicAPInt &rhs)
llvm::DynamicAPInt operator^ (const llvm::DynamicAPInt &lhs, const llvm::DynamicAPInt &rhs)
llvm::DynamicAPInt operator<< (const llvm::DynamicAPInt &lhs, const llvm::DynamicAPInt &rhs)
llvm::DynamicAPInt operator>> (const llvm::DynamicAPInt &lhs, const llvm::DynamicAPInt &rhs)
llvm::DynamicAPInt toDynamicAPInt (llvm::StringRef str)
llvm::DynamicAPInt toDynamicAPInt (const llvm::APSInt &i)
llvm::DynamicAPInt toDynamicAPInt (const llvm::APInt &i)
llvm::APSInt toAPSInt (const llvm::DynamicAPInt &i)
llvm::APInt toAPInt (const llvm::DynamicAPInt &i, unsigned bitWidth)
 Converts a DynamicAPInt that is non-negative and fits in bitWidth bits into an APInt.
llvm::DynamicAPInt modExp (const llvm::DynamicAPInt &base, const llvm::DynamicAPInt &exp, const llvm::DynamicAPInt &mod)
llvm::DynamicAPInt modInversePrime (const llvm::DynamicAPInt &f, const llvm::DynamicAPInt &p)
OwningEmitErrorFn getEmitOpErrFn (mlir::Operation *op)
template<typename OpImplClass>
OwningEmitErrorFn getEmitOpErrFn (OpImplClass *opImpl)
void ensure (bool condition, const llvm::Twine &errMsg)
OwningEmitErrorFn wrapNullableInFlightDiagnostic (llvm::function_ref< mlir::InFlightDiagnostic()> emitError, mlir::MLIRContext *ctx)
 If the given emitError is non-null, return it.
OwningEmitErrorFn wrapNonNullableInFlightDiagnostic (llvm::function_ref< mlir::InFlightDiagnostic()> emitError)
llvm::LogicalResult addSpecifiedFields (mlir::ModuleOp modOp)
 Update the set of available prime fields with the fields specified on the root module.
mlir::LogicalResult collectFields (mlir::Operation *root, FieldSet &fields, bool silent=true)
 Collects all the fields used in a circuit.
std::optional< std::reference_wrapper< const Field > > tryDetectSpecifiedField (mlir::Operation *root)
 Try to detect a uniquely used field from the enclosing LLZK module.
template<typename Func, typename... Args>
std::string buildStringViaCallback (Func &&appendFn, Args &&...args)
 Generate a string by calling the given appendFn with an llvm::raw_ostream & as the first argument followed by the additional Args provided (if any).
template<typename T, typename... Args>
std::string buildStringViaPrint (const T &base, Args &&...args)
 Generate a string by calling base.print(llvm::raw_ostream &) on a stream backed by the returned string.
template<typename... Args>
std::string buildStringViaInsertionOp (Args &&...args)
 Generate a string by using the insertion operator (<<) to append all args to a stream backed by the returned string.
llvm::SmallVector< mlir::StringRef > getNames (mlir::SymbolRefAttr ref)
llvm::SmallVector< mlir::FlatSymbolRefAttr > getPieces (mlir::SymbolRefAttr ref)
mlir::FlatSymbolRefAttr getFlatSymbolRefAttr (mlir::MLIRContext *context, const mlir::Twine &twine)
 Construct a FlatSymbolRefAttr with the given content.
mlir::SymbolRefAttr asSymbolRefAttr (mlir::StringAttr root, mlir::SymbolRefAttr tail)
 Build a SymbolRefAttr that prepends tail with root, i.e., root::tail.
mlir::SymbolRefAttr asSymbolRefAttr (llvm::ArrayRef< mlir::FlatSymbolRefAttr > path)
 Build a SymbolRefAttr from the list of pieces.
mlir::SymbolRefAttr asSymbolRefAttr (const std::vector< mlir::FlatSymbolRefAttr > &path)
 Build a SymbolRefAttr from the list of pieces.
mlir::SymbolRefAttr getTailAsSymbolRefAttr (mlir::SymbolRefAttr symbol)
 Return SymbolRefAttr like the one given but with the root/head element removed.
mlir::SymbolRefAttr getPrefixAsSymbolRefAttr (mlir::SymbolRefAttr symbol)
 Return SymbolRefAttr like the one given but with the leaf/final element removed.
mlir::SymbolRefAttr replaceLeaf (mlir::SymbolRefAttr orig, mlir::FlatSymbolRefAttr newLeaf)
 Return SymbolRefAttr like the one given but with the leaf (final) element replaced.
mlir::SymbolRefAttr replaceLeaf (mlir::SymbolRefAttr orig, mlir::StringAttr newLeaf)
mlir::SymbolRefAttr replaceLeaf (mlir::SymbolRefAttr orig, const mlir::Twine &newLeaf)
mlir::SymbolRefAttr appendLeaf (mlir::SymbolRefAttr orig, mlir::FlatSymbolRefAttr newLeaf)
 Return SymbolRefAttr like the one given but with a new leaf (final) element added.
mlir::SymbolRefAttr appendLeaf (mlir::SymbolRefAttr orig, mlir::StringAttr newLeaf)
mlir::SymbolRefAttr appendLeaf (mlir::SymbolRefAttr orig, const mlir::Twine &newLeaf)
mlir::SymbolRefAttr appendLeafName (mlir::SymbolRefAttr orig, const mlir::Twine &newLeafSuffix)
 Return SymbolRefAttr like the one given but with the leaf (final) element appended with the given suffix.
mlir::FailureOr< mlir::ModuleOp > getRootModule (mlir::Operation *from)
 Starting at the Operation from, find the nearest ancestor ModuleOp marked with LANG_ATTR_NAME from which symbol lookups are rooted.
mlir::FailureOr< mlir::SymbolRefAttr > getPathFromRoot (mlir::SymbolOpInterface to, mlir::ModuleOp *foundRoot=nullptr)
mlir::FailureOr< mlir::SymbolRefAttr > getPathFromRoot (component::StructDefOp &to, mlir::ModuleOp *foundRoot=nullptr)
mlir::FailureOr< mlir::SymbolRefAttr > getPathFromRoot (component::MemberDefOp &to, mlir::ModuleOp *foundRoot=nullptr)
mlir::FailureOr< mlir::SymbolRefAttr > getPathFromRoot (function::FuncDefOp &to, mlir::ModuleOp *foundRoot=nullptr)
mlir::FailureOr< mlir::ModuleOp > getTopRootModule (mlir::Operation *from)
 With include statements, there may be root modules nested within other root modules.
mlir::FailureOr< mlir::SymbolRefAttr > getPathFromTopRoot (mlir::SymbolOpInterface to, mlir::ModuleOp *foundRoot=nullptr)
mlir::FailureOr< mlir::SymbolRefAttr > getPathFromTopRoot (component::StructDefOp &to, mlir::ModuleOp *foundRoot=nullptr)
mlir::FailureOr< mlir::SymbolRefAttr > getPathFromTopRoot (component::MemberDefOp &to, mlir::ModuleOp *foundRoot=nullptr)
mlir::FailureOr< mlir::SymbolRefAttr > getPathFromTopRoot (function::FuncDefOp &to, mlir::ModuleOp *foundRoot=nullptr)
mlir::FailureOr< llzk::component::StructTypegetMainInstanceType (mlir::Operation *lookupFrom)
 Lookup the StructType of the main instance.
mlir::FailureOr< SymbolLookupResult< llzk::component::StructDefOp > > getMainInstanceDef (mlir::SymbolTableCollection &symbolTable, mlir::Operation *lookupFrom)
 Lookup the StructDefOp of the main instance.
template<typename T>
mlir::FailureOr< SymbolLookupResult< T > > resolveCallable (mlir::SymbolTableCollection &symbolTable, mlir::CallOpInterface call)
 Based on mlir::CallOpInterface::resolveCallable, but using LLZK lookup helpers.
template<typename T>
mlir::FailureOr< SymbolLookupResult< T > > resolveCallable (mlir::CallOpInterface call)
mlir::LogicalResult verifyParamOfType (mlir::SymbolTableCollection &tables, mlir::SymbolRefAttr param, mlir::Type structOrArrayType, mlir::Operation *origin)
 Ensure that the given symbol (that is used as a parameter of the given type) can be resolved.
mlir::LogicalResult verifyParamsOfType (mlir::SymbolTableCollection &tables, mlir::ArrayRef< mlir::Attribute > tyParams, mlir::Type structOrArrayType, mlir::Operation *origin)
 Ensure that any symbols that appear within the given attributes (that are parameters of the given type) can be resolved.
mlir::FailureOr< component::StructDefOpverifyStructTypeResolution (mlir::SymbolTableCollection &tables, component::StructType ty, mlir::Operation *origin)
 Ensure that all symbols used within the type can be resolved.
mlir::LogicalResult verifyTypeResolution (mlir::SymbolTableCollection &tables, mlir::Operation *origin, mlir::Type type)
 Ensure that all symbols used within the given Type instance can be resolved.
template<std::ranges::input_range Range>
mlir::LogicalResult verifyTypeResolution (mlir::SymbolTableCollection &tables, mlir::Operation *origin, const Range &types)
 Ensure that all symbols used within all Type instances can be resolved.
mlir::FailureOr< SymbolLookupResultUntypedlookupSymbolIn (mlir::SymbolTableCollection &tables, mlir::SymbolRefAttr symbol, Within &&lookupWithin, mlir::Operation *origin, bool reportMissing=true)
mlir::FailureOr< SymbolLookupResultUntypedlookupTopLevelSymbol (mlir::SymbolTableCollection &tables, mlir::SymbolRefAttr symbol, mlir::Operation *origin, bool reportMissing=true)
template<typename T>
mlir::FailureOr< SymbolLookupResult< T > > lookupSymbolIn (mlir::SymbolTableCollection &tables, mlir::SymbolRefAttr symbol, Within &&lookupWithin, mlir::Operation *origin, bool reportMissing=true)
template<typename T>
mlir::FailureOr< SymbolLookupResult< T > > lookupTopLevelSymbol (mlir::SymbolTableCollection &tables, mlir::SymbolRefAttr symbol, mlir::Operation *origin, bool reportMissing=true)
std::optional< mlir::SymbolTable::UseRange > getSymbolUses (mlir::Operation *from)
 Get an iterator range for all of the uses, for any symbol, that are nested within the given operation 'from'.
std::optional< mlir::SymbolTable::UseRange > getSymbolUses (mlir::Region *from)
std::optional< mlir::SymbolTable::UseRange > getSymbolUses (mlir::StringAttr symbol, mlir::Operation *from)
 Get all of the uses of the given symbol that are nested within the given operation 'from'.
std::optional< mlir::SymbolTable::UseRange > getSymbolUses (mlir::Operation *symbol, mlir::Operation *from)
std::optional< mlir::SymbolTable::UseRange > getSymbolUses (mlir::StringAttr symbol, mlir::Region *from)
std::optional< mlir::SymbolTable::UseRange > getSymbolUses (mlir::Operation *symbol, mlir::Region *from)
void getSymbolsUsedIn (mlir::Type t, llvm::SmallDenseSet< mlir::SymbolRefAttr > &symbolsUsed)
 Add all symbols used within the given Type to the provided set.
void getSymbolsUsedIn (mlir::ArrayRef< mlir::Type > types, llvm::SmallDenseSet< mlir::SymbolRefAttr > &symbolsUsed)
 Add all symbols used within the given Types to the provided set.
llvm::SmallDenseSet< mlir::SymbolRefAttr > getSymbolsUsedIn (mlir::Type t)
 Get all symbols used within the given Type.
llvm::SmallDenseSet< mlir::SymbolRefAttr > getSymbolsUsedIn (mlir::ArrayRef< mlir::Type > types)
 Get all symbols used within the given Types.
bool symbolKnownUseEmpty (mlir::StringAttr symbol, mlir::Operation *from)
 Return if the given symbol is known to have no uses that are nested within the given operation 'from'.
bool symbolKnownUseEmpty (mlir::Operation *symbol, mlir::Operation *from)
bool symbolKnownUseEmpty (mlir::StringAttr symbol, mlir::Region *from)
bool symbolKnownUseEmpty (mlir::Operation *symbol, mlir::Region *from)
mlir::StringAttr getSymbolName (mlir::Operation *symbol)
 Returns the name of the given symbol operation, or nullptr if no symbol is present.
mlir::StringAttr getSymbolName (mlir::SymbolOpInterface symbol)
void assertValidAttrForParamOfType (mlir::Attribute attr)
bool isValidType (mlir::Type type)
 valid types: {I1, Index, String, FeltType, StructType, ArrayType, TypeVarType, PodType}
bool isValidColumnType (mlir::Type type, mlir::SymbolTableCollection &symbolTable, mlir::Operation *op)
 valid types: {FeltType, StructType (with columns), ArrayType (that contains a valid column type), TypeVarType, PodType}
bool isValidGlobalType (mlir::Type type)
 valid types: isValidType() - {TypeVarType} - {types with variable parameters}
bool isValidEmitEqType (mlir::Type type)
 valid types: isValidType() - {String, StructType} (excluded via any type parameter nesting)
bool isValidConstReadType (mlir::Type type)
 valid types: {I1, Index, FeltType, TypeVarType}
bool isValidArrayElemType (mlir::Type type)
 valid types: isValidType() - {ArrayType}
bool isValidArrayType (mlir::Type type)
 Checks if the type is a LLZK Array and it also contains a valid LLZK type.
bool isConcreteType (mlir::Type type, bool allowStructParams=true)
 Return false if the type contains any of the following:
mlir::LogicalResult checkValidType (EmitErrorFn emitError, mlir::Type type)
bool hasAffineMapAttr (mlir::Type type)
 Return true iff the given type contains an AffineMapAttr.
Side reverse (Side in)
bool isDynamic (mlir::IntegerAttr intAttr)
uint64_t computeEmitEqCardinality (mlir::Type type)
 Compute the cardinality (i.e.
bool 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 template parameters.
bool 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 template parameters.
bool 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 template parameters.
bool 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 template parameters.
bool podTypesUnify (pod::PodType lhs, pod::PodType rhs, mlir::ArrayRef< llvm::StringRef > rhsReversePrefix={}, UnificationMap *unifications=nullptr)
 Return true iff the two PodType instances are equivalent or could be equivalent after full instantiation of template parameters.
bool functionTypesUnify (mlir::FunctionType lhs, mlir::FunctionType rhs, mlir::ArrayRef< llvm::StringRef > rhsReversePrefix={}, UnificationMap *unifications=nullptr)
 Return true iff the two FunctionType instances are equivalent or could be equivalent after full instantiation of template parameters.
bool 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 template parameters (if applicable within the given types).
template<typename Iter1, typename Iter2>
bool 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 template parameters (if applicable within the given types).
template<typename Iter1, typename Iter2>
bool singletonTypeListsUnify (Iter1 lhs, Iter2 rhs, mlir::ArrayRef< llvm::StringRef > rhsReversePrefix={}, UnificationMap *unifications=nullptr)
bool 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 getIfSingleton (mlir::TypeRange types)
template<typename TypeClass>
TypeClass getAtIndex (mlir::TypeRange types, size_t index)
mlir::FailureOr< mlir::IntegerAttr > forceIntType (mlir::IntegerAttr attr, EmitErrorFn emitError)
 Convert an IntegerAttr with a type other than IndexType to use IndexType.
mlir::FailureOr< mlir::Attribute > forceIntAttrType (mlir::Attribute attr, EmitErrorFn emitError)
 Convert any IntegerAttr with a type other than IndexType to use IndexType.
mlir::FailureOr< llvm::SmallVector< mlir::Attribute > > forceIntAttrTypes (llvm::ArrayRef< mlir::Attribute > attrList, EmitErrorFn emitError)
 Convert any IntegerAttr with a type other than IndexType to use IndexType.
mlir::LogicalResult verifyIntAttrType (EmitErrorFn emitError, mlir::Attribute in)
 Verify that all IntegerAttr have type IndexType.
mlir::LogicalResult verifyAffineMapAttrType (EmitErrorFn emitError, mlir::Attribute in)
 Verify that all AffineMapAttr only have a single result.
mlir::LogicalResult verifyStructTypeParams (EmitErrorFn emitError, mlir::ArrayAttr params)
 Verify that the StructType parameters are valid.
mlir::LogicalResult verifyArrayDimSizes (EmitErrorFn emitError, mlir::ArrayRef< mlir::Attribute > dimensionSizes)
 Verify that the array dimensions are valid.
mlir::LogicalResult verifyArrayType (EmitErrorFn emitError, mlir::Type elementType, mlir::ArrayRef< mlir::Attribute > dimensionSizes)
 Verify that the ArrayType is valid.
mlir::LogicalResult verifySubArrayOrElementType (EmitErrorFn emitError, array::ArrayType arrayType, mlir::Type subArrayOrElemType)
 Determine if the subArrayOrElemType is either a valid subarray of arrayType (see verifySubArrayType), or if subArrayOrElemType matches the element type of arrayType.
bool isFeltOrSimpleFeltAggregate (mlir::Type ty)
 Return true if the given type is a FeltType or a "simple" aggregate (i.e., ArrayType or PodType, not StructType) composed only of FeltType or nested FeltType aggregates.
bool isValidMainSignalType (mlir::Type pType)
 Return true if the given type is valid for signals (input arguments or outputs) of the main entry struct.
std::unique_ptr< mlir::Pass > createMemberWriteValidatorPass ()
void registerMemberWriteValidatorPass ()
void registerMemberWriteValidatorPassPass ()
void registerValidationPasses ()

Variables

constexpr int INDEX_WIDTH = 64
constexpr char FUNC_NAME_COMPUTE [] = "compute"
 Symbol name for the witness generation (and resp.
constexpr char FUNC_NAME_CONSTRAIN [] = "constrain"
constexpr char FUNC_NAME_PRODUCT [] = "product"
constexpr char LANG_ATTR_NAME [] = "llzk.lang"
 Name of the attribute on the top-level ModuleOp that identifies the ModuleOp as the root module and specifies the frontend language name that the IR was compiled from, if available.
constexpr char DERIVED_ATTR_NAME [] = "llzk.derived"
 Name of the attribute on a @product func that has been automatically aligned from @compute + @constrain funcs, or on @compute and @constrain funcs that have been automatically projected from a @product func.
constexpr char FIELD_ATTR_NAME [] = "llzk.fields"
 Name of the attribute on the top-level ModuleOp that defines prime fields used in the circuit.
constexpr char MAIN_ATTR_NAME [] = "llzk.main"
 Name of the attribute on the top-level ModuleOp that specifies the type of the main struct.
constexpr char PRODUCT_SOURCE [] = "product_source"
 Name of the attribute on aligned product program ops that specifies where they came from.

Typedef Documentation

◆ EmitErrorFn

using llzk::EmitErrorFn = llvm::function_ref<InFlightDiagnosticWrapper()>

Callback to produce an error diagnostic.

Definition at line 145 of file ErrorHelper.h.

◆ FieldRef

using llzk::FieldRef = std::reference_wrapper<const Field>

Typealias for a stable reference to a known Field.

Definition at line 152 of file Field.h.

◆ FieldSet

using llzk::FieldSet = llvm::SmallSet<FieldRef, 2>

Typealias for a set of Fields.

Definition at line 155 of file Field.h.

◆ ManagedResources

Initial value:
std::shared_ptr<std::pair<mlir::OwningOpRef<mlir::ModuleOp>, mlir::SymbolTableCollection>>

Definition at line 34 of file SymbolLookup.h.

◆ Overwrite

◆ OwningEmitErrorFn

This type is required in cases like the functions below to take ownership of the lambda so it is not destroyed upon return from the function.

It can be implicitly converted to EmitErrorFn.

Definition at line 149 of file ErrorHelper.h.

◆ SourceRefRemappings

using llzk::SourceRefRemappings = std::vector<std::pair<SourceRef, SourceRefLatticeValue>>

Definition at line 30 of file ConstraintDependencyGraph.h.

◆ TranslationMap

Definition at line 24 of file SourceRefLattice.h.

◆ UnificationMap

using llzk::UnificationMap = mlir::DenseMap<std::pair<mlir::SymbolRefAttr, Side>, mlir::Attribute>

Optional result from type unifications.

Maps SymbolRefAttr appearing in one type to the associated Attribute from the other type at the same nested position. The Side enum in the key indicates which input expression the SymbolRefAttr is from. Additionally, if a conflict is found (i.e., multiple Occurrences of a specific SymbolRefAttr on the same side map to different Attributes from the other side). The mapped value will be nullptr.

This map is used by the llzk-flatten pass to replace struct parameter SymbolRefAttr with static concrete values to produce the flattened versions of structs.

Definition at line 186 of file TypeHelper.h.

Enumeration Type Documentation

◆ OutputStream

enum class llzk::OutputStream : uint32_t
strong
Enumerator
Outs 
Errs 
Dbgs 

Definition at line 12 of file AnalysisPassEnums.h.inc.

◆ Side

enum class llzk::Side : std::uint8_t
strong
Enumerator
EMPTY 
LHS 
RHS 
TOMB 

Definition at line 125 of file TypeHelper.h.

Function Documentation

◆ add()

ExpressionValue llzk::add ( const llvm::SMTSolverRef & solver,
const ExpressionValue & lhs,
const ExpressionValue & rhs )

Definition at line 112 of file IntervalAnalysis.cpp.

◆ addAuxMember() [1/2]

component::MemberDefOp llzk::addAuxMember ( component::StructDefOp structDef,
llvm::StringRef name )

◆ addAuxMember() [2/2]

MemberDefOp llzk::addAuxMember ( StructDefOp structDef,
StringRef name )

Definition at line 121 of file LLZKLoweringUtils.cpp.

◆ addLangAttrForLLZKDialect() [1/2]

void llzk::addLangAttrForLLZKDialect ( mlir::ModuleOp mod)

◆ addLangAttrForLLZKDialect() [2/2]

void llzk::addLangAttrForLLZKDialect ( ModuleOp mod)

Definition at line 29 of file Builders.cpp.

◆ addRemoveUnnecessaryOpsAndDefsPipeline() [1/2]

void llzk::addRemoveUnnecessaryOpsAndDefsPipeline ( mlir::OpPassManager & pm)

◆ addRemoveUnnecessaryOpsAndDefsPipeline() [2/2]

void llzk::addRemoveUnnecessaryOpsAndDefsPipeline ( OpPassManager & pm)

Definition at line 32 of file LLZKTransformationPassPipelines.cpp.

◆ addSpecifiedFields() [1/2]

llvm::LogicalResult llzk::addSpecifiedFields ( mlir::ModuleOp modOp)

Update the set of available prime fields with the fields specified on the root module.

Parameters
modOpa ModuleOp in the circuit. The search for the field attribute begins at this module and continues until a field attribute is encountered. The operation is recursive as include operations introduce their own root modules, which may include new prime specifications.
Returns
Failure if the field attribute is malformed (i.e., is the wrong type of attribute).

◆ addSpecifiedFields() [2/2]

LogicalResult llzk::addSpecifiedFields ( ModuleOp modOp)

Definition at line 177 of file Field.cpp.

◆ alignStartingAt() [1/2]

mlir::LogicalResult llzk::alignStartingAt ( component::StructDefOp root,
mlir::SymbolTableCollection & tables,
LightweightSignalEquivalenceAnalysis & equivalence )

◆ alignStartingAt() [2/2]

LogicalResult llzk::alignStartingAt ( component::StructDefOp root,
SymbolTableCollection & tables,
LightweightSignalEquivalenceAnalysis & equivalence )

Definition at line 67 of file LLZKComputeConstrainToProductPass.cpp.

◆ analyzeStruct()

llvm::FailureOr< std::pair< llvm::SetVector< Overwrite >, FuzzySet > > llzk::analyzeStruct ( component::StructDefOp structDef)

Definition at line 101 of file MemberOverwriteAnalysis.cpp.

◆ appendLeaf() [1/4]

mlir::SymbolRefAttr llzk::appendLeaf ( mlir::SymbolRefAttr orig,
const mlir::Twine & newLeaf )
inline

Definition at line 80 of file SymbolHelper.h.

◆ appendLeaf() [2/4]

mlir::SymbolRefAttr llzk::appendLeaf ( mlir::SymbolRefAttr orig,
mlir::FlatSymbolRefAttr newLeaf )

Return SymbolRefAttr like the one given but with a new leaf (final) element added.

◆ appendLeaf() [3/4]

mlir::SymbolRefAttr llzk::appendLeaf ( mlir::SymbolRefAttr orig,
mlir::StringAttr newLeaf )
inline

Definition at line 77 of file SymbolHelper.h.

◆ appendLeaf() [4/4]

SymbolRefAttr llzk::appendLeaf ( SymbolRefAttr orig,
FlatSymbolRefAttr newLeaf )

Definition at line 255 of file SymbolHelper.cpp.

◆ appendLeafName() [1/2]

mlir::SymbolRefAttr llzk::appendLeafName ( mlir::SymbolRefAttr orig,
const mlir::Twine & newLeafSuffix )

Return SymbolRefAttr like the one given but with the leaf (final) element appended with the given suffix.

◆ appendLeafName() [2/2]

SymbolRefAttr llzk::appendLeafName ( SymbolRefAttr orig,
const Twine & newLeafSuffix )

Definition at line 259 of file SymbolHelper.cpp.

◆ appendWithoutType()

void llzk::appendWithoutType ( mlir::raw_ostream & os,
mlir::Attribute a )
inline

Definition at line 40 of file AttributeHelper.h.

◆ arrayTypesUnify() [1/2]

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 template parameters.

◆ arrayTypesUnify() [2/2]

bool llzk::arrayTypesUnify ( ArrayType lhs,
ArrayType rhs,
ArrayRef< StringRef > rhsReversePrefix,
UnificationMap * unifications )

Definition at line 898 of file TypeHelper.cpp.

◆ assertValidAttrForParamOfType() [1/2]

void llzk::assertValidAttrForParamOfType ( Attribute attr)

Definition at line 1034 of file TypeHelper.cpp.

◆ assertValidAttrForParamOfType() [2/2]

void llzk::assertValidAttrForParamOfType ( mlir::Attribute attr)

◆ asSymbolRefAttr() [1/3]

mlir::SymbolRefAttr llzk::asSymbolRefAttr ( const std::vector< mlir::FlatSymbolRefAttr > & path)
inline

Build a SymbolRefAttr from the list of pieces.

Definition at line 50 of file SymbolHelper.h.

◆ asSymbolRefAttr() [2/3]

mlir::SymbolRefAttr llzk::asSymbolRefAttr ( llvm::ArrayRef< mlir::FlatSymbolRefAttr > path)
inline

Build a SymbolRefAttr from the list of pieces.

Definition at line 45 of file SymbolHelper.h.

◆ asSymbolRefAttr() [3/3]

mlir::SymbolRefAttr llzk::asSymbolRefAttr ( mlir::StringAttr root,
mlir::SymbolRefAttr tail )
inline

Build a SymbolRefAttr that prepends tail with root, i.e., root::tail.

Definition at line 40 of file SymbolHelper.h.

◆ bitAnd()

ExpressionValue llzk::bitAnd ( const llvm::SMTSolverRef & solver,
const ExpressionValue & lhs,
const ExpressionValue & rhs )

Definition at line 224 of file IntervalAnalysis.cpp.

◆ bitOr()

ExpressionValue llzk::bitOr ( const llvm::SMTSolverRef & solver,
const ExpressionValue & lhs,
const ExpressionValue & rhs )

Definition at line 232 of file IntervalAnalysis.cpp.

◆ bitXor()

ExpressionValue llzk::bitXor ( const llvm::SMTSolverRef & solver,
const ExpressionValue & lhs,
const ExpressionValue & rhs )

Definition at line 240 of file IntervalAnalysis.cpp.

◆ boolAnd() [1/2]

Interval llzk::boolAnd ( const Interval & lhs,
const Interval & rhs )

Definition at line 681 of file Intervals.cpp.

◆ boolAnd() [2/2]

ExpressionValue llzk::boolAnd ( const llvm::SMTSolverRef & solver,
const ExpressionValue & lhs,
const ExpressionValue & rhs )

Definition at line 334 of file IntervalAnalysis.cpp.

◆ boolNot() [1/2]

Interval llzk::boolNot ( const Interval & iv)

Definition at line 741 of file Intervals.cpp.

◆ boolNot() [2/2]

ExpressionValue llzk::boolNot ( const llvm::SMTSolverRef & solver,
const ExpressionValue & val )

Definition at line 374 of file IntervalAnalysis.cpp.

◆ boolOr() [1/2]

Interval llzk::boolOr ( const Interval & lhs,
const Interval & rhs )

Definition at line 698 of file Intervals.cpp.

◆ boolOr() [2/2]

ExpressionValue llzk::boolOr ( const llvm::SMTSolverRef & solver,
const ExpressionValue & lhs,
const ExpressionValue & rhs )

Definition at line 342 of file IntervalAnalysis.cpp.

◆ boolToFelt()

ExpressionValue llzk::boolToFelt ( const llvm::SMTSolverRef & solver,
const ExpressionValue & expr,
unsigned bitwidth )

Definition at line 75 of file IntervalAnalysis.cpp.

◆ boolXor() [1/2]

Interval llzk::boolXor ( const Interval & lhs,
const Interval & rhs )

Definition at line 715 of file Intervals.cpp.

◆ boolXor() [2/2]

ExpressionValue llzk::boolXor ( const llvm::SMTSolverRef & solver,
const ExpressionValue & lhs,
const ExpressionValue & rhs )

Definition at line 350 of file IntervalAnalysis.cpp.

◆ buildStringViaCallback()

template<typename Func, typename... Args>
std::string llzk::buildStringViaCallback ( Func && appendFn,
Args &&... args )
inline

Generate a string by calling the given appendFn with an llvm::raw_ostream & as the first argument followed by the additional Args provided (if any).

Definition at line 41 of file StreamHelper.h.

◆ buildStringViaInsertionOp()

template<typename... Args>
std::string llzk::buildStringViaInsertionOp ( Args &&... args)
inline

Generate a string by using the insertion operator (<<) to append all args to a stream backed by the returned string.

Definition at line 59 of file StreamHelper.h.

◆ buildStringViaPrint()

template<typename T, typename... Args>
std::string llzk::buildStringViaPrint ( const T & base,
Args &&... args )
inline

Generate a string by calling base.print(llvm::raw_ostream &) on a stream backed by the returned string.

Definition at line 51 of file StreamHelper.h.

◆ checkedCast()

template<typename T, typename U>
T llzk::checkedCast ( U u)
constexprnoexcept

Definition at line 81 of file Compare.h.

◆ checkFields()

const Field & llzk::checkFields ( const Interval & lhs,
const Interval & rhs )

Definition at line 150 of file Intervals.cpp.

◆ checkForAuxMemberConflicts() [1/2]

mlir::LogicalResult llzk::checkForAuxMemberConflicts ( component::StructDefOp structDef,
llvm::StringRef auxPrefix )

◆ checkForAuxMemberConflicts() [2/2]

LogicalResult llzk::checkForAuxMemberConflicts ( StructDefOp structDef,
StringRef prefix )

Definition at line 87 of file LLZKLoweringUtils.cpp.

◆ checkValidType()

mlir::LogicalResult llzk::checkValidType ( EmitErrorFn emitError,
mlir::Type type )
inline

Definition at line 114 of file TypeHelper.h.

◆ cmp()

ExpressionValue llzk::cmp ( const llvm::SMTSolverRef & solver,
boolean::CmpOp op,
const ExpressionValue & lhs,
const ExpressionValue & rhs )

Definition at line 270 of file IntervalAnalysis.cpp.

◆ collectFields()

LogicalResult llzk::collectFields ( mlir::Operation * root,
llzk::FieldSet & fields,
bool silent = true )

Collects all the fields used in a circuit.

Parameters
rootTakes the operation as root and inspects any FeltType for its Field.
fieldsDestination where fields are written into.
silentDoes not report warnings if set.
Returns
Failure if any FeltType does not specify a field.

Definition at line 248 of file Field.cpp.

◆ computeEmitEqCardinality() [1/2]

uint64_t llzk::computeEmitEqCardinality ( mlir::Type type)

Compute the cardinality (i.e.

number of scalar constraints) for an EmitEqualityOp type since the op can be used to constrain two same-size arrays.

◆ computeEmitEqCardinality() [2/2]

uint64_t llzk::computeEmitEqCardinality ( Type type)

Definition at line 567 of file TypeHelper.cpp.

◆ create()

template<typename OpTy, typename... Args>
mlir::Operation * llzk::create ( MlirOpBuilder cBuilder,
MlirLocation cLocation,
Args &&... args )

Creates a new operation using an ODS build method.

Definition at line 41 of file Builder.h.

◆ createArrayToScalarPass()

std::unique_ptr< mlir::Pass > llzk::createArrayToScalarPass ( )

◆ createCallGraphPrinterPass()

std::unique_ptr< mlir::Pass > llzk::createCallGraphPrinterPass ( llvm::raw_ostream & os = llvm::errs())

Definition at line 50 of file CallGraphPasses.cpp.

◆ createCallGraphSCCsPrinterPass()

std::unique_ptr< mlir::Pass > llzk::createCallGraphSCCsPrinterPass ( llvm::raw_ostream & os = llvm::errs())

Definition at line 95 of file CallGraphPasses.cpp.

◆ createComputeConstrainToProductPass()

std::unique_ptr< mlir::Pass > llzk::createComputeConstrainToProductPass ( )

Definition at line 256 of file LLZKComputeConstrainToProductPass.cpp.

◆ createConstraintDependencyGraphPrinterPass()

std::unique_ptr< mlir::Pass > llzk::createConstraintDependencyGraphPrinterPass ( llvm::raw_ostream & os = llvm::errs())

Definition at line 69 of file ConstraintDependencyGraphPass.cpp.

◆ createFieldInverseExpr()

llvm::SMTExprRef llzk::createFieldInverseExpr ( const llvm::SMTSolverRef & solver,
Operation * op,
const ExpressionValue & val,
StringRef suffix = "" )

Definition at line 36 of file IntervalAnalysis.cpp.

◆ createFlatteningPass()

std::unique_ptr< mlir::Pass > llzk::createFlatteningPass ( )

◆ createFuseProductLoopsPass()

std::unique_ptr< mlir::Pass > llzk::createFuseProductLoopsPass ( )

Definition at line 176 of file LLZKFuseProductLoopsPass.cpp.

◆ createInlineStructsPass()

std::unique_ptr< mlir::Pass > llzk::createInlineStructsPass ( )

Definition at line 1090 of file LLZKInlineStructsPass.cpp.

◆ createIntervalAnalysisPrinterPass()

std::unique_ptr< mlir::Pass > llzk::createIntervalAnalysisPrinterPass ( llvm::raw_ostream & os = llvm::errs())

Definition at line 110 of file IntervalAnalysisPass.cpp.

◆ createLLZKModule() [1/3]

mlir::OwningOpRef< mlir::ModuleOp > llzk::createLLZKModule ( mlir::MLIRContext * context)
inline

Definition at line 29 of file Builders.h.

◆ createLLZKModule() [2/3]

mlir::OwningOpRef< mlir::ModuleOp > llzk::createLLZKModule ( mlir::MLIRContext * context,
mlir::Location loc )

◆ createLLZKModule() [3/3]

OwningOpRef< ModuleOp > llzk::createLLZKModule ( MLIRContext * ,
Location loc )

Definition at line 23 of file Builders.cpp.

◆ createMemberWriteValidatorPass()

std::unique_ptr< mlir::Pass > llzk::createMemberWriteValidatorPass ( )

Definition at line 65 of file LLZKValidationPasses.cpp.

◆ createNoOverwritesPass()

std::unique_ptr< mlir::Pass > llzk::createNoOverwritesPass ( )

Definition at line 68 of file LLZKEnforceNoOverwritePass.cpp.

◆ createPolyLoweringPass() [1/2]

std::unique_ptr< mlir::Pass > llzk::createPolyLoweringPass ( )

Definition at line 335 of file LLZKPolyLoweringPass.cpp.

◆ createPolyLoweringPass() [2/2]

std::unique_ptr< mlir::Pass > llzk::createPolyLoweringPass ( unsigned maxDegree)

Definition at line 339 of file LLZKPolyLoweringPass.cpp.

◆ createPredecessorPrinterPass()

std::unique_ptr< mlir::Pass > llzk::createPredecessorPrinterPass ( )

Definition at line 244 of file PredecessorAnalysisPass.cpp.

◆ createRedundantOperationEliminationPass()

std::unique_ptr< mlir::Pass > llzk::createRedundantOperationEliminationPass ( )

Definition at line 285 of file LLZKRedundantOperationEliminationPass.cpp.

◆ createRedundantReadAndWriteEliminationPass()

std::unique_ptr< mlir::Pass > llzk::createRedundantReadAndWriteEliminationPass ( )

◆ createSymbolDefTreePrinterPass()

std::unique_ptr< mlir::Pass > llzk::createSymbolDefTreePrinterPass ( )

Definition at line 42 of file SymbolDefTreePass.cpp.

◆ createSymbolUseGraphPrinterPass()

std::unique_ptr< mlir::Pass > llzk::createSymbolUseGraphPrinterPass ( )

Definition at line 42 of file SymbolUseGraphPass.cpp.

◆ createUnusedDeclarationEliminationPass()

std::unique_ptr< mlir::Pass > llzk::createUnusedDeclarationEliminationPass ( )

Definition at line 234 of file LLZKUnusedDeclarationEliminationPass.cpp.

◆ defaultLegalityCheck()

bool llzk::defaultLegalityCheck ( const mlir::TypeConverter & tyConv,
mlir::Operation * op )
inline

Check whether an op is legal with respect to the given type converter, including TypeAttr attributes (with special handling for FunctionType stored inside a TypeAttr).

Definition at line 43 of file TypeConversionPatterns.h.

◆ delegate_to_build()

template<typename OpClass, typename... Args>
OpClass llzk::delegate_to_build ( mlir::Location location,
Args &&... args )
inline

Definition at line 18 of file BuilderHelper.h.

◆ div()

ExpressionValue llzk::div ( const llvm::SMTSolverRef & solver,
Operation * op,
const ExpressionValue & lhs,
const ExpressionValue & rhs )

Definition at line 136 of file IntervalAnalysis.cpp.

◆ ensure()

void llzk::ensure ( bool condition,
const llvm::Twine & errMsg )
inline

Definition at line 159 of file ErrorHelper.h.

◆ fallbackUnaryOp()

ExpressionValue llzk::fallbackUnaryOp ( const llvm::SMTSolverRef & solver,
Operation * op,
const ExpressionValue & val )

Definition at line 382 of file IntervalAnalysis.cpp.

◆ feltDiv()

mlir::FailureOr< Interval > llzk::feltDiv ( const Interval & lhs,
const Interval & rhs )

Computes finite-field division by multiplying the dividend by the multiplicative inverse of the divisor.

Only non-zero Degenerate divisors are supported. Supporting arbitrary divisor intervals soundly would require considering the inverse of every possible divisor value and joining the results, which is too expensive for this analysis.

Definition at line 486 of file Intervals.cpp.

◆ forceIntAttrType() [1/2]

FailureOr< Attribute > llzk::forceIntAttrType ( Attribute attr,
EmitErrorFn emitError )

Definition at line 968 of file TypeHelper.cpp.

◆ forceIntAttrType() [2/2]

mlir::FailureOr< mlir::Attribute > llzk::forceIntAttrType ( mlir::Attribute attr,
EmitErrorFn emitError )

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

◆ forceIntAttrTypes() [1/2]

FailureOr< SmallVector< Attribute > > llzk::forceIntAttrTypes ( ArrayRef< Attribute > attrList,
EmitErrorFn emitError )

Definition at line 976 of file TypeHelper.cpp.

◆ forceIntAttrTypes() [2/2]

mlir::FailureOr< llvm::SmallVector< mlir::Attribute > > llzk::forceIntAttrTypes ( llvm::ArrayRef< mlir::Attribute > attrList,
EmitErrorFn emitError )

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

◆ forceIntType() [1/2]

FailureOr< IntegerAttr > llzk::forceIntType ( IntegerAttr attr,
EmitErrorFn emitError )

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

Definition at line 952 of file TypeHelper.cpp.

◆ forceIntType() [2/2]

mlir::FailureOr< mlir::IntegerAttr > llzk::forceIntType ( mlir::IntegerAttr attr,
EmitErrorFn emitError )

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

Definition at line 952 of file TypeHelper.cpp.

◆ fromAPInt()

int64_t llzk::fromAPInt ( const llvm::APInt & i)
inline

Definition at line 34 of file AttributeHelper.h.

◆ functionTypesUnify() [1/2]

bool llzk::functionTypesUnify ( FunctionType lhs,
FunctionType rhs,
ArrayRef< StringRef > rhsReversePrefix,
UnificationMap * unifications )

Definition at line 917 of file TypeHelper.cpp.

◆ functionTypesUnify() [2/2]

bool llzk::functionTypesUnify ( mlir::FunctionType lhs,
mlir::FunctionType rhs,
mlir::ArrayRef< llvm::StringRef > rhsReversePrefix = {},
UnificationMap * unifications = nullptr )

Return true iff the two FunctionType instances are equivalent or could be equivalent after full instantiation of template parameters.

◆ fuseMatchingLoopPairs()

mlir::LogicalResult llzk::fuseMatchingLoopPairs ( mlir::Region & body,
mlir::MLIRContext * context )

Identify pairs of scf.for loops that can be fused, fuse them, and then recurse to fuse nested loops.

Definition at line 135 of file LLZKFuseProductLoopsPass.cpp.

◆ getAllChildren() [1/2]

std::vector< SourceRef > llzk::getAllChildren ( SymbolTableCollection & ,
ModuleOp ,
ArrayType arrayTy,
const SourceRef & root )

Definition at line 369 of file SourceRef.cpp.

◆ getAllChildren() [2/2]

std::vector< SourceRef > llzk::getAllChildren ( SymbolTableCollection & tables,
ModuleOp mod,
SymbolLookupResult< StructDefOp > structDefRes,
const SourceRef & root )

Definition at line 383 of file SourceRef.cpp.

◆ getAtIndex()

template<typename TypeClass>
TypeClass llzk::getAtIndex ( mlir::TypeRange types,
size_t index )
inline

Definition at line 274 of file TypeHelper.h.

◆ getCheckRegisteredInfo()

template<typename OpT>
mlir::RegisteredOperationName llzk::getCheckRegisteredInfo ( mlir::MLIRContext * ctx)

Definition at line 24 of file Builder.h.

◆ getEmitOpErrFn() [1/2]

OwningEmitErrorFn llzk::getEmitOpErrFn ( mlir::Operation * op)
inline

Definition at line 151 of file ErrorHelper.h.

◆ getEmitOpErrFn() [2/2]

template<typename OpImplClass>
OwningEmitErrorFn llzk::getEmitOpErrFn ( OpImplClass * opImpl)
inline

Definition at line 155 of file ErrorHelper.h.

◆ getFeltDegree() [1/2]

unsigned llzk::getFeltDegree ( mlir::Value val,
llvm::DenseMap< mlir::Value, unsigned > & memo )

◆ getFeltDegree() [2/2]

unsigned llzk::getFeltDegree ( Value val,
DenseMap< Value, unsigned > & memo )

Definition at line 129 of file LLZKLoweringUtils.cpp.

◆ getFlatSymbolRefAttr()

mlir::FlatSymbolRefAttr llzk::getFlatSymbolRefAttr ( mlir::MLIRContext * context,
const mlir::Twine & twine )
inline

Construct a FlatSymbolRefAttr with the given content.

Definition at line 35 of file SymbolHelper.h.

◆ getIfSingleton()

template<typename TypeClass>
TypeClass llzk::getIfSingleton ( mlir::TypeRange types)
inline

Definition at line 270 of file TypeHelper.h.

◆ getMainInstanceDef() [1/2]

mlir::FailureOr< SymbolLookupResult< llzk::component::StructDefOp > > llzk::getMainInstanceDef ( mlir::SymbolTableCollection & symbolTable,
mlir::Operation * lookupFrom )

Lookup the StructDefOp of the main instance.

This is specified by a TypeAttr on the top-level module with the key LLZK_MAIN_ATTR_NAME and is optional, in which case the result will be success(nullptr).

◆ getMainInstanceDef() [2/2]

FailureOr< SymbolLookupResult< StructDefOp > > llzk::getMainInstanceDef ( SymbolTableCollection & symbolTable,
Operation * lookupFrom )

Definition at line 349 of file SymbolHelper.cpp.

◆ getMainInstanceType() [1/2]

mlir::FailureOr< llzk::component::StructType > llzk::getMainInstanceType ( mlir::Operation * lookupFrom)

Lookup the StructType of the main instance.

This is specified by a TypeAttr on the top-level module with the key LLZK_MAIN_ATTR_NAME and is optional, in which case the result will be success(nullptr).

◆ getMainInstanceType() [2/2]

FailureOr< StructType > llzk::getMainInstanceType ( Operation * lookupFrom)

Definition at line 324 of file SymbolHelper.cpp.

◆ getMaxEnumValForOutputStream()

unsigned llzk::getMaxEnumValForOutputStream ( )
inlineconstexpr

Definition at line 21 of file AnalysisPassEnums.h.inc.

◆ getNames() [1/2]

llvm::SmallVector< mlir::StringRef > llzk::getNames ( mlir::SymbolRefAttr ref)

◆ getNames() [2/2]

llvm::SmallVector< StringRef > llzk::getNames ( SymbolRefAttr ref)

Definition at line 213 of file SymbolHelper.cpp.

◆ getOperationName()

template<typename OpClass>
llvm::StringLiteral llzk::getOperationName ( )
inline

Get the operation name, like "constrain.eq" for the given OpClass.

This function can be used when the compiler would complain about incomplete types if OpClass::getOperationName() were called directly.

Definition at line 51 of file OpHelpers.h.

◆ getParentOfType()

template<typename OpClass>
OpClass llzk::getParentOfType ( mlir::Operation * op)
inline

Return the closest surrounding parent operation that is of type 'OpClass'.

Definition at line 69 of file OpHelpers.h.

◆ getPathFromRoot() [1/9]

mlir::FailureOr< mlir::SymbolRefAttr > llzk::getPathFromRoot ( component::MemberDefOp & to,
mlir::ModuleOp * foundRoot = nullptr )

◆ getPathFromRoot() [2/9]

mlir::FailureOr< mlir::SymbolRefAttr > llzk::getPathFromRoot ( component::StructDefOp & to,
mlir::ModuleOp * foundRoot = nullptr )

◆ getPathFromRoot() [3/9]

FailureOr< SymbolRefAttr > llzk::getPathFromRoot ( FuncDefOp & to,
ModuleOp * foundRoot )

Definition at line 295 of file SymbolHelper.cpp.

◆ getPathFromRoot() [4/9]

mlir::FailureOr< mlir::SymbolRefAttr > llzk::getPathFromRoot ( function::FuncDefOp & to,
mlir::ModuleOp * foundRoot = nullptr )

◆ getPathFromRoot() [5/9]

FailureOr< SymbolRefAttr > llzk::getPathFromRoot ( MemberDefOp & to,
ModuleOp * foundRoot )

Definition at line 291 of file SymbolHelper.cpp.

◆ getPathFromRoot() [6/9]

mlir::FailureOr< mlir::SymbolRefAttr > llzk::getPathFromRoot ( mlir::SymbolOpInterface to,
mlir::ModuleOp * foundRoot = nullptr )

◆ getPathFromRoot() [7/9]

FailureOr< SymbolRefAttr > llzk::getPathFromRoot ( StructDefOp & to,
ModuleOp * foundRoot )

Definition at line 287 of file SymbolHelper.cpp.

◆ getPathFromRoot() [8/9]

FailureOr< SymbolRefAttr > llzk::getPathFromRoot ( SymbolOpInterface to,
ModuleOp * foundRoot )

Definition at line 279 of file SymbolHelper.cpp.

◆ getPathFromRoot() [9/9]

FailureOr< SymbolRefAttr > llzk::getPathFromRoot ( TemplateOp & to,
ModuleOp * foundRoot )

Definition at line 283 of file SymbolHelper.cpp.

◆ getPathFromTopRoot() [1/9]

mlir::FailureOr< mlir::SymbolRefAttr > llzk::getPathFromTopRoot ( component::MemberDefOp & to,
mlir::ModuleOp * foundRoot = nullptr )

◆ getPathFromTopRoot() [2/9]

mlir::FailureOr< mlir::SymbolRefAttr > llzk::getPathFromTopRoot ( component::StructDefOp & to,
mlir::ModuleOp * foundRoot = nullptr )

◆ getPathFromTopRoot() [3/9]

FailureOr< SymbolRefAttr > llzk::getPathFromTopRoot ( FuncDefOp & to,
ModuleOp * foundRoot )

Definition at line 320 of file SymbolHelper.cpp.

◆ getPathFromTopRoot() [4/9]

mlir::FailureOr< mlir::SymbolRefAttr > llzk::getPathFromTopRoot ( function::FuncDefOp & to,
mlir::ModuleOp * foundRoot = nullptr )

◆ getPathFromTopRoot() [5/9]

FailureOr< SymbolRefAttr > llzk::getPathFromTopRoot ( MemberDefOp & to,
ModuleOp * foundRoot )

Definition at line 316 of file SymbolHelper.cpp.

◆ getPathFromTopRoot() [6/9]

mlir::FailureOr< mlir::SymbolRefAttr > llzk::getPathFromTopRoot ( mlir::SymbolOpInterface to,
mlir::ModuleOp * foundRoot = nullptr )

◆ getPathFromTopRoot() [7/9]

FailureOr< SymbolRefAttr > llzk::getPathFromTopRoot ( StructDefOp & to,
ModuleOp * foundRoot )

Definition at line 312 of file SymbolHelper.cpp.

◆ getPathFromTopRoot() [8/9]

FailureOr< SymbolRefAttr > llzk::getPathFromTopRoot ( SymbolOpInterface to,
ModuleOp * foundRoot )

Definition at line 304 of file SymbolHelper.cpp.

◆ getPathFromTopRoot() [9/9]

FailureOr< SymbolRefAttr > llzk::getPathFromTopRoot ( TemplateOp & to,
ModuleOp * foundRoot )

Definition at line 308 of file SymbolHelper.cpp.

◆ getPieces() [1/2]

llvm::SmallVector< mlir::FlatSymbolRefAttr > llzk::getPieces ( mlir::SymbolRefAttr ref)

◆ getPieces() [2/2]

llvm::SmallVector< FlatSymbolRefAttr > llzk::getPieces ( SymbolRefAttr ref)

Definition at line 222 of file SymbolHelper.cpp.

◆ getPrefixAsSymbolRefAttr()

mlir::SymbolRefAttr llzk::getPrefixAsSymbolRefAttr ( mlir::SymbolRefAttr symbol)
inline

Return SymbolRefAttr like the one given but with the leaf/final element removed.

Definition at line 60 of file SymbolHelper.h.

◆ getRootModule() [1/2]

mlir::FailureOr< mlir::ModuleOp > llzk::getRootModule ( mlir::Operation * from)

Starting at the Operation from, find the nearest ancestor ModuleOp marked with LANG_ATTR_NAME from which symbol lookups are rooted.

◆ getRootModule() [2/2]

FailureOr< ModuleOp > llzk::getRootModule ( Operation * from)

Definition at line 274 of file SymbolHelper.cpp.

◆ getSelfOrParentOfType()

template<typename OpClass>
OpClass llzk::getSelfOrParentOfType ( mlir::Operation * op)
inline

Return the closest operation that is of type 'OpClass', either the op itself or an ancestor.

Definition at line 56 of file OpHelpers.h.

◆ getStructDef()

SymbolLookupResult< StructDefOp > llzk::getStructDef ( SymbolTableCollection & tables,
ModuleOp mod,
StructType ty )

Lookup a StructDefOp from a given StructType.

Parameters
tables
mod
ty
Returns
A SymbolLookupResult for the StructDefOp found. Note that returning the lookup result is important, as it may manage a ModuleOp if the struct is found via an include.

Definition at line 223 of file SourceRef.cpp.

◆ getSymbolName() [1/2]

mlir::StringAttr llzk::getSymbolName ( mlir::Operation * symbol)

Returns the name of the given symbol operation, or nullptr if no symbol is present.

◆ getSymbolName() [2/2]

mlir::StringAttr llzk::getSymbolName ( mlir::SymbolOpInterface symbol)
inline

Definition at line 70 of file SymbolTableLLZK.h.

◆ getSymbolsUsedIn() [1/4]

llvm::SmallDenseSet< mlir::SymbolRefAttr > llzk::getSymbolsUsedIn ( mlir::ArrayRef< mlir::Type > types)

Get all symbols used within the given Types.

◆ getSymbolsUsedIn() [2/4]

void llzk::getSymbolsUsedIn ( mlir::ArrayRef< mlir::Type > types,
llvm::SmallDenseSet< mlir::SymbolRefAttr > & symbolsUsed )

Add all symbols used within the given Types to the provided set.

◆ getSymbolsUsedIn() [3/4]

llvm::SmallDenseSet< mlir::SymbolRefAttr > llzk::getSymbolsUsedIn ( mlir::Type t)

Get all symbols used within the given Type.

◆ getSymbolsUsedIn() [4/4]

void llzk::getSymbolsUsedIn ( mlir::Type t,
llvm::SmallDenseSet< mlir::SymbolRefAttr > & symbolsUsed )

Add all symbols used within the given Type to the provided set.

◆ getSymbolUses() [1/6]

std::optional< mlir::SymbolTable::UseRange > llzk::getSymbolUses ( mlir::Operation * from)

Get an iterator range for all of the uses, for any symbol, that are nested within the given operation 'from'.

This does not traverse into any nested symbol tables. This function returns std::nullopt if there are any unknown operations that may potentially be symbol tables.

◆ getSymbolUses() [2/6]

std::optional< mlir::SymbolTable::UseRange > llzk::getSymbolUses ( mlir::Operation * symbol,
mlir::Operation * from )

◆ getSymbolUses() [3/6]

std::optional< mlir::SymbolTable::UseRange > llzk::getSymbolUses ( mlir::Operation * symbol,
mlir::Region * from )

◆ getSymbolUses() [4/6]

std::optional< mlir::SymbolTable::UseRange > llzk::getSymbolUses ( mlir::Region * from)

◆ getSymbolUses() [5/6]

std::optional< mlir::SymbolTable::UseRange > llzk::getSymbolUses ( mlir::StringAttr symbol,
mlir::Operation * from )

Get all of the uses of the given symbol that are nested within the given operation 'from'.

This does not traverse into any nested symbol tables. This function returns std::nullopt if there are any unknown operations that may potentially be symbol tables.

◆ getSymbolUses() [6/6]

std::optional< mlir::SymbolTable::UseRange > llzk::getSymbolUses ( mlir::StringAttr symbol,
mlir::Region * from )

◆ getTailAsSymbolRefAttr()

mlir::SymbolRefAttr llzk::getTailAsSymbolRefAttr ( mlir::SymbolRefAttr symbol)
inline

Return SymbolRefAttr like the one given but with the root/head element removed.

Definition at line 55 of file SymbolHelper.h.

◆ getTopRootModule() [1/2]

mlir::FailureOr< mlir::ModuleOp > llzk::getTopRootModule ( mlir::Operation * from)

With include statements, there may be root modules nested within other root modules.

This function resolves the topmost root module.

◆ getTopRootModule() [2/2]

FailureOr< ModuleOp > llzk::getTopRootModule ( Operation * from)

Definition at line 299 of file SymbolHelper.cpp.

◆ getUnknownLoc()

mlir::Location llzk::getUnknownLoc ( mlir::MLIRContext * context)
inline

Definition at line 23 of file Builders.h.

◆ hasAffineMapAttr() [1/2]

bool llzk::hasAffineMapAttr ( mlir::Type type)

Return true iff the given type contains an AffineMapAttr.

◆ hasAffineMapAttr() [2/2]

bool llzk::hasAffineMapAttr ( Type type)

Definition at line 556 of file TypeHelper.cpp.

◆ hasCycle()

template<typename GraphT>
bool llzk::hasCycle ( const GraphT & G)
inline

Definition at line 17 of file GraphUtil.h.

◆ intersection()

ExpressionValue llzk::intersection ( const llvm::SMTSolverRef & solver,
const ExpressionValue & lhs,
const ExpressionValue & rhs )
Parameters
solver
lhs
rhs
Returns

Definition at line 103 of file IntervalAnalysis.cpp.

◆ isConcreteType() [1/2]

bool llzk::isConcreteType ( mlir::Type type,
bool allowStructParams = true )

Return false if the type contains any of the following:

◆ isConcreteType() [2/2]

bool llzk::isConcreteType ( Type type,
bool allowStructParams )

Definition at line 552 of file TypeHelper.cpp.

◆ isDynamic() [1/2]

bool llzk::isDynamic ( IntegerAttr intAttr)

Definition at line 565 of file TypeHelper.cpp.

◆ isDynamic() [2/2]

bool llzk::isDynamic ( mlir::IntegerAttr intAttr)

Definition at line 565 of file TypeHelper.cpp.

◆ isFeltOrSimpleFeltAggregate() [1/2]

bool llzk::isFeltOrSimpleFeltAggregate ( mlir::Type ty)

Return true if the given type is a FeltType or a "simple" aggregate (i.e., ArrayType or PodType, not StructType) composed only of FeltType or nested FeltType aggregates.

◆ isFeltOrSimpleFeltAggregate() [2/2]

bool llzk::isFeltOrSimpleFeltAggregate ( Type ty)

Definition at line 1100 of file TypeHelper.cpp.

◆ isLocationLess()

template<OpComparable Op>
mlir::FailureOr< bool > llzk::isLocationLess ( const Op & l,
const Op & r )

Definition at line 49 of file Compare.h.

◆ isMoreConcreteUnification() [1/2]

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.

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.

◆ isMoreConcreteUnification() [2/2]

bool llzk::isMoreConcreteUnification ( Type oldTy,
Type newTy,
llvm::function_ref< bool(Type oldTy, Type newTy)> knownOldToNew )

Definition at line 930 of file TypeHelper.cpp.

◆ isNullOrEmpty() [1/3]

bool llzk::isNullOrEmpty ( mlir::ArrayAttr a)
inline

Definition at line 36 of file AttributeHelper.h.

◆ isNullOrEmpty() [2/3]

bool llzk::isNullOrEmpty ( mlir::DenseArrayAttr a)
inline

Definition at line 37 of file AttributeHelper.h.

◆ isNullOrEmpty() [3/3]

bool llzk::isNullOrEmpty ( mlir::DictionaryAttr a)
inline

Definition at line 38 of file AttributeHelper.h.

◆ isValidArrayElemType() [1/2]

bool llzk::isValidArrayElemType ( mlir::Type type)

valid types: isValidType() - {ArrayType}

◆ isValidArrayElemType() [2/2]

bool llzk::isValidArrayElemType ( Type type)

Definition at line 548 of file TypeHelper.cpp.

◆ isValidArrayType() [1/2]

bool llzk::isValidArrayType ( mlir::Type type)

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

◆ isValidArrayType() [2/2]

bool llzk::isValidArrayType ( Type type)

Definition at line 550 of file TypeHelper.cpp.

◆ isValidColumnType() [1/2]

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), TypeVarType, PodType}

◆ isValidColumnType() [2/2]

bool llzk::isValidColumnType ( Type type,
SymbolTableCollection & symbolTable,
Operation * op )

Definition at line 533 of file TypeHelper.cpp.

◆ isValidConstReadType() [1/2]

bool llzk::isValidConstReadType ( mlir::Type type)

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

◆ isValidConstReadType() [2/2]

bool llzk::isValidConstReadType ( Type type)

Definition at line 544 of file TypeHelper.cpp.

◆ isValidEmitEqType() [1/2]

bool llzk::isValidEmitEqType ( mlir::Type type)

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

◆ isValidEmitEqType() [2/2]

bool llzk::isValidEmitEqType ( Type type)

Definition at line 539 of file TypeHelper.cpp.

◆ isValidGlobalType() [1/2]

bool llzk::isValidGlobalType ( mlir::Type type)

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

◆ isValidGlobalType() [2/2]

bool llzk::isValidGlobalType ( Type type)

Definition at line 537 of file TypeHelper.cpp.

◆ isValidMainSignalType() [1/2]

bool llzk::isValidMainSignalType ( mlir::Type pType)

Return true if the given type is valid for signals (input arguments or outputs) of the main entry struct.

Only plain FeltTypes and ArrayTypes with FeltType elements are allowed.

◆ isValidMainSignalType() [2/2]

bool llzk::isValidMainSignalType ( Type pType)

Definition at line 1116 of file TypeHelper.cpp.

◆ isValidRoot()

bool llzk::isValidRoot ( StructDefOp root)

TODO: If root::@compute and root::@constrain are called anywhere else, this is not a valid root to start aligning from (issue #241)

Definition at line 50 of file LLZKComputeConstrainToProductPass.cpp.

◆ isValidType() [1/2]

bool llzk::isValidType ( mlir::Type type)

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

◆ isValidType() [2/2]

bool llzk::isValidType ( Type type)

Definition at line 531 of file TypeHelper.cpp.

◆ lookupSymbolIn() [1/2]

mlir::FailureOr< SymbolLookupResultUntyped > llzk::lookupSymbolIn ( mlir::SymbolTableCollection & tables,
mlir::SymbolRefAttr symbol,
Within && lookupWithin,
mlir::Operation * origin,
bool reportMissing = true )
inline

Definition at line 227 of file SymbolLookup.h.

◆ lookupSymbolIn() [2/2]

template<typename T>
mlir::FailureOr< SymbolLookupResult< T > > llzk::lookupSymbolIn ( mlir::SymbolTableCollection & tables,
mlir::SymbolRefAttr symbol,
Within && lookupWithin,
mlir::Operation * origin,
bool reportMissing = true )
inline

Definition at line 242 of file SymbolLookup.h.

◆ lookupTopLevelSymbol() [1/2]

mlir::FailureOr< SymbolLookupResultUntyped > llzk::lookupTopLevelSymbol ( mlir::SymbolTableCollection & tables,
mlir::SymbolRefAttr symbol,
mlir::Operation * origin,
bool reportMissing = true )
inline

Definition at line 234 of file SymbolLookup.h.

◆ lookupTopLevelSymbol() [2/2]

template<typename T>
mlir::FailureOr< SymbolLookupResult< T > > llzk::lookupTopLevelSymbol ( mlir::SymbolTableCollection & tables,
mlir::SymbolRefAttr symbol,
mlir::Operation * origin,
bool reportMissing = true )
inline

Definition at line 266 of file SymbolLookup.h.

◆ m_CommutativeOp()

template<typename OpType, typename LhsMatcher, typename RhsMatcher>
auto llzk::m_CommutativeOp ( LhsMatcher lhs,
RhsMatcher rhs )

Definition at line 47 of file Matchers.h.

◆ m_Constant() [1/2]

ConstantCapture llzk::m_Constant ( )
inline

Definition at line 89 of file Matchers.h.

◆ m_Constant() [2/2]

ConstantCapture llzk::m_Constant ( felt::FeltConstantOp * capture)
inline

Definition at line 91 of file Matchers.h.

◆ m_RefValue() [1/2]

RefValueCapture llzk::m_RefValue ( )
inline

Definition at line 69 of file Matchers.h.

◆ m_RefValue() [2/2]

RefValueCapture llzk::m_RefValue ( mlir::Value * capture)
inline

Definition at line 71 of file Matchers.h.

◆ mkExpr()

llvm::SMTExprRef llzk::mkExpr ( mlir::Value value,
llvm::SMTSolver * solver )

Definition at line 63 of file LLZKFuseProductLoopsPass.cpp.

◆ mod()

ExpressionValue llzk::mod ( const llvm::SMTSolverRef & solver,
const ExpressionValue & lhs,
const ExpressionValue & rhs )

Definition at line 216 of file IntervalAnalysis.cpp.

◆ modExp() [1/2]

DynamicAPInt llzk::modExp ( const DynamicAPInt & base,
const DynamicAPInt & exp,
const DynamicAPInt & mod )

Definition at line 145 of file DynamicAPIntHelper.cpp.

◆ modExp() [2/2]

llvm::DynamicAPInt llzk::modExp ( const llvm::DynamicAPInt & base,
const llvm::DynamicAPInt & exp,
const llvm::DynamicAPInt & mod )

◆ modInversePrime() [1/2]

DynamicAPInt llzk::modInversePrime ( const DynamicAPInt & f,
const DynamicAPInt & p )

Definition at line 162 of file DynamicAPIntHelper.cpp.

◆ modInversePrime() [2/2]

llvm::DynamicAPInt llzk::modInversePrime ( const llvm::DynamicAPInt & f,
const llvm::DynamicAPInt & p )

◆ mul()

ExpressionValue llzk::mul ( const llvm::SMTSolverRef & solver,
const ExpressionValue & lhs,
const ExpressionValue & rhs )

Definition at line 128 of file IntervalAnalysis.cpp.

◆ neg()

ExpressionValue llzk::neg ( const llvm::SMTSolverRef & solver,
const ExpressionValue & val )

Definition at line 360 of file IntervalAnalysis.cpp.

◆ newGeneralRewritePatternSet()

template<typename... AdditionalOpClasses>
mlir::RewritePatternSet llzk::newGeneralRewritePatternSet ( mlir::TypeConverter & tyConv,
mlir::MLIRContext * ctx,
mlir::ConversionTarget & target )
inline

Return a new RewritePatternSet covering all LLZK op types that may contain a StructType.

All fallback patterns use benefit 0 so higher-benefit patterns can override if needed.

The GeneralTypeReplacePattern is used for all classes in AdditionalOpClasses.

Definition at line 240 of file TypeConversionPatterns.h.

◆ notOp()

ExpressionValue llzk::notOp ( const llvm::SMTSolverRef & solver,
const ExpressionValue & val )

Definition at line 367 of file IntervalAnalysis.cpp.

◆ operator%()

Interval llzk::operator% ( const Interval & lhs,
const Interval & rhs )

Definition at line 553 of file Intervals.cpp.

◆ operator&() [1/3]

DynamicAPInt llzk::operator& ( const DynamicAPInt & lhs,
const DynamicAPInt & rhs )

Definition at line 60 of file DynamicAPIntHelper.cpp.

◆ operator&() [2/3]

Interval llzk::operator& ( const Interval & lhs,
const Interval & rhs )

Definition at line 586 of file Intervals.cpp.

◆ operator&() [3/3]

llvm::DynamicAPInt llzk::operator& ( const llvm::DynamicAPInt & lhs,
const llvm::DynamicAPInt & rhs )

◆ operator*() [1/2]

Interval llzk::operator* ( const Interval & lhs,
const Interval & rhs )

Definition at line 467 of file Intervals.cpp.

◆ operator*() [2/2]

UnreducedInterval llzk::operator* ( const UnreducedInterval & lhs,
const UnreducedInterval & rhs )

Definition at line 109 of file Intervals.cpp.

◆ operator+() [1/2]

Interval llzk::operator+ ( const Interval & lhs,
const Interval & rhs )

Definition at line 454 of file Intervals.cpp.

◆ operator+() [2/2]

UnreducedInterval llzk::operator+ ( const UnreducedInterval & lhs,
const UnreducedInterval & rhs )

Definition at line 100 of file Intervals.cpp.

◆ operator-() [1/2]

Interval llzk::operator- ( const Interval & lhs,
const Interval & rhs )

Definition at line 465 of file Intervals.cpp.

◆ operator-() [2/2]

UnreducedInterval llzk::operator- ( const UnreducedInterval & lhs,
const UnreducedInterval & rhs )

Definition at line 105 of file Intervals.cpp.

◆ operator<<() [1/9]

DynamicAPInt llzk::operator<< ( const DynamicAPInt & lhs,
const DynamicAPInt & rhs )

Definition at line 75 of file DynamicAPIntHelper.cpp.

◆ operator<<() [2/9]

Interval llzk::operator<< ( const Interval & lhs,
const Interval & rhs )

Definition at line 637 of file Intervals.cpp.

◆ operator<<() [3/9]

llvm::DynamicAPInt llzk::operator<< ( const llvm::DynamicAPInt & lhs,
const llvm::DynamicAPInt & rhs )

◆ operator<<() [4/9]

llvm::raw_ostream & llzk::operator<< ( llvm::raw_ostream & os,
const FuzzySet & set )
inline

Definition at line 87 of file MemberOverwriteAnalysis.h.

◆ operator<<() [5/9]

llvm::raw_ostream & llzk::operator<< ( llvm::raw_ostream & os,
const MemberOverwriteLattice & lat )

Definition at line 27 of file MemberOverwriteAnalysis.cpp.

◆ operator<<() [6/9]

mlir::raw_ostream & llzk::operator<< ( mlir::raw_ostream & os,
const SourceRef & rhs )

◆ operator<<() [7/9]

mlir::raw_ostream & llzk::operator<< ( mlir::raw_ostream & os,
const SourceRefLatticeValue & v )

Definition at line 206 of file SourceRefLattice.cpp.

◆ operator<<() [8/9]

raw_ostream & llzk::operator<< ( raw_ostream & os,
const SourceRef & rhs )

Definition at line 503 of file SourceRef.cpp.

◆ operator<<() [9/9]

raw_ostream & llzk::operator<< ( raw_ostream & os,
const SourceRefSet & rhs )

Definition at line 515 of file SourceRef.cpp.

◆ operator<=>()

std::strong_ordering llzk::operator<=> ( const UnreducedInterval & lhs,
const UnreducedInterval & rhs )

Definition at line 125 of file Intervals.cpp.

◆ operator>>() [1/3]

DynamicAPInt llzk::operator>> ( const DynamicAPInt & lhs,
const DynamicAPInt & rhs )

Definition at line 77 of file DynamicAPIntHelper.cpp.

◆ operator>>() [2/3]

Interval llzk::operator>> ( const Interval & lhs,
const Interval & rhs )

Definition at line 653 of file Intervals.cpp.

◆ operator>>() [3/3]

llvm::DynamicAPInt llzk::operator>> ( const llvm::DynamicAPInt & lhs,
const llvm::DynamicAPInt & rhs )

◆ operator^() [1/3]

DynamicAPInt llzk::operator^ ( const DynamicAPInt & lhs,
const DynamicAPInt & rhs )

Definition at line 70 of file DynamicAPIntHelper.cpp.

◆ operator^() [2/3]

Interval llzk::operator^ ( const Interval & lhs,
const Interval & rhs )

This over-approximates for non-degenerate intervals on non-identity cases.

Definition at line 619 of file Intervals.cpp.

◆ operator^() [3/3]

llvm::DynamicAPInt llzk::operator^ ( const llvm::DynamicAPInt & lhs,
const llvm::DynamicAPInt & rhs )

◆ operator|() [1/3]

DynamicAPInt llzk::operator| ( const DynamicAPInt & lhs,
const DynamicAPInt & rhs )

Definition at line 65 of file DynamicAPIntHelper.cpp.

◆ operator|() [2/3]

Interval llzk::operator| ( const Interval & lhs,
const Interval & rhs )

This over-approximates for non-degenerate intervals on non-identity cases.

Definition at line 601 of file Intervals.cpp.

◆ operator|() [3/3]

llvm::DynamicAPInt llzk::operator| ( const llvm::DynamicAPInt & lhs,
const llvm::DynamicAPInt & rhs )

◆ parseAttrDictWithWarnings()

mlir::ParseResult llzk::parseAttrDictWithWarnings ( mlir::OpAsmParser & parser,
mlir::NamedAttrList & extraAttrs,
mlir::OperationState & state )
inline

Definition at line 147 of file OpHelpers.h.

◆ parseDimAndSymbolList()

template<unsigned N>
mlir::ParseResult llzk::parseDimAndSymbolList ( mlir::OpAsmParser & parser,
mlir::SmallVector< mlir::OpAsmParser::UnresolvedOperand, N > & mapOperands,
mlir::IntegerAttr & numDims )
inline

Definition at line 117 of file OpHelpers.h.

◆ parseMultiDimAndSymbolList()

mlir::ParseResult llzk::parseMultiDimAndSymbolList ( mlir::OpAsmParser & parser,
mlir::SmallVector< mlir::SmallVector< mlir::OpAsmParser::UnresolvedOperand > > & multiMapOperands,
mlir::DenseI32ArrayAttr & numDimsPerMap )
inline

Definition at line 132 of file OpHelpers.h.

◆ parseTemplateParams()

mlir::ParseResult llzk::parseTemplateParams ( mlir::AsmParser & parser,
mlir::ArrayAttr & value )
inline

Definition at line 161 of file OpHelpers.h.

◆ podTypesUnify() [1/2]

bool llzk::podTypesUnify ( pod::PodType lhs,
pod::PodType rhs,
mlir::ArrayRef< llvm::StringRef > rhsReversePrefix = {},
UnificationMap * unifications = nullptr )

Return true iff the two PodType instances are equivalent or could be equivalent after full instantiation of template parameters.

◆ podTypesUnify() [2/2]

bool llzk::podTypesUnify ( PodType lhs,
PodType rhs,
ArrayRef< StringRef > rhsReversePrefix,
UnificationMap * unifications )

Definition at line 911 of file TypeHelper.cpp.

◆ printAttrDictWithWarnings()

template<typename ConcreteOp>
void llzk::printAttrDictWithWarnings ( mlir::OpAsmPrinter & printer,
ConcreteOp op,
mlir::DictionaryAttr extraAttrs,
typename mlir::PropertiesSelector< ConcreteOp >::type state )
inline

Definition at line 154 of file OpHelpers.h.

◆ printAttrs() [1/2]

void llzk::printAttrs ( AsmPrinter & printer,
ArrayRef< Attribute > attrs,
const StringRef & separator )

Definition at line 19 of file AttributeHelper.cpp.

◆ printAttrs() [2/2]

void llzk::printAttrs ( mlir::AsmPrinter & printer,
mlir::ArrayRef< mlir::Attribute > attrs,
const mlir::StringRef & separator )

◆ printDimAndSymbolList()

void llzk::printDimAndSymbolList ( mlir::OpAsmPrinter & printer,
mlir::Operation * op,
mlir::OperandRange mapOperands,
mlir::IntegerAttr numDims )
inline

Definition at line 125 of file OpHelpers.h.

◆ printMultiDimAndSymbolList()

void llzk::printMultiDimAndSymbolList ( mlir::OpAsmPrinter & printer,
mlir::Operation * op,
mlir::OperandRangeRange multiMapOperands,
mlir::DenseI32ArrayAttr numDimsPerMap )
inline

Definition at line 140 of file OpHelpers.h.

◆ printRegionless()

raw_ostream & llzk::printRegionless ( raw_ostream & os,
Operation * op,
bool withParent = false )

Prints op without region.

Definition at line 39 of file PredecessorAnalysisPass.cpp.

◆ printTemplateParams() [1/2]

void llzk::printTemplateParams ( mlir::AsmPrinter & printer,
mlir::ArrayAttr value )
inline

Definition at line 179 of file OpHelpers.h.

◆ printTemplateParams() [2/2]

void llzk::printTemplateParams ( mlir::AsmPrinter & printer,
void * ,
mlir::ArrayAttr value )
inline

Definition at line 186 of file OpHelpers.h.

◆ rebuildExprInCompute() [1/2]

mlir::Value llzk::rebuildExprInCompute ( mlir::Value val,
function::FuncDefOp computeFunc,
mlir::OpBuilder & builder,
llvm::DenseMap< mlir::Value, mlir::Value > & memo )

◆ rebuildExprInCompute() [2/2]

Value llzk::rebuildExprInCompute ( Value val,
FuncDefOp computeFunc,
OpBuilder & builder,
DenseMap< Value, Value > & memo )

Definition at line 29 of file LLZKLoweringUtils.cpp.

◆ registerAllDialects()

void llzk::registerAllDialects ( mlir::DialectRegistry & registry)

Definition at line 34 of file InitDialects.cpp.

◆ registerAnalysisPasses()

void llzk::registerAnalysisPasses ( )
inline

Definition at line 732 of file AnalysisPasses.h.

◆ registerCallGraphPrinterPass()

void llzk::registerCallGraphPrinterPass ( )
inline

Definition at line 613 of file AnalysisPasses.h.

◆ registerCallGraphPrinterPassPass()

void llzk::registerCallGraphPrinterPassPass ( )
inline

Definition at line 620 of file AnalysisPasses.h.

◆ registerCallGraphSCCsPrinterPass()

void llzk::registerCallGraphSCCsPrinterPass ( )
inline

Definition at line 630 of file AnalysisPasses.h.

◆ registerCallGraphSCCsPrinterPassPass()

void llzk::registerCallGraphSCCsPrinterPassPass ( )
inline

Definition at line 637 of file AnalysisPasses.h.

◆ registerComputeConstrainToProductPass()

void llzk::registerComputeConstrainToProductPass ( )
inline

Definition at line 642 of file LLZKTransformationPasses.h.

◆ registerComputeConstrainToProductPassPass()

void llzk::registerComputeConstrainToProductPassPass ( )
inline

Definition at line 649 of file LLZKTransformationPasses.h.

◆ registerConstraintDependencyGraphPrinterPass()

void llzk::registerConstraintDependencyGraphPrinterPass ( )
inline

Definition at line 647 of file AnalysisPasses.h.

◆ registerConstraintDependencyGraphPrinterPassPass()

void llzk::registerConstraintDependencyGraphPrinterPassPass ( )
inline

Definition at line 654 of file AnalysisPasses.h.

◆ registerEnforceNoMemberOverwritePass()

void llzk::registerEnforceNoMemberOverwritePass ( )
inline

Definition at line 659 of file LLZKTransformationPasses.h.

◆ registerEnforceNoMemberOverwritePassPass()

void llzk::registerEnforceNoMemberOverwritePassPass ( )
inline

Definition at line 666 of file LLZKTransformationPasses.h.

◆ registerFuseProductLoopsPass()

void llzk::registerFuseProductLoopsPass ( )
inline

Definition at line 676 of file LLZKTransformationPasses.h.

◆ registerFuseProductLoopsPassPass()

void llzk::registerFuseProductLoopsPassPass ( )
inline

Definition at line 683 of file LLZKTransformationPasses.h.

◆ registerInlineStructsPass()

void llzk::registerInlineStructsPass ( )
inline

Definition at line 693 of file LLZKTransformationPasses.h.

◆ registerInlineStructsPassPass()

void llzk::registerInlineStructsPassPass ( )
inline

Definition at line 700 of file LLZKTransformationPasses.h.

◆ registerInliningExtensions() [1/2]

void llzk::registerInliningExtensions ( DialectRegistry & registry)

Definition at line 100 of file LLZKInliningExtensions.cpp.

◆ registerInliningExtensions() [2/2]

void llzk::registerInliningExtensions ( mlir::DialectRegistry & registry)

◆ registerIntervalAnalysisPrinterPass()

void llzk::registerIntervalAnalysisPrinterPass ( )
inline

Definition at line 664 of file AnalysisPasses.h.

◆ registerIntervalAnalysisPrinterPassPass()

void llzk::registerIntervalAnalysisPrinterPassPass ( )
inline

Definition at line 671 of file AnalysisPasses.h.

◆ registerMemberWriteValidatorPass()

void llzk::registerMemberWriteValidatorPass ( )
inline

Definition at line 89 of file LLZKValidationPasses.h.

◆ registerMemberWriteValidatorPassPass()

void llzk::registerMemberWriteValidatorPassPass ( )
inline

Definition at line 96 of file LLZKValidationPasses.h.

◆ registerPolyLoweringPass()

void llzk::registerPolyLoweringPass ( )
inline

Definition at line 710 of file LLZKTransformationPasses.h.

◆ registerPolyLoweringPassPass()

void llzk::registerPolyLoweringPassPass ( )
inline

Definition at line 717 of file LLZKTransformationPasses.h.

◆ registerPredecessorPrinterPass()

void llzk::registerPredecessorPrinterPass ( )
inline

Definition at line 681 of file AnalysisPasses.h.

◆ registerPredecessorPrinterPassPass()

void llzk::registerPredecessorPrinterPassPass ( )
inline

Definition at line 688 of file AnalysisPasses.h.

◆ registerRedundantOperationEliminationPass()

void llzk::registerRedundantOperationEliminationPass ( )
inline

Definition at line 727 of file LLZKTransformationPasses.h.

◆ registerRedundantOperationEliminationPassPass()

void llzk::registerRedundantOperationEliminationPassPass ( )
inline

Definition at line 734 of file LLZKTransformationPasses.h.

◆ registerRedundantReadAndWriteEliminationPass()

void llzk::registerRedundantReadAndWriteEliminationPass ( )
inline

Definition at line 744 of file LLZKTransformationPasses.h.

◆ registerRedundantReadAndWriteEliminationPassPass()

void llzk::registerRedundantReadAndWriteEliminationPassPass ( )
inline

Definition at line 751 of file LLZKTransformationPasses.h.

◆ registerSymbolDefTreePrinterPass()

void llzk::registerSymbolDefTreePrinterPass ( )
inline

Definition at line 698 of file AnalysisPasses.h.

◆ registerSymbolDefTreePrinterPassPass()

void llzk::registerSymbolDefTreePrinterPassPass ( )
inline

Definition at line 705 of file AnalysisPasses.h.

◆ registerSymbolUseGraphPrinterPass()

void llzk::registerSymbolUseGraphPrinterPass ( )
inline

Definition at line 715 of file AnalysisPasses.h.

◆ registerSymbolUseGraphPrinterPassPass()

void llzk::registerSymbolUseGraphPrinterPassPass ( )
inline

Definition at line 722 of file AnalysisPasses.h.

◆ registerTransformationPasses()

void llzk::registerTransformationPasses ( )
inline

Definition at line 778 of file LLZKTransformationPasses.h.

◆ registerTransformationPassPipelines()

void llzk::registerTransformationPassPipelines ( )

Definition at line 38 of file LLZKTransformationPassPipelines.cpp.

◆ registerUnusedDeclarationEliminationPass()

void llzk::registerUnusedDeclarationEliminationPass ( )
inline

Definition at line 761 of file LLZKTransformationPasses.h.

◆ registerUnusedDeclarationEliminationPassPass()

void llzk::registerUnusedDeclarationEliminationPassPass ( )
inline

Definition at line 768 of file LLZKTransformationPasses.h.

◆ registerValidationPasses()

void llzk::registerValidationPasses ( )
inline

Definition at line 106 of file LLZKValidationPasses.h.

◆ replaceLeaf() [1/4]

mlir::SymbolRefAttr llzk::replaceLeaf ( mlir::SymbolRefAttr orig,
const mlir::Twine & newLeaf )
inline

Definition at line 71 of file SymbolHelper.h.

◆ replaceLeaf() [2/4]

mlir::SymbolRefAttr llzk::replaceLeaf ( mlir::SymbolRefAttr orig,
mlir::FlatSymbolRefAttr newLeaf )

Return SymbolRefAttr like the one given but with the leaf (final) element replaced.

◆ replaceLeaf() [3/4]

mlir::SymbolRefAttr llzk::replaceLeaf ( mlir::SymbolRefAttr orig,
mlir::StringAttr newLeaf )
inline

Definition at line 68 of file SymbolHelper.h.

◆ replaceLeaf() [4/4]

SymbolRefAttr llzk::replaceLeaf ( SymbolRefAttr orig,
FlatSymbolRefAttr newLeaf )

Definition at line 245 of file SymbolHelper.cpp.

◆ replaceOpWithNewOp()

template<typename OpClass, typename Rewriter, typename... Args>
OpClass llzk::replaceOpWithNewOp ( Rewriter & rewriter,
mlir::Operation * op,
Args &&... args )
inline

Wrapper for PatternRewriter::replaceOpWithNewOp() that automatically copies discardable attributes (i.e., attributes other than those specifically defined as part of the op in ODS).

Definition at line 71 of file TypeConversionPatterns.h.

◆ replaceReadWithWrite()

Value llzk::replaceReadWithWrite ( Value v)

Definition at line 35 of file LightweightSignalEquivalenceAnalysis.cpp.

◆ replaceSubsequentUsesWith() [1/2]

void llzk::replaceSubsequentUsesWith ( mlir::Value oldVal,
mlir::Value newVal,
mlir::Operation * afterOp )

Replaces all subsequent uses of oldVal with newVal, starting after afterOp.

Specifically:

  • Uses of oldVal in operations that come after afterOp in the same block are replaced.
  • Uses in afterOp itself are not replaced (to avoid self-trivializing rewrites).
  • Uses in other blocks are replaced (if applicable).

Typical use case:

  • You introduce an auxiliary value (e.g., via EmitEqualityOp) and want to replace all later uses of the original value while preserving the constraint itself.
Parameters
oldValThe original value whose uses should be redirected.
newValThe new value to replace subsequent uses with.
afterOpThe operation after which uses of oldVal will be replaced.

◆ replaceSubsequentUsesWith() [2/2]

void llzk::replaceSubsequentUsesWith ( Value oldVal,
Value newVal,
Operation * afterOp )

Definition at line 102 of file LLZKLoweringUtils.cpp.

◆ resolveCallable() [1/2]

template<typename T>
mlir::FailureOr< SymbolLookupResult< T > > llzk::resolveCallable ( mlir::CallOpInterface call)
inline

Definition at line 153 of file SymbolHelper.h.

◆ resolveCallable() [2/2]

template<typename T>
mlir::FailureOr< SymbolLookupResult< T > > llzk::resolveCallable ( mlir::SymbolTableCollection & symbolTable,
mlir::CallOpInterface call )
inline

Based on mlir::CallOpInterface::resolveCallable, but using LLZK lookup helpers.

Template Parameters
Tthe type of symbol being resolved (e.g., function::FuncDefOp)
Parameters
symbolTable
call
Returns
the symbol or failure

Definition at line 132 of file SymbolHelper.h.

◆ reverse()

Side llzk::reverse ( Side in)
inline

Definition at line 144 of file TypeHelper.h.

◆ selectValue()

ExpressionValue llzk::selectValue ( const llvm::SMTSolverRef & solver,
const ExpressionValue & cond,
const ExpressionValue & trueVal,
const ExpressionValue & falseVal )

Definition at line 82 of file IntervalAnalysis.cpp.

◆ shiftLeft()

ExpressionValue llzk::shiftLeft ( const llvm::SMTSolverRef & solver,
const ExpressionValue & lhs,
const ExpressionValue & rhs )

Definition at line 251 of file IntervalAnalysis.cpp.

◆ shiftRight()

ExpressionValue llzk::shiftRight ( const llvm::SMTSolverRef & solver,
const ExpressionValue & lhs,
const ExpressionValue & rhs )

Definition at line 260 of file IntervalAnalysis.cpp.

◆ signedIntDiv()

mlir::FailureOr< Interval > llzk::signedIntDiv ( const Interval & lhs,
const Interval & rhs )

Computes signed integer division with possibly non-Degenerate divisors.

Returns failure if the divisor interval may contain zero.

Definition at line 527 of file Intervals.cpp.

◆ singletonTypeListsUnify()

template<typename Iter1, typename Iter2>
bool llzk::singletonTypeListsUnify ( Iter1 lhs,
Iter2 rhs,
mlir::ArrayRef< llvm::StringRef > rhsReversePrefix = {},
UnificationMap * unifications = nullptr )
inline

Definition at line 251 of file TypeHelper.h.

◆ sintDiv()

ExpressionValue llzk::sintDiv ( const llvm::SMTSolverRef & solver,
Operation * op,
const ExpressionValue & lhs,
const ExpressionValue & rhs )

Definition at line 195 of file IntervalAnalysis.cpp.

◆ stringifyEnum()

inline ::llvm::StringRef llzk::stringifyEnum ( OutputStream enumValue)

Definition at line 26 of file AnalysisPassEnums.h.inc.

◆ stringifyOutputStream()

llvm::StringRef llzk::stringifyOutputStream ( OutputStream val)

Definition at line 11 of file AnalysisPassEnums.cpp.inc.

◆ stringWithoutType()

std::string llzk::stringWithoutType ( mlir::Attribute a)
inline

Definition at line 41 of file AttributeHelper.h.

◆ structTypesUnify() [1/2]

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 template parameters.

◆ structTypesUnify() [2/2]

bool llzk::structTypesUnify ( StructType lhs,
StructType rhs,
ArrayRef< StringRef > rhsReversePrefix,
UnificationMap * unifications )

Definition at line 904 of file TypeHelper.cpp.

◆ sub()

ExpressionValue llzk::sub ( const llvm::SMTSolverRef & solver,
const ExpressionValue & lhs,
const ExpressionValue & rhs )

Definition at line 120 of file IntervalAnalysis.cpp.

◆ symbolizeEnum()

template<typename EnumType>
::std::optional< EnumType > llzk::symbolizeEnum ( ::llvm::StringRef )

◆ symbolizeEnum< OutputStream >()

template<>
inline ::std::optional< OutputStream > llzk::symbolizeEnum< OutputStream > ( ::llvm::StringRef str)

Definition at line 31 of file AnalysisPassEnums.h.inc.

◆ symbolizeOutputStream() [1/2]

std::optional< OutputStream > llzk::symbolizeOutputStream ( ::llvm::StringRef str)

Definition at line 20 of file AnalysisPassEnums.cpp.inc.

◆ symbolizeOutputStream() [2/2]

std::optional< OutputStream > llzk::symbolizeOutputStream ( uint32_t value)

Definition at line 27 of file AnalysisPassEnums.cpp.inc.

◆ symbolKnownUseEmpty() [1/4]

bool llzk::symbolKnownUseEmpty ( mlir::Operation * symbol,
mlir::Operation * from )

◆ symbolKnownUseEmpty() [2/4]

bool llzk::symbolKnownUseEmpty ( mlir::Operation * symbol,
mlir::Region * from )

◆ symbolKnownUseEmpty() [3/4]

bool llzk::symbolKnownUseEmpty ( mlir::StringAttr symbol,
mlir::Operation * from )

Return if the given symbol is known to have no uses that are nested within the given operation 'from'.

This does not traverse into any nested symbol tables. This function will also return false if there are any unknown operations that may potentially be symbol tables. This doesn't necessarily mean that there are no uses, we just can't conservatively prove it.

◆ symbolKnownUseEmpty() [4/4]

bool llzk::symbolKnownUseEmpty ( mlir::StringAttr symbol,
mlir::Region * from )

◆ toAPInt() [1/3]

APInt llzk::toAPInt ( const DynamicAPInt & val,
unsigned bitWidth )

Definition at line 139 of file DynamicAPIntHelper.cpp.

◆ toAPInt() [2/3]

llvm::APInt llzk::toAPInt ( const llvm::DynamicAPInt & i,
unsigned bitWidth )

Converts a DynamicAPInt that is non-negative and fits in bitWidth bits into an APInt.

Uses bitWidth+1 so that all field values in [0, p) — which satisfy val < 2^bitWidth — have a clear sign bit and print as positive decimals.

◆ toAPInt() [3/3]

llvm::APInt llzk::toAPInt ( int64_t i)
inline

Definition at line 33 of file AttributeHelper.h.

◆ toAPSInt() [1/2]

APSInt llzk::toAPSInt ( const DynamicAPInt & i)

Definition at line 118 of file DynamicAPIntHelper.cpp.

◆ toAPSInt() [2/2]

llvm::APSInt llzk::toAPSInt ( const llvm::DynamicAPInt & i)

◆ toDynamicAPInt() [1/5]

DynamicAPInt llzk::toDynamicAPInt ( const APSInt & i)

Definition at line 96 of file DynamicAPIntHelper.cpp.

◆ toDynamicAPInt() [2/5]

llvm::DynamicAPInt llzk::toDynamicAPInt ( const llvm::APInt & i)
inline

Definition at line 39 of file DynamicAPIntHelper.h.

◆ toDynamicAPInt() [3/5]

llvm::DynamicAPInt llzk::toDynamicAPInt ( const llvm::APSInt & i)

◆ toDynamicAPInt() [4/5]

llvm::DynamicAPInt llzk::toDynamicAPInt ( llvm::StringRef str)

◆ toDynamicAPInt() [5/5]

DynamicAPInt llzk::toDynamicAPInt ( StringRef str)

Definition at line 91 of file DynamicAPIntHelper.cpp.

◆ toStream() [1/2]

llvm::raw_ostream & llzk::toStream ( mlir::Pass::Option< OutputStream > & val)
inline

Definition at line 26 of file AnalysisPassEnums.h.

◆ toStream() [2/2]

llvm::raw_ostream & llzk::toStream ( OutputStream val)

Definition at line 21 of file AnalysisPassEnums.cpp.

◆ tripCount()

llvm::SMTExprRef llzk::tripCount ( mlir::scf::ForOp op,
llvm::SMTSolver * solver )

Definition at line 76 of file LLZKFuseProductLoopsPass.cpp.

◆ tryDetectSpecifiedField()

std::optional< std::reference_wrapper< const Field > > llzk::tryDetectSpecifiedField ( mlir::Operation * root)

Try to detect a uniquely used field from the enclosing LLZK module.

Parameters
rootOperation inside the LLZK module to inspect.
Returns
The field if the enclosing module uses exactly one unique field, otherwise std::nullopt.

◆ typeListsUnify()

template<typename Iter1, typename Iter2>
bool llzk::typeListsUnify ( Iter1 lhs,
Iter2 rhs,
mlir::ArrayRef< llvm::StringRef > rhsReversePrefix = {},
UnificationMap * unifications = nullptr )
inline

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

Definition at line 240 of file TypeHelper.h.

◆ typeParamsUnify() [1/4]

bool llzk::typeParamsUnify ( const ArrayAttr & lhsParams,
const ArrayAttr & rhsParams,
UnificationMap * unifications )

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 892 of file TypeHelper.cpp.

◆ typeParamsUnify() [2/4]

bool llzk::typeParamsUnify ( const ArrayRef< Attribute > & lhsParams,
const ArrayRef< Attribute > & rhsParams,
UnificationMap * unifications )

Definition at line 883 of file TypeHelper.cpp.

◆ typeParamsUnify() [3/4]

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 template parameters.

◆ typeParamsUnify() [4/4]

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 template parameters.

◆ typesUnify() [1/2]

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 template parameters (if applicable within the given types).

◆ typesUnify() [2/2]

bool llzk::typesUnify ( Type lhs,
Type rhs,
ArrayRef< StringRef > rhsReversePrefix,
UnificationMap * unifications )

Definition at line 924 of file TypeHelper.cpp.

◆ uintDiv()

ExpressionValue llzk::uintDiv ( const llvm::SMTSolverRef & solver,
Operation * op,
const ExpressionValue & lhs,
const ExpressionValue & rhs )

Definition at line 175 of file IntervalAnalysis.cpp.

◆ unsignedIntDiv()

mlir::FailureOr< Interval > llzk::unsignedIntDiv ( const Interval & lhs,
const Interval & rhs )

Computes unsigned integer division with possibly non-Degenerate divisors.

Returns failure if the divisor interval may contain zero.

Definition at line 501 of file Intervals.cpp.

◆ verifyAffineMapAttrType() [1/2]

LogicalResult llzk::verifyAffineMapAttrType ( EmitErrorFn emitError,
Attribute in )

Definition at line 1003 of file TypeHelper.cpp.

◆ verifyAffineMapAttrType() [2/2]

mlir::LogicalResult llzk::verifyAffineMapAttrType ( EmitErrorFn emitError,
mlir::Attribute in )

Verify that all AffineMapAttr only have a single result.

◆ verifyArrayDimSizes() [1/2]

LogicalResult llzk::verifyArrayDimSizes ( EmitErrorFn emitError,
ArrayRef< Attribute > dimensionSizes )

Definition at line 1025 of file TypeHelper.cpp.

◆ verifyArrayDimSizes() [2/2]

mlir::LogicalResult llzk::verifyArrayDimSizes ( EmitErrorFn emitError,
mlir::ArrayRef< mlir::Attribute > dimensionSizes )

Verify that the array dimensions are valid.

◆ verifyArrayType() [1/2]

mlir::LogicalResult llzk::verifyArrayType ( EmitErrorFn emitError,
mlir::Type elementType,
mlir::ArrayRef< mlir::Attribute > dimensionSizes )

Verify that the ArrayType is valid.

◆ verifyArrayType() [2/2]

LogicalResult llzk::verifyArrayType ( EmitErrorFn emitError,
Type elementType,
ArrayRef< Attribute > dimensionSizes )

Definition at line 1030 of file TypeHelper.cpp.

◆ verifyIntAttrType() [1/2]

LogicalResult llzk::verifyIntAttrType ( EmitErrorFn emitError,
Attribute in )

Definition at line 988 of file TypeHelper.cpp.

◆ verifyIntAttrType() [2/2]

mlir::LogicalResult llzk::verifyIntAttrType ( EmitErrorFn emitError,
mlir::Attribute in )

Verify that all IntegerAttr have type IndexType.

◆ verifyParamOfType() [1/2]

mlir::LogicalResult llzk::verifyParamOfType ( mlir::SymbolTableCollection & tables,
mlir::SymbolRefAttr param,
mlir::Type structOrArrayType,
mlir::Operation * origin )

Ensure that the given symbol (that is used as a parameter of the given type) can be resolved.

◆ verifyParamOfType() [2/2]

LogicalResult llzk::verifyParamOfType ( SymbolTableCollection & tables,
SymbolRefAttr param,
Type parameterizedType,
Operation * origin )

Definition at line 361 of file SymbolHelper.cpp.

◆ verifyParamsOfType() [1/2]

mlir::LogicalResult llzk::verifyParamsOfType ( mlir::SymbolTableCollection & tables,
mlir::ArrayRef< mlir::Attribute > tyParams,
mlir::Type structOrArrayType,
mlir::Operation * origin )

Ensure that any symbols that appear within the given attributes (that are parameters of the given type) can be resolved.

◆ verifyParamsOfType() [2/2]

LogicalResult llzk::verifyParamsOfType ( SymbolTableCollection & tables,
ArrayRef< Attribute > tyParams,
Type parameterizedType,
Operation * origin )

Definition at line 388 of file SymbolHelper.cpp.

◆ verifyStructTypeParams() [1/2]

LogicalResult llzk::verifyStructTypeParams ( EmitErrorFn emitError,
ArrayAttr params )

Definition at line 1021 of file TypeHelper.cpp.

◆ verifyStructTypeParams() [2/2]

mlir::LogicalResult llzk::verifyStructTypeParams ( EmitErrorFn emitError,
mlir::ArrayAttr params )

Verify that the StructType parameters are valid.

◆ verifyStructTypeResolution() [1/2]

mlir::FailureOr< component::StructDefOp > llzk::verifyStructTypeResolution ( mlir::SymbolTableCollection & tables,
component::StructType ty,
mlir::Operation * origin )

Ensure that all symbols used within the type can be resolved.

◆ verifyStructTypeResolution() [2/2]

FailureOr< StructDefOp > llzk::verifyStructTypeResolution ( SymbolTableCollection & tables,
StructType ty,
Operation * origin )

Definition at line 423 of file SymbolHelper.cpp.

◆ verifySubArrayOrElementType() [1/2]

mlir::LogicalResult llzk::verifySubArrayOrElementType ( EmitErrorFn emitError,
array::ArrayType arrayType,
mlir::Type subArrayOrElemType )

Determine if the subArrayOrElemType is either a valid subarray of arrayType (see verifySubArrayType), or if subArrayOrElemType matches the element type of arrayType.

◆ verifySubArrayOrElementType() [2/2]

LogicalResult llzk::verifySubArrayOrElementType ( EmitErrorFn emitError,
ArrayType arrayType,
Type subArrayOrElemType )

Definition at line 1086 of file TypeHelper.cpp.

◆ verifySubArrayType()

mlir::LogicalResult llzk::verifySubArrayType ( EmitErrorFn emitError,
array::ArrayType arrayType,
array::ArrayType subArrayType )

Determine if the subArrayType is a valid subarray of arrayType.

arrayType must be an array of dimension N and subArrayType must be an array of dimension M, where N > M >= 1. For example, <3,7 x int> is a valid subarray of <5,3,7 x int>, but <8 x int> is not an neither is <3,7 x string>.

Definition at line 1046 of file TypeHelper.cpp.

◆ verifyTypeResolution() [1/3]

template<std::ranges::input_range Range>
mlir::LogicalResult llzk::verifyTypeResolution ( mlir::SymbolTableCollection & tables,
mlir::Operation * origin,
const Range & types )

Ensure that all symbols used within all Type instances can be resolved.

Definition at line 182 of file SymbolHelper.h.

◆ verifyTypeResolution() [2/3]

mlir::LogicalResult llzk::verifyTypeResolution ( mlir::SymbolTableCollection & tables,
mlir::Operation * origin,
mlir::Type type )

Ensure that all symbols used within the given Type instance can be resolved.

◆ verifyTypeResolution() [3/3]

LogicalResult llzk::verifyTypeResolution ( SymbolTableCollection & tables,
Operation * origin,
Type ty )

Definition at line 447 of file SymbolHelper.cpp.

◆ wrapNonNullableInFlightDiagnostic()

OwningEmitErrorFn llzk::wrapNonNullableInFlightDiagnostic ( llvm::function_ref< mlir::InFlightDiagnostic()> emitError)
inline

Definition at line 186 of file ErrorHelper.h.

◆ wrapNullableInFlightDiagnostic()

OwningEmitErrorFn llzk::wrapNullableInFlightDiagnostic ( llvm::function_ref< mlir::InFlightDiagnostic()> emitError,
mlir::MLIRContext * ctx )
inline

If the given emitError is non-null, return it.

Otherwise, mirror how the verification failure is handled by *Type::get() via StorageUserBase (i.e., use DefaultDiagnosticEmitFn and assert after reporting the error).

NOTE: Passing emitError == null is not a common use case since it will always result in an assertion failure immediately after reporting the error; likely only useful in custom type builders.

SEE: https://github.com/llvm/llvm-project/blob/0897373f1a329a7a02f8ce3c501a05d2f9c89390/mlir/include/mlir/IR/StorageUniquerSupport.h#L179-L180

Definition at line 175 of file ErrorHelper.h.

Variable Documentation

◆ DERIVED_ATTR_NAME

char llzk::DERIVED_ATTR_NAME[] = "llzk.derived"
constexpr

Name of the attribute on a @product func that has been automatically aligned from @compute + @constrain funcs, or on @compute and @constrain funcs that have been automatically projected from a @product func.

Definition at line 28 of file Constants.h.

◆ FIELD_ATTR_NAME

char llzk::FIELD_ATTR_NAME[] = "llzk.fields"
constexpr

Name of the attribute on the top-level ModuleOp that defines prime fields used in the circuit.

Definition at line 32 of file Constants.h.

◆ FUNC_NAME_COMPUTE

char llzk::FUNC_NAME_COMPUTE[] = "compute"
constexpr

Symbol name for the witness generation (and resp.

constraint generation) functions within a component.

Definition at line 16 of file Constants.h.

◆ FUNC_NAME_CONSTRAIN

char llzk::FUNC_NAME_CONSTRAIN[] = "constrain"
constexpr

Definition at line 17 of file Constants.h.

◆ FUNC_NAME_PRODUCT

char llzk::FUNC_NAME_PRODUCT[] = "product"
constexpr

Definition at line 18 of file Constants.h.

◆ INDEX_WIDTH

int llzk::INDEX_WIDTH = 64
constexpr

Definition at line 40 of file LLZKFuseProductLoopsPass.cpp.

◆ LANG_ATTR_NAME

char llzk::LANG_ATTR_NAME[] = "llzk.lang"
constexpr

Name of the attribute on the top-level ModuleOp that identifies the ModuleOp as the root module and specifies the frontend language name that the IR was compiled from, if available.

Definition at line 23 of file Constants.h.

◆ MAIN_ATTR_NAME

char llzk::MAIN_ATTR_NAME[] = "llzk.main"
constexpr

Name of the attribute on the top-level ModuleOp that specifies the type of the main struct.

This attribute can appear zero or one times on the top-level ModuleOp and is associated with a TypeAttr specifying the StructType of the main struct.

Definition at line 37 of file Constants.h.

◆ PRODUCT_SOURCE

char llzk::PRODUCT_SOURCE[] = "product_source"
constexpr

Name of the attribute on aligned product program ops that specifies where they came from.

Definition at line 40 of file Constants.h.