mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-25 06:26:06 +00:00

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.)
MLIR documentation ================== Please note mlir.llvm.org is where MLIR's rendered documentation is displayed. The viewing experience on GitHub or elsewhere may not match those of the website. For any changes please verify instead that they work on the main website first. See https://github.com/llvm/mlir-www for the website generation information.