LLZK 0.1.0
Veridise's ZK Language IR
Loading...
Searching...
No Matches
SymbolHelper.h File Reference
#include "llzk/Util/SymbolLookup.h"
#include <mlir/Interfaces/CallInterfaces.h>
#include <ranges>
Include dependency graph for SymbolHelper.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  llzk
 
namespace  llzk::component
 
namespace  llzk::function
 

Functions

llvm::SmallVector< mlir::StringRef > llzk::getNames (mlir::SymbolRefAttr ref)
 
llvm::SmallVector< mlir::FlatSymbolRefAttr > llzk::getPieces (mlir::SymbolRefAttr ref)
 
mlir::FlatSymbolRefAttr llzk::getFlatSymbolRefAttr (mlir::MLIRContext *context, const mlir::Twine &twine)
 Construct a FlatSymbolRefAttr with the given content.
 
mlir::SymbolRefAttr llzk::asSymbolRefAttr (mlir::StringAttr root, mlir::SymbolRefAttr tail)
 Build a SymbolRefAttr that prepends tail with root, i.e., root::tail.
 
mlir::SymbolRefAttr llzk::asSymbolRefAttr (llvm::ArrayRef< mlir::FlatSymbolRefAttr > path)
 Build a SymbolRefAttr from the list of pieces.
 
mlir::SymbolRefAttr llzk::asSymbolRefAttr (std::vector< mlir::FlatSymbolRefAttr > path)
 Build a SymbolRefAttr from the list of pieces.
 
mlir::SymbolRefAttr llzk::getTailAsSymbolRefAttr (mlir::SymbolRefAttr symbol)
 Return SymbolRefAttr like the one given but with the root/head element removed.
 
mlir::SymbolRefAttr llzk::getPrefixAsSymbolRefAttr (mlir::SymbolRefAttr symbol)
 Return SymbolRefAttr like the one given but with the leaf/final element removed.
 
mlir::SymbolRefAttr llzk::replaceLeaf (mlir::SymbolRefAttr orig, mlir::FlatSymbolRefAttr newLeaf)
 Return SymbolRefAttr like the one given but with the leaf (final) element replaced.
 
mlir::SymbolRefAttr llzk::replaceLeaf (mlir::SymbolRefAttr orig, mlir::StringAttr newLeaf)
 
mlir::SymbolRefAttr llzk::replaceLeaf (mlir::SymbolRefAttr orig, const mlir::Twine &newLeaf)
 
mlir::SymbolRefAttr llzk::appendLeaf (mlir::SymbolRefAttr orig, mlir::FlatSymbolRefAttr newLeaf)
 Return SymbolRefAttr like the one given but with a new leaf (final) element added.
 
mlir::SymbolRefAttr llzk::appendLeaf (mlir::SymbolRefAttr orig, mlir::StringAttr newLeaf)
 
mlir::SymbolRefAttr llzk::appendLeaf (mlir::SymbolRefAttr orig, const mlir::Twine &newLeaf)
 
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.
 
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.
 
mlir::FailureOr< mlir::SymbolRefAttr > llzk::getPathFromRoot (mlir::SymbolOpInterface to, mlir::ModuleOp *foundRoot=nullptr)
 
mlir::FailureOr< mlir::SymbolRefAttr > llzk::getPathFromRoot (component::StructDefOp &to, mlir::ModuleOp *foundRoot=nullptr)
 
mlir::FailureOr< mlir::SymbolRefAttr > llzk::getPathFromRoot (component::FieldDefOp &to, mlir::ModuleOp *foundRoot=nullptr)
 
mlir::FailureOr< mlir::SymbolRefAttr > llzk::getPathFromRoot (function::FuncDefOp &to, mlir::ModuleOp *foundRoot=nullptr)
 
mlir::FailureOr< mlir::ModuleOp > llzk::getTopRootModule (mlir::Operation *from)
 With include statements, there may be root modules nested within other root modules.
 
mlir::FailureOr< mlir::SymbolRefAttr > llzk::getPathFromTopRoot (mlir::SymbolOpInterface to, mlir::ModuleOp *foundRoot=nullptr)
 
mlir::FailureOr< mlir::SymbolRefAttr > llzk::getPathFromTopRoot (component::StructDefOp &to, mlir::ModuleOp *foundRoot=nullptr)
 
mlir::FailureOr< mlir::SymbolRefAttr > llzk::getPathFromTopRoot (component::FieldDefOp &to, mlir::ModuleOp *foundRoot=nullptr)
 
mlir::FailureOr< mlir::SymbolRefAttr > llzk::getPathFromTopRoot (function::FuncDefOp &to, mlir::ModuleOp *foundRoot=nullptr)
 
template<typename T>
mlir::FailureOr< SymbolLookupResult< T > > llzk::resolveCallable (mlir::SymbolTableCollection &symbolTable, mlir::CallOpInterface call)
 Based on mlir::CallOpInterface::resolveCallable, but using LLZK lookup helpers.
 
template<typename T>
mlir::FailureOr< SymbolLookupResult< T > > llzk::resolveCallable (mlir::CallOpInterface call)
 
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.
 
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.
 
mlir::FailureOr< component::StructDefOpllzk::verifyStructTypeResolution (mlir::SymbolTableCollection &tables, component::StructType ty, mlir::Operation *origin)
 Ensure that all symbols used within the type can be resolved.
 
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.
 
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.