summaryrefslogtreecommitdiffstats
path: root/tests/mir-opt/README.md
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:48 +0000
commitef24de24a82fe681581cc130f342363c47c0969a (patch)
tree0d494f7e1a38b95c92426f58fe6eaa877303a86c /tests/mir-opt/README.md
parentReleasing progress-linux version 1.74.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-ef24de24a82fe681581cc130f342363c47c0969a.tar.xz
rustc-ef24de24a82fe681581cc130f342363c47c0969a.zip
Merging upstream version 1.75.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/mir-opt/README.md')
-rw-r--r--tests/mir-opt/README.md18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/mir-opt/README.md b/tests/mir-opt/README.md
index 0721d9f70..39a7b5aea 100644
--- a/tests/mir-opt/README.md
+++ b/tests/mir-opt/README.md
@@ -49,3 +49,21 @@ 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.
+
+Use `// skip-filecheck` to prevent FileCheck from running.
+
+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