Add README.

This commit is contained in:
Camille GILLOT 2023-10-16 19:14:24 +00:00
parent 38bf660771
commit d6f4bd5a8d

View File

@ -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