[Mlir-commits] [mlir] [mlir][tblgen] Adds support for embedded LIT tests in TableGen records (PR #158017)
Jacques Pienaar
llvmlistbot at llvm.org
Sun Nov 2 22:27:20 PST 2025
================
@@ -2,64 +2,58 @@
include "mlir/Pass/PassBase.td"
include "mlir/IR/Testable.td"
+include "mlir/IR/OpBase.td"
-def TestPassWithEmbeddedLitTests : Pass<"test-pass-with-embedded-lit-tests"> {
- let summary = "pass summary";
+def Test_Dialect : Dialect {
+ let name = "test";
+ let cppNamespace = "test";
+}
+
+def TestOp : Op<Test_Dialect, "test_op"> {
+ let summary = "test op with mlir_example code blocks";
let description = [{
- Pass description
+ This operation demonstrates the mlir_example feature for ops.
+
+ Basic usage:
+ ```mlir_example
----------------
jpienaar wrote:
Syntax highlighting in markdown in the generated website via Hugo ( https://github.com/llvm/mlir-www/blob/main/.github/workflows/main.yml ) and GitHub have syntax highlighting support for code blocks in markdown. But for that, there is an identifier that's used to determine which highlighting to use (there is auto detection too but doubt MLIR detection is great). So
```mlir
func.func @foo(%arg0: i32){
// Do something
}
```
looks different from
```mlir_example
func.func @foo(%arg0: i32){
// Do something
}
```
as the latter is not considered a block of MLIR and treated as unknown format. So ideally the method to delineate MLIR examples is such that we don't lose syntax highlighting across either - I believe that's doable and just needs testing to verify.
https://github.com/llvm/llvm-project/pull/158017
More information about the Mlir-commits
mailing list