|
LLZK 3.0.0
An open-source IR for Zero Knowledge (ZK) circuits
|
#include <mlir/TableGen/Dialect.h>#include <llvm/ADT/StringExtras.h>#include <llvm/ADT/StringRef.h>#include <llvm/ADT/StringSwitch.h>#include <llvm/Support/CommandLine.h>#include <llvm/Support/FormatVariadic.h>#include <memory>#include <string>Go to the source code of this file.
Classes | |
| class | ClangLexerContext |
| RAII wrapper for Clang lexer infrastructure. More... | |
| struct | MethodParameter |
| Structure to represent a parameter in a parsed method signature from an extraClassDeclaration. More... | |
| struct | ExtraMethod |
| Structure to represent a parsed method signature from an extraClassDeclaration. More... | |
| struct | Generator |
| Base class for C API generators. More... | |
| struct | HeaderGenerator |
| Generator for common C header file elements. More... | |
| struct | ImplementationGenerator |
| Generator for common C implementation file elements. More... | |
| struct | TestGenerator |
| Generator for common test implementation file elements. More... | |
Namespaces | |
| namespace | clang |
| namespace | mlir |
| namespace | mlir::tblgen |
Functions | |
| template<typename S> | |
| void | warnSkipped (const S &methodName, const std::string &message) |
| Print warning about skipping a function. | |
| template<typename S> | |
| void | warnSkippedNoConversion (const S &methodName, const std::string &cppType) |
| Print warning about skipping a function due to no conversion of C++ type to C API type. | |
| llvm::cl::opt< std::string > & | getDialectName () |
| Return the DialectName option, registering it on first access. | |
| llvm::cl::opt< std::string > & | getFunctionPrefix () |
| Return the FunctionPrefix option, registering it on first access. | |
| llvm::cl::opt< bool > & | getGenIsA () |
| Return the GenIsA option, registering it on first access. | |
| llvm::cl::opt< bool > & | getGenOpBuild () |
| Return the GenOpBuild option, registering it on first access. | |
| llvm::cl::opt< bool > & | getGenOpOperandGetters () |
| Return the GenOpOperandGetters option, registering it on first access. | |
| llvm::cl::opt< bool > & | getGenOpOperandSetters () |
| Return the GenOpOperandSetters option, registering it on first access. | |
| llvm::cl::opt< bool > & | getGenOpAttributeGetters () |
| Return the GenOpAttributeGetters option, registering it on first access. | |
| llvm::cl::opt< bool > & | getGenOpAttributeSetters () |
| Return the GenOpAttributeSetters option, registering it on first access. | |
| llvm::cl::opt< bool > & | getGenOpRegionGetters () |
| Return the GenOpRegionGetters option, registering it on first access. | |
| llvm::cl::opt< bool > & | getGenOpResultGetters () |
| Return the GenOpResultGetters option, registering it on first access. | |
| llvm::cl::opt< bool > & | getGenTypeOrAttrGet () |
| Return the GenTypeOrAttrGet option, registering it on first access. | |
| llvm::cl::opt< bool > & | getGenTypeOrAttrParamGetters () |
| Return the GenTypeOrAttrParamGetters option, registering it on first access. | |
| llvm::cl::opt< bool > & | getGenExtraClassMethods () |
| Return the GenExtraClassMethods option, registering it on first access. | |
| std::string | toPascalCase (mlir::StringRef str) |
| Convert names separated by underscore or colon to PascalCase. | |
| bool | isIntegerType (mlir::StringRef type) |
| Check if a C++ type is a known integer type. | |
| bool | isPrimitiveType (mlir::StringRef cppType) |
| Check if a C++ type is a known primitive type. | |
| bool | isCppModifierKeyword (mlir::StringRef tokenText) |
| Check if a token text represents a C++ modifier/specifier keyword. | |
| bool | isCppLanguageConstruct (mlir::StringRef methodName) |
| Check if a method name represents a C++ control flow keyword or language construct. | |
| bool | isDynamicAPIntType (mlir::StringRef cppType) |
| Whether a parameter represents an arbitrary-precision mathematical integer. | |
| bool | isArrayRefType (mlir::StringRef cppType) |
| Check if a C++ type is an ArrayRef type. | |
| mlir::StringRef | extractArrayRefElementType (mlir::StringRef cppType) |
| Extract element type from ArrayRef<...>. | |
| llvm::SmallVector< ExtraMethod > | getCAPIExposedOpMethods (const mlir::tblgen::Operator &op) |
| Return public operation methods explicitly requested by DeclareOpInterfaceMethods traits and declared by extraClassDeclaration. | |
| llvm::SmallVector< ExtraMethod > | parseExtraMethods (mlir::StringRef extraDecl) |
| Parse method declarations from an extraClassDeclaration using Clang's Lexer. | |
| bool | matchesMLIRClass (mlir::StringRef cppType, mlir::StringRef typeName) |
| Check if a C++ type matches an MLIR type pattern. | |
| std::optional< std::string > | tryCppTypeToCapiType (mlir::StringRef cppType) |
| Convert C++ type to MLIR C API type. | |
| std::string | mapCppTypeToCapiType (mlir::StringRef cppType) |
| Map C++ type to corresponding C API type. | |
| std::optional< std::string > | mapCapiTypeToBasicCppType (mlir::StringRef capiType) |
| Map C API type to corresponding basic (not dialect-defined) C++ type. | |
Variables | |
| constexpr bool | WARN_SKIPPED_METHODS = false |
|
inline |
Extract element type from ArrayRef<...>.
Definition at line 219 of file CommonCAPIGen.h.
| llvm::SmallVector< ExtraMethod > getCAPIExposedOpMethods | ( | const mlir::tblgen::Operator & | op | ) |
Return public operation methods explicitly requested by DeclareOpInterfaceMethods traits and declared by extraClassDeclaration.
Interface methods must be named in alwaysOverriddenMethods (the optional method list passed to DeclareOpInterfaceMethods). This makes C API exposure an explicit opt-in and avoids colliding with the standard op C API accessors. Static methods and methods implemented directly in an interface trait are excluded. An extra class method takes precedence over an interface method with the same name, because the C API does not support overloads.
Definition at line 20 of file OpCAPIParamHelper.cpp.
| llvm::cl::opt< std::string > & getDialectName | ( | ) |
Return the DialectName option, registering it on first access.
Definition at line 37 of file CommonCAPIGen.cpp.
| llvm::cl::opt< std::string > & getFunctionPrefix | ( | ) |
Return the FunctionPrefix option, registering it on first access.
Definition at line 49 of file CommonCAPIGen.cpp.
| llvm::cl::opt< bool > & getGenExtraClassMethods | ( | ) |
Return the GenExtraClassMethods option, registering it on first access.
Definition at line 142 of file CommonCAPIGen.cpp.
| llvm::cl::opt< bool > & getGenIsA | ( | ) |
Return the GenIsA option, registering it on first access.
Definition at line 61 of file CommonCAPIGen.cpp.
| llvm::cl::opt< bool > & getGenOpAttributeGetters | ( | ) |
Return the GenOpAttributeGetters option, registering it on first access.
Definition at line 93 of file CommonCAPIGen.cpp.
| llvm::cl::opt< bool > & getGenOpAttributeSetters | ( | ) |
Return the GenOpAttributeSetters option, registering it on first access.
Definition at line 101 of file CommonCAPIGen.cpp.
| llvm::cl::opt< bool > & getGenOpBuild | ( | ) |
Return the GenOpBuild option, registering it on first access.
Definition at line 69 of file CommonCAPIGen.cpp.
| llvm::cl::opt< bool > & getGenOpOperandGetters | ( | ) |
Return the GenOpOperandGetters option, registering it on first access.
Definition at line 77 of file CommonCAPIGen.cpp.
| llvm::cl::opt< bool > & getGenOpOperandSetters | ( | ) |
Return the GenOpOperandSetters option, registering it on first access.
Definition at line 85 of file CommonCAPIGen.cpp.
| llvm::cl::opt< bool > & getGenOpRegionGetters | ( | ) |
Return the GenOpRegionGetters option, registering it on first access.
Definition at line 109 of file CommonCAPIGen.cpp.
| llvm::cl::opt< bool > & getGenOpResultGetters | ( | ) |
Return the GenOpResultGetters option, registering it on first access.
Definition at line 117 of file CommonCAPIGen.cpp.
| llvm::cl::opt< bool > & getGenTypeOrAttrGet | ( | ) |
Return the GenTypeOrAttrGet option, registering it on first access.
Definition at line 125 of file CommonCAPIGen.cpp.
| llvm::cl::opt< bool > & getGenTypeOrAttrParamGetters | ( | ) |
Return the GenTypeOrAttrParamGetters option, registering it on first access.
Definition at line 133 of file CommonCAPIGen.cpp.
|
inline |
Check if a C++ type is an ArrayRef type.
| cppType | The C++ type string to check |
Definition at line 212 of file CommonCAPIGen.h.
|
inline |
Check if a method name represents a C++ control flow keyword or language construct.
| methodName | The method name to check |
Definition at line 187 of file CommonCAPIGen.h.
|
inline |
Check if a token text represents a C++ modifier/specifier keyword.
| tokenText | The token to check |
Definition at line 170 of file CommonCAPIGen.h.
|
inline |
Whether a parameter represents an arbitrary-precision mathematical integer.
Definition at line 204 of file CommonCAPIGen.h.
|
inline |
Check if a C++ type is a known integer type.
| type | The type string to check |
Definition at line 125 of file CommonCAPIGen.h.
|
inline |
Check if a C++ type is a known primitive type.
| cppType | The C++ type string to check |
Definition at line 161 of file CommonCAPIGen.h.
| std::optional< std::string > mapCapiTypeToBasicCppType | ( | mlir::StringRef | capiType | ) |
Map C API type to corresponding basic (not dialect-defined) C++ type.
| capiType | The C API type to map |
| std::string mapCppTypeToCapiType | ( | mlir::StringRef | cppType | ) |
Map C++ type to corresponding C API type.
| cppType | The C++ type to map |
| bool matchesMLIRClass | ( | mlir::StringRef | cppType, |
| mlir::StringRef | typeName ) |
Check if a C++ type matches an MLIR type pattern.
| cppType | The C++ type to check |
| typeName | The MLIR type name to match against |
| llvm::SmallVector< ExtraMethod > parseExtraMethods | ( | mlir::StringRef | extraDecl | ) |
Parse method declarations from an extraClassDeclaration using Clang's Lexer.
| extraDecl | The C++ code from an extraClassDeclaration |
This function parses C++ method declarations to extract signatures that can be wrapped in C API functions. It identifies methods by looking for the pattern: [modifiers] <return_type> <identifier> '(' [params] ')' [const] ';'
Example input:
Example output:
|
inline |
Convert names separated by underscore or colon to PascalCase.
| str | The input string to convert (may contain underscores or colons) |
Examples: "no_inline" -> "NoInline" "::llzk::boolean::Type" -> "LlzkBooleanType"
Definition at line 100 of file CommonCAPIGen.h.
| std::optional< std::string > tryCppTypeToCapiType | ( | mlir::StringRef | cppType | ) |
Convert C++ type to MLIR C API type.
| cppType | The C++ type to convert |
|
inline |
Print warning about skipping a function.
Definition at line 30 of file CommonCAPIGen.h.
|
inline |
Print warning about skipping a function due to no conversion of C++ type to C API type.
Definition at line 38 of file CommonCAPIGen.h.
|
constexpr |
Definition at line 27 of file CommonCAPIGen.h.