[all-commits] [llvm/llvm-project] a3d418: [mlir][ODS] Optionally generate public C++ functio...
Matthias Springer via All-commits
all-commits at lists.llvm.org
Tue Aug 20 23:45:16 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: a3d41879ecf5690a73f9226951d3856c7faa34a4
https://github.com/llvm/llvm-project/commit/a3d41879ecf5690a73f9226951d3856c7faa34a4
Author: Matthias Springer <me at m-sp.org>
Date: 2024-08-21 (Wed, 21 Aug 2024)
Changed paths:
A mlir/docs/DefiningDialects/Constraints.md
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 (#104577)
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.
`#include`s could cause duplicate definitions of the same type
constraint.
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