[all-commits] [llvm/llvm-project] 83e7d3: [mlir][ODS] Optionally generate public C++ functio...
Matthias Springer via All-commits
all-commits at lists.llvm.org
Fri Aug 16 03:09:15 PDT 2024
Branch: refs/heads/users/matthias-springer/type_constr_cpp_function
Home: https://github.com/llvm/llvm-project
Commit: 83e7d34c2fe08c96056987316fea309e7d5928e6
https://github.com/llvm/llvm-project/commit/83e7d34c2fe08c96056987316fea309e7d5928e6
Author: Matthias Springer <mspringer at nvidia.com>
Date: 2024-08-16 (Fri, 16 Aug 2024)
Changed paths:
M mlir/include/mlir/IR/BuiltinTypes.h
M mlir/include/mlir/IR/BuiltinTypes.td
M mlir/include/mlir/IR/CMakeLists.txt
M mlir/include/mlir/IR/Constraints.td
M mlir/include/mlir/TableGen/Constraint.h
M mlir/lib/IR/BuiltinTypes.cpp
M mlir/lib/IR/CMakeLists.txt
M mlir/lib/TableGen/Constraint.cpp
A mlir/test/mlir-tblgen/type-constraints.td
M mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp
Log Message:
-----------
[mlir][ODS] Optionally generate public C++ functions for type constraints
Add `gen-type-constraint-decls` and `gen-type-constraint-defs`, which generate public C++ functions for type constraints. The name of the C++ function is specified in the `cppFunctionName` field.
Type constraints are typically used for op/type/attribute verification. They are also sometimes called from builders and transformations. Until now, this required duplicating the check in C++.
Note: This commit just adds the option for type constraints, but attribute constraints could be supported in the same way.
Alternatives considered:
1. The C++ functions could also be generated as part of `gen-typedef-decls/defs`, but that can be confusing because type constraints may rely on type definitions from multiple `.td` files.
2. The C++ functions could also be generated as static member functions of dialects, but they don't really belong to a dialect. (Because they may rely on type definitions from multiple dialects.)
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list