summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_smir/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_smir/README.md')
-rw-r--r--compiler/rustc_smir/README.md37
1 files changed, 37 insertions, 0 deletions
diff --git a/compiler/rustc_smir/README.md b/compiler/rustc_smir/README.md
index ae49098dd..31dee955f 100644
--- a/compiler/rustc_smir/README.md
+++ b/compiler/rustc_smir/README.md
@@ -73,3 +73,40 @@ git subtree pull --prefix=compiler/rustc_smir https://github.com/rust-lang/proje
Note: only ever sync to rustc from the project-stable-mir's `smir` branch. Do not sync with your own forks.
Then open a PR against rustc just like a regular PR.
+
+## Stable MIR Design
+
+The stable-mir will follow a similar approach to proc-macro2. It’s
+implementation will eventually be broken down into two main crates:
+
+- `stable_mir`: Public crate, to be published on crates.io, which will contain
+the stable data structure as well as proxy APIs to make calls to the
+compiler.
+- `rustc_smir`: The compiler crate that will translate from internal MIR to
+SMIR. This crate will also implement APIs that will be invoked by
+stable-mir to query the compiler for more information.
+
+This will help tools to communicate with the rust compiler via stable APIs. Tools will depend on
+`stable_mir` crate, which will invoke the compiler using APIs defined in `rustc_smir`. I.e.:
+
+```
+ ┌──────────────────────────────────┐ ┌──────────────────────────────────┐
+ │ External Tool ┌──────────┐ │ │ ┌──────────┐ Rust Compiler │
+ │ │ │ │ │ │ │ │
+ │ │stable_mir| │ │ │rustc_smir│ │
+ │ │ │ ├──────────►| │ │ │
+ │ │ │ │◄──────────┤ │ │ │
+ │ │ │ │ │ │ │ │
+ │ │ │ │ │ │ │ │
+ │ └──────────┘ │ │ └──────────┘ │
+ └──────────────────────────────────┘ └──────────────────────────────────┘
+```
+
+More details can be found here:
+https://hackmd.io/XhnYHKKuR6-LChhobvlT-g?view
+
+For now, the code for these two crates are in separate modules of this crate.
+The modules have the same name for simplicity. We also have a third module,
+`rustc_internal` which will expose APIs and definitions that allow users to
+gather information from internal MIR constructs that haven't been exposed in
+the `stable_mir` module.