about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2023-10-16 19:14:24 +0000
committerCamille GILLOT <gillot.camille@gmail.com>2023-10-19 15:51:53 +0000
commitd6f4bd5a8d321bd29ebe711fa9fa3d1dfa298e26 (patch)
tree889fa25823ed76b0e04aa87554382327bbd10855
parent38bf66077173e7d1e030d0f808be96d2b16e8e70 (diff)
downloadrust-d6f4bd5a8d321bd29ebe711fa9fa3d1dfa298e26.tar.gz
rust-d6f4bd5a8d321bd29ebe711fa9fa3d1dfa298e26.zip
Add README.
-rw-r--r--tests/mir-opt/README.md16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/mir-opt/README.md b/tests/mir-opt/README.md
index 0721d9f7019..cd039bc7e05 100644
--- a/tests/mir-opt/README.md
+++ b/tests/mir-opt/README.md
@@ -49,3 +49,19 @@ This exists mainly for completeness and is rarely useful.
 ```
 // EMIT_MIR $file_name_of_some_mir_dump.before.mir
 ```
+
+# FileCheck directives
+
+The LLVM FileCheck tool is used to verify the contents of output MIR against `CHECK` directives
+present in the test file. This works on the runtime MIR, generated by `--emit=mir`, and not
+on the output of a individual passes.
+
+To check MIR for function `foo`, start with a `// CHECK-LABEL fn foo(` directive.
+
+`{{regex}}` syntax allows to match `regex`.
+
+`[[name:regex]]` syntax allows to bind `name` to a string matching `regex`, and refer to it
+as `[[name]]` in later directives, `regex` should be written not to match a leading space.
+Use `[[my_local:_.*]]` to name a local, and `[[my_bb:bb.*]]` to name a block.
+
+Documentation for FileCheck is available here: https://www.llvm.org/docs/CommandGuide/FileCheck.html