This changes the custom syntax of the emitc.include operation for standard includes.
Details
Diff Detail
Event Timeline
LGTM and I can commit on your behalf. However, as Mehdi suggested this change, I would like to wait for his feedback first.
mlir/lib/Dialect/EmitC/IR/EmitC.cpp | ||
---|---|---|
120 | nit: No trailing dot. |
mlir/include/mlir/Dialect/EmitC/IR/EmitC.td | ||
---|---|---|
143 | Good question! I struggled when initially choosing a name for the attribute. Following cppreference here, it seemed to me that standard_include might be more appropriate as they always talk about "standard include directories" but never about system includes. |
Nice!
mlir/test/Dialect/EmitC/ops.mlir | ||
---|---|---|
3 | This isn't quite usual, what are you trying to catch here? What is more common is to reparse the custom print instead to check that printer and parser are matching each other. |
mlir/test/Dialect/EmitC/ops.mlir | ||
---|---|---|
3 | Simon changed this after I proposed this change. It's actually adopting https://github.com/llvm/llvm-project/blob/3d48775b89cfcaa20dae9928f20410ee61bdda4c/mlir/test/Dialect/PDL/ops.mlir#L1-L3. |
mlir/test/Dialect/EmitC/ops.mlir | ||
---|---|---|
3 | I don't quite get the motivation actually, River is OOO for a couple of weeks, I can check with him when he'll popup online. In the meantime (unless you can explain why) I rather leave this out. |
mlir/test/Dialect/EmitC/ops.mlir | ||
---|---|---|
3 | Got confirmation from River:
|
mlir/test/Dialect/EmitC/ops.mlir | ||
---|---|---|
3 | Sry, I try to clarify. With the first mlir-opt we check if the custom form can be parsed. By adding the -mlir-print-op-generic, these emitc.include <"test.h"> emitc.include "test.h" get printed as "emitc.include"() {include = "test.h", is_standard_include} : () -> () "emitc.include"() {include = "test.h"} : () -> () which than get parsed afterwards. Thus both formats get parsed. This is how I understand the motivation in the PDL test and thus we adopted this. But leaving this out is fine as well. As proposed we can parse the custom format with the second mlir-opt call by removing -mlir-print-op-generic from the first call. |
mlir/test/Dialect/EmitC/ops.mlir | ||
---|---|---|
3 |
Yes, but what is the point? What are we testing with reparsing the generic format? |
mlir/test/Dialect/EmitC/ops.mlir | ||
---|---|---|
3 |
Indeed. As discussed on Discord we will change to mlir-opt | mlir-opt. |
mlir/lib/Dialect/EmitC/IR/EmitC.cpp | ||
---|---|---|
138 | With the latest revision a more explicit error message is generated. |
Unrelated to this change but isn't system_include more common terminology for this?