-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Description
Currently, it is not possible to define custom constraints in a portable manner. The c_pred escape hatch exists for TableGen portability reasons, but it is not portable at all and should be treated as a last resort solution.
Instead, we should offer a way to expose custom constraints infrastructure that is as portable as possible. One idea to achieve this would be to offer arbitrary imperative MLIR IR regions that take as input a representation of the IR element to verify and that return whether it is a match. This would be portable in the sense that the dialects used in the region can then offer a lowering to whatever the IRDL target is (maybe LLVM IR for an MLIR-based dialect, SMT dialect for the purposes of formal verification, etc.)
This might depend on introducing an in-IR way to interface with IR constructs. Maybe an mlir MLIR dialect that models the existing IR APIs?
Contact points: @Moxinilian