[mlir:PDLL] Rework the C++ generation of native Constraint/Rewrite arguments and resultsThe current translation uses the old "ugly"/"raw" form which used PDLValue for the argumentsand results. Thi
[mlir:PDLL] Rework the C++ generation of native Constraint/Rewrite arguments and resultsThe current translation uses the old "ugly"/"raw" form which used PDLValue for the argumentsand results. This commit updates the C++ generation to use the recently added sugar thatallows for directly using the desired types for the arguments and result of PDL functions.In addition, this commit also properly imports the C++ class for ODS operations, constraints,and interfaces. This allows for a much more convienent C++ API than previously grantedwith the raw/low-level types.Differential Revision: https://reviews.llvm.org/D124817
show more ...
[mlir:PDL] Expand how native constraint/rewrite functions can be definedThis commit refactors the expected form of native constraint and rewritefunctions, and greatly reduces the necessary user co
[mlir:PDL] Expand how native constraint/rewrite functions can be definedThis commit refactors the expected form of native constraint and rewritefunctions, and greatly reduces the necessary user complexity required whendefining a native function. Namely, this commit adds in automatic processingof the necessary PDLValue glue code, and allows for users to defineconstraint/rewrite functions using the C++ types that they actually want touse.As an example, lets see a simple example rewrite defined today:```static void rewriteFn(PatternRewriter &rewriter, PDLResultList &results, ArrayRef<PDLValue> args) { ValueRange operandValues = args[0].cast<ValueRange>(); TypeRange typeValues = args[1].cast<TypeRange>(); ... // Create an operation at some point and pass it back to PDL. Operation *op = rewriter.create<SomeOp>(...); results.push_back(op);}```After this commit, that same rewrite could be defined as:```static Operation *rewriteFn(PatternRewriter &rewriter ValueRange operandValues, TypeRange typeValues) { ... // Create an operation at some point and pass it back to PDL. return rewriter.create<SomeOp>(...);}```Differential Revision: https://reviews.llvm.org/D122086
[mlir:PDL] Remove the ConstantParams support from native Constraints/RewritesThis support has never really worked well, and is incredibly clunky touse (it effectively creates two argument APIs), a
[mlir:PDL] Remove the ConstantParams support from native Constraints/RewritesThis support has never really worked well, and is incredibly clunky touse (it effectively creates two argument APIs), and clunky to generate (it isn'tclear how we should actually expose this from PDL frontends). Treating theseas just attribute arguments is much much cleaner in every aspect of the stack.If we need to optimize lots of constant parameters, it would be better toinvestigate internal representation optimizations (e.g. batch attribute creation),that do not affect the user (we want a clean external API).Differential Revision: https://reviews.llvm.org/D121569
[mlir:PDLL] Add support for C++ generationThis commits adds a C++ generator to PDLL that generates wrapper PDL patternsdirectly usable in C++ code, and also generates the definitions of native con
[mlir:PDLL] Add support for C++ generationThis commits adds a C++ generator to PDLL that generates wrapper PDL patternsdirectly usable in C++ code, and also generates the definitions of native constraints/rewritesthat have code bodies specified in PDLL. This generator is effectively the PDLL equivalent ofthe current DRR generator, and will allow easy replacement of DRR patterns with PDLL patterns.A followup will start to utilize this for end-to-end integration testing and show case how touse this as a drop-in replacement for DRR tablegen usage.Differential Revision: https://reviews.llvm.org/D119781