|
LLZK 3.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. | |
| bool | overlaps (const SourceRef &rhs) const |
| Return true when both references select overlapping storage at the same path depth. | |
| 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 146 of file SourceRef.h.
| using llzk::SourceRef::Path = std::vector<SourceRefIndex> |
Definition at line 148 of file SourceRef.h.
|
inline |
Definition at line 215 of file SourceRef.h.
|
inline |
Definition at line 217 of file SourceRef.h.
Definition at line 219 of file SourceRef.h.
|
inline |
Definition at line 221 of file SourceRef.h.
|
inlineexplicit |
Definition at line 226 of file SourceRef.h.
|
inlineexplicit |
Definition at line 228 of file SourceRef.h.
|
inlineexplicit |
Definition at line 230 of file SourceRef.h.
Definition at line 366 of file SourceRef.h.
|
inline |
Definition at line 357 of file SourceRef.h.
|
inline |
Definition at line 382 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 480 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 323 of file SourceRef.cpp.
|
static |
Produce all possible SourceRefs that are present from given struct function.
Definition at line 294 of file SourceRef.cpp.
|
static |
Produce all possible SourceRefs that are present starting from the given root.
|
inline |
Definition at line 271 of file SourceRef.h.
|
inline |
Definition at line 294 of file SourceRef.h.
|
inline |
Definition at line 265 of file SourceRef.h.
|
inline |
Definition at line 296 of file SourceRef.h.
|
inline |
Definition at line 304 of file SourceRef.h.
|
inline |
Definition at line 311 of file SourceRef.h.
|
inline |
Definition at line 286 of file SourceRef.h.
|
inline |
Definition at line 277 of file SourceRef.h.
|
inline |
Definition at line 291 of file SourceRef.h.
|
inline |
Create a new reference that is the immediate prefix of this reference if possible.
Definition at line 344 of file SourceRef.h.
|
inline |
Definition at line 379 of file SourceRef.h.
|
inline |
Definition at line 376 of file SourceRef.h.
|
inline |
Definition at line 259 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 396 of file SourceRef.cpp.
| Type llzk::SourceRef::getType | ( | ) | const |
Definition at line 342 of file SourceRef.cpp.
|
inline |
Definition at line 258 of file SourceRef.h.
|
inline |
Definition at line 293 of file SourceRef.h.
|
inline |
Definition at line 246 of file SourceRef.h.
|
inline |
Definition at line 235 of file SourceRef.h.
|
inline |
Definition at line 238 of file SourceRef.h.
|
inline |
Definition at line 247 of file SourceRef.h.
|
inline |
Definition at line 285 of file SourceRef.h.
|
inline |
Definition at line 249 of file SourceRef.h.
|
inline |
Definition at line 250 of file SourceRef.h.
|
inline |
Definition at line 251 of file SourceRef.h.
|
inline |
Definition at line 290 of file SourceRef.h.
|
inline |
Definition at line 257 of file SourceRef.h.
|
inline |
Definition at line 253 of file SourceRef.h.
|
inline |
Definition at line 242 of file SourceRef.h.
|
inline |
Definition at line 252 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 369 of file SourceRef.cpp.
|
inline |
Definition at line 386 of file SourceRef.h.
| std::strong_ordering llzk::SourceRef::operator<=> | ( | const SourceRef & | rhs | ) | const |
Definition at line 611 of file SourceRef.cpp.
| bool llzk::SourceRef::operator== | ( | const SourceRef & | rhs | ) | const |
Definition at line 601 of file SourceRef.cpp.
| bool llzk::SourceRef::overlaps | ( | const SourceRef & | rhs | ) | const |
Return true when both references select overlapping storage at the same path depth.
Definition at line 387 of file SourceRef.cpp.
| void llzk::SourceRef::print | ( | mlir::raw_ostream & | os | ) | const |
Definition at line 550 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 410 of file SourceRef.cpp.
|
friend |
Definition at line 389 of file SourceRef.h.