|
LLZK 2.0.0
An open-source IR for Zero Knowledge (ZK) circuits
|
A reference to a "source", which is the base value from which other SSA values are derived. More...
#include <SourceRef.h>
Classes | |
| struct | Hash |
Public Types | |
| using | Path = std::vector<SourceRefIndex> |
Public Member Functions | |
| SourceRef (mlir::BlockArgument b, Path p={}) | |
| SourceRef (component::CreateStructOp createOp, Path p={}) | |
| SourceRef (NonDetOp nondet, Path p={}) | |
| SourceRef (mlir::OpResult rootResult, Path p={}) | |
| SourceRef (felt::FeltConstantOp c) | |
| SourceRef (mlir::arith::ConstantIndexOp c) | |
| SourceRef (polymorphic::ConstReadOp c) | |
| mlir::Type | getType () const |
| bool | isConstantFelt () const |
| bool | isConstantIndex () const |
| bool | isTemplateConstant () const |
| bool | isConstant () const |
| bool | isConstantInt () const |
| bool | isFeltVal () const |
| bool | isIndexVal () const |
| bool | isIntegerVal () const |
| bool | isTypeVarVal () const |
| bool | isScalar () const |
| bool | isRooted () const |
| bool | isBlockArgument () const |
| mlir::FailureOr< mlir::Value > | getRoot () const |
| mlir::FailureOr< mlir::Value > | getConstant () const |
| mlir::FailureOr< mlir::BlockArgument > | getBlockArgument () const |
| mlir::FailureOr< unsigned > | getInputNum () const |
| bool | isCreateStructOp () const |
| mlir::FailureOr< component::CreateStructOp > | getCreateStructOp () const |
| bool | isNonDetOp () const |
| mlir::FailureOr< NonDetOp > | getNonDetOp () const |
| bool | isCallResult () const |
| mlir::FailureOr< function::CallOp > | getCallOp () const |
| mlir::FailureOr< llvm::DynamicAPInt > | getConstantFeltValue () const |
| mlir::FailureOr< llvm::DynamicAPInt > | getConstantIndexValue () const |
| mlir::FailureOr< llvm::DynamicAPInt > | getConstantValue () const |
| bool | isValidPrefix (const SourceRef &prefix) const |
| Returns true iff prefix is a valid prefix of this reference. | |
| mlir::FailureOr< std::vector< SourceRefIndex > > | getSuffix (const SourceRef &prefix) const |
| If prefix is a valid prefix of this reference, return the suffix that remains after removing the prefix. | |
| mlir::FailureOr< SourceRef > | translate (const SourceRef &prefix, const SourceRef &other) const |
| Create a new reference with prefix replaced with other iff prefix is a valid prefix for this reference. | |
| mlir::FailureOr< SourceRef > | getParentPrefix () const |
| Create a new reference that is the immediate prefix of this reference if possible. | |
| std::vector< SourceRef > | getAllChildren (mlir::SymbolTableCollection &tables, mlir::ModuleOp mod) const |
| Get all direct children of this SourceRef, assuming this ref is not a scalar. | |
| mlir::FailureOr< SourceRef > | createChild (const SourceRefIndex &r) const |
| mlir::FailureOr< SourceRef > | createChild (const SourceRef &other) const |
| llvm::ArrayRef< SourceRefIndex > | getPieces () const |
| llvm::ArrayRef< SourceRefIndex > | getPath () const |
| void | print (mlir::raw_ostream &os) const |
| void | dump () const |
| bool | operator== (const SourceRef &rhs) const |
| bool | operator!= (const SourceRef &rhs) const |
| std::strong_ordering | operator<=> (const SourceRef &rhs) const |
Static Public Member Functions | |
| static std::vector< SourceRef > | getAllSourceRefs (mlir::SymbolTableCollection &tables, mlir::ModuleOp mod, const SourceRef &root) |
| Produce all possible SourceRefs that are present starting from the given root. | |
| static std::vector< SourceRef > | getAllSourceRefs (component::StructDefOp structDef, function::FuncDefOp fnOp) |
| Produce all possible SourceRefs that are present from given struct function. | |
| static std::vector< SourceRef > | getAllSourceRefs (component::StructDefOp structDef, component::MemberDefOp memberDef) |
| Produce all possible SourceRefs from a specific member in a struct. | |
Friends | |
| struct | llvm::DenseMapInfo< SourceRef > |
A reference to a "source", which is the base value from which other SSA values are derived.
The object may be a reference to an individual felt, felt.const, or a composite type, like an array or an entire struct.
These references are relative to a particular function call, so they are either (1) constants, or (2) rooted at a value (e.g., self, a nondet op, an external call result, an array.new result, an array.read result, or another block argument), and optionally contain indices into root (e.g., a member reference in a struct or a index into an array).
Definition at line 132 of file SourceRef.h.
| using llzk::SourceRef::Path = std::vector<SourceRefIndex> |
Definition at line 134 of file SourceRef.h.
|
inline |
Definition at line 201 of file SourceRef.h.
|
inline |
Definition at line 202 of file SourceRef.h.
Definition at line 204 of file SourceRef.h.
|
inline |
Definition at line 206 of file SourceRef.h.
|
inlineexplicit |
Definition at line 211 of file SourceRef.h.
|
inlineexplicit |
Definition at line 213 of file SourceRef.h.
|
inlineexplicit |
Definition at line 215 of file SourceRef.h.
Definition at line 348 of file SourceRef.h.
|
inline |
Definition at line 339 of file SourceRef.h.
|
inline |
Definition at line 364 of file SourceRef.h.
| std::vector< SourceRef > llzk::SourceRef::getAllChildren | ( | mlir::SymbolTableCollection & | tables, |
| mlir::ModuleOp | mod ) const |
Get all direct children of this SourceRef, assuming this ref is not a scalar.
Definition at line 411 of file SourceRef.cpp.
|
static |
Produce all possible SourceRefs from a specific member in a struct.
May produce multiple if the given member is of an aggregate type.
Definition at line 272 of file SourceRef.cpp.
|
static |
Produce all possible SourceRefs that are present from given struct function.
Definition at line 243 of file SourceRef.cpp.
|
static |
Produce all possible SourceRefs that are present starting from the given root.
|
inline |
Definition at line 256 of file SourceRef.h.
|
inline |
Definition at line 279 of file SourceRef.h.
|
inline |
Definition at line 250 of file SourceRef.h.
|
inline |
Definition at line 281 of file SourceRef.h.
|
inline |
Definition at line 289 of file SourceRef.h.
|
inline |
Definition at line 296 of file SourceRef.h.
|
inline |
Definition at line 271 of file SourceRef.h.
|
inline |
Definition at line 262 of file SourceRef.h.
|
inline |
Definition at line 276 of file SourceRef.h.
|
inline |
Create a new reference that is the immediate prefix of this reference if possible.
Definition at line 326 of file SourceRef.h.
|
inline |
Definition at line 361 of file SourceRef.h.
|
inline |
Definition at line 358 of file SourceRef.h.
|
inline |
Definition at line 244 of file SourceRef.h.
| FailureOr< SourceRef::Path > llzk::SourceRef::getSuffix | ( | const SourceRef & | prefix | ) | const |
If prefix is a valid prefix of this reference, return the suffix that remains after removing the prefix.
I.e., this = prefix + suffix
| prefix |
Definition at line 337 of file SourceRef.cpp.
| Type llzk::SourceRef::getType | ( | ) | const |
Definition at line 291 of file SourceRef.cpp.
|
inline |
Definition at line 243 of file SourceRef.h.
|
inline |
Definition at line 278 of file SourceRef.h.
|
inline |
Definition at line 231 of file SourceRef.h.
|
inline |
Definition at line 220 of file SourceRef.h.
|
inline |
Definition at line 223 of file SourceRef.h.
|
inline |
Definition at line 232 of file SourceRef.h.
|
inline |
Definition at line 270 of file SourceRef.h.
|
inline |
Definition at line 234 of file SourceRef.h.
|
inline |
Definition at line 235 of file SourceRef.h.
|
inline |
Definition at line 236 of file SourceRef.h.
|
inline |
Definition at line 275 of file SourceRef.h.
|
inline |
Definition at line 242 of file SourceRef.h.
|
inline |
Definition at line 238 of file SourceRef.h.
|
inline |
Definition at line 227 of file SourceRef.h.
|
inline |
Definition at line 237 of file SourceRef.h.
| bool llzk::SourceRef::isValidPrefix | ( | const SourceRef & | prefix | ) | const |
Returns true iff prefix is a valid prefix of this reference.
Definition at line 319 of file SourceRef.cpp.
|
inline |
Definition at line 368 of file SourceRef.h.
| std::strong_ordering llzk::SourceRef::operator<=> | ( | const SourceRef & | rhs | ) | const |
Definition at line 475 of file SourceRef.cpp.
| bool llzk::SourceRef::operator== | ( | const SourceRef & | rhs | ) | const |
Definition at line 465 of file SourceRef.cpp.
| void llzk::SourceRef::print | ( | mlir::raw_ostream & | os | ) | const |
Definition at line 422 of file SourceRef.cpp.
| FailureOr< SourceRef > llzk::SourceRef::translate | ( | const SourceRef & | prefix, |
| const SourceRef & | other ) const |
Create a new reference with prefix replaced with other iff prefix is a valid prefix for this reference.
If this reference is a felt.const, the translation will always succeed and return the felt.const unchanged.
| prefix | |
| other |
Definition at line 351 of file SourceRef.cpp.
|
friend |
Definition at line 371 of file SourceRef.h.