LLZK 2.1.1
An open-source IR for Zero Knowledge (ZK) circuits
Loading...
Searching...
No Matches
LLZKConversionUtils.h File Reference
#include "llzk/Dialect/Function/IR/Ops.h"
#include "llzk/Dialect/Struct/IR/Ops.h"
#include "llzk/Util/Concepts.h"
#include <mlir/IR/PatternMatch.h>
#include <mlir/IR/SymbolTable.h>
#include <mlir/Transforms/DialectConversion.h>
#include <llvm/ADT/DenseMap.h>
#include <llvm/ADT/StringSet.h>
#include <llvm/ADT/Twine.h>
#include <optional>
#include <string>
Include dependency graph for LLZKConversionUtils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  llzk::SplitFunctionNameInfo
 Cached function arg/result names and split suffixes used while rewriting a function signature. More...
class  llzk::FunctionTypeConverter
 General helper for converting a FuncDefOp by changing its input and/or result types and the associated attributes for those types. More...
class  llzk::SplitAggregateInMemberRefOp< ImplClass, MemberRefOpClass, GenHeaderType, IdType >
 Common implementation for handling MemberWriteOp and MemberReadOp while destructuring an aggregate type (e.g., ArrayType or PodType) stored in a struct member. More...

Namespaces

namespace  llzk

Functions

mlir::DictionaryAttr llzk::withFunctionNameAttr (mlir::DictionaryAttr attrs, llvm::StringRef attrName, llvm::StringRef name)
 Return a copy of the given function argument/result attribute dictionary with attrName set to name.
mlir::DictionaryAttr llzk::withFunctionArgNameAttr (mlir::DictionaryAttr attrs, llvm::StringRef name)
 Return a copy of the given argument attribute dictionary with function.arg_name set to name.
mlir::DictionaryAttr llzk::withFunctionResNameAttr (mlir::DictionaryAttr attrs, llvm::StringRef name)
 Return a copy of the given result attribute dictionary with function.res_name set to name.
std::string llzk::reserveUniqueAttrName (llvm::StringSet<> &usedNames, llvm::StringRef desiredName)
 Reserve and return a unique function argument/result name based on desiredName.
std::optional< mlir::StringAttr > llzk::getAttrAtIndexWithName (mlir::ArrayAttr attrs, unsigned index, llvm::StringRef attrName)
 Return the function arg/result attribute at index for the given name, if present.
template<typename GetNameAttrFn, typename GetSplitSuffixesFn>
SplitFunctionNameInfo llzk::collectSplitFunctionNameInfo (mlir::ArrayRef< mlir::Type > origTypes, GetNameAttrFn &&getNameAttr, GetSplitSuffixesFn &&getSplitSuffixes)
 Collect function arg/result names and split suffixes from a list of original types.
mlir::ArrayAttr llzk::replicateFunctionNameAttrsAsNeeded (mlir::ArrayAttr origAttrs, const llvm::SmallVector< size_t > &originalIdxToSize, const llvm::SmallVector< mlir::Type > &newTypes, llvm::StringRef functionNameAttrName, llvm::ArrayRef< std::optional< llvm::StringRef > > origNames={}, llvm::ArrayRef< llvm::StringRef > existingNames={}, llvm::ArrayRef< llvm::SmallVector< std::string > > splitNameSuffixes={})
 Expand function arg/result attribute arrays to match a split signature, rewriting name attrs with the provided suffixes where available.
function::CallOp llzk::createCallPreservingInstantiationOperands (mlir::Location loc, mlir::TypeRange newResultTypes, function::CallOp oldCall, llvm::ArrayRef< mlir::ValueRange > mapOperands, mlir::ValueRange argOperands, mlir::ConversionPatternRewriter &rewriter)
 Rebuild a function.call while preserving explicit instantiation state from oldCall.