[all-commits] [llvm/llvm-project] 5ba236: [mlir][ODS] Optionally generate public C++ functio...
Matthias Springer via All-commits
all-commits at lists.llvm.org
Mon Aug 19 01:15:26 PDT 2024
Branch: refs/heads/users/matthias-springer/type_constr_cpp_function
Home: https://github.com/llvm/llvm-project
Commit: 5ba236fd6728a5c654991053e34668a24828c8fd
https://github.com/llvm/llvm-project/commit/5ba236fd6728a5c654991053e34668a24828c8fd
Author: Matthias Springer <mspringer at nvidia.com>
Date: 2024-08-19 (Mon, 19 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.)
Commit: 82d69f29e82cc999aeada0e0f6f126e80d75888a
https://github.com/llvm/llvm-project/commit/82d69f29e82cc999aeada0e0f6f126e80d75888a
Author: Matthias Springer <mspringer at nvidia.com>
Date: 2024-08-19 (Mon, 19 Aug 2024)
Changed paths:
M mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp
Log Message:
-----------
address comments
Compare: https://github.com/llvm/llvm-project/compare/83e7d34c2fe0...82d69f29e82c
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