Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added documentation for how to emit the smir.json for the std-lib #17

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,17 @@ There are a few environment variables that can be set to control the tools outpu
2. `LINK_INST` - use a richer key-structure for the link-time `functions` map which uses keys that are pairs of a function type (`Ty`) _and_ an function instance kind (`InstanceKind`)
3. `DEBUG` - serialize additional data in the JSON file and dump logs to stdout

### Usage For std-lib
To generate the stable MIR output for the entire standard libary, the most simple way is using the [cargo option build-std](https://doc.rust-lang.org/cargo/reference/unstable.html#build-std) on a new project while pointing the `RUSTC` environment variable to `run.sh`. For example:
```
cargo new example
cd example
RUSTC="/<PATH-TO>/smir_prety/run.sh" cargo build -Z build-std --target <TARGET>
```
If the `smir_pretty` is not built this will not initiate a build of `smir_pretty` and will crash instead. If the target is unknown it can be read using the `rustc_arch.sh` script in this repo. The generated files can be found in `example/target/<TARGET>/deps/` and will have extension `*.smir.json`.

WARNING: This option has been succeeding on cargo version `1.79.0-nightly` but has been failing on `1.82.0-nightly`

### Invocation Details

We use an uncommon build process where we link against a patched rustc installed in this repo.
Expand Down