Skip to content
This repository was archived by the owner on Jan 7, 2022. It is now read-only.

Commit ee89705

Browse files
bors[bot]vext01
andcommitted
Merge #10
10: Start converting MIR to SSA TIR. r=ltratt a=vext01 This change: - Starts adding support for statements to TIR. Only simple assignments are translated. Everything else is made into an "unimplemented" statement. The plan is to keep going until the BF interpreter has none of these. - Does the first part of the SSA conversion, namely: * Computes the dominance frontier. * Inserts PHI nodes in the right place and for the correct TIR variables. So what we get is a CFG with PHIs, but which is not yet in SSA. The remaining step is to walk the dominator tree and assign each definition of a variable with a new SSA variable name. That's yet another algorithm from the Appel book. To keep PRs manageable, I think we should do that as a separate PR. Manual inspection of CFG graphs with assignments and PHIs shown look good. Here's a couple of examples: ## example 1 ![image](https://user-images.githubusercontent.com/604955/54438832-6ed50500-472f-11e9-9dcc-c63a01c2dea4.png) ## example 2 ![image](https://user-images.githubusercontent.com/604955/54438860-7e544e00-472f-11e9-8bab-e44335fa63c1.png) I'd like to add some tests to this code to try and weed out some early bugs (I'm sure there will be some). This is likely to take me a little while as I want to inspect how upstream does this kind of testing. I want to avoid manually constructing MIRs and TIRs by hand if I can help it. Question: Currently PHI nodes are of arbitrary arity to make them easier to read during development. We talked about having only binary PHIs. Is that still what we want? [There is a local ykpack Cargo path until we decide what to do with PHIs arity] Cheers. Co-authored-by: Edd Barrett <vext01@gmail.com>
2 parents 579fb1d + aba3df7 commit ee89705

File tree

6 files changed

+336
-29
lines changed

6 files changed

+336
-29
lines changed

.buildbot.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
./x.py clean # We don't clone afresh to save time and bandwidth.
66
git clean -dffx # If upstream removes a submodule, remove the files from disk.
77

8+
# Ensure the build fails if it uses excessive amounts of memory.
9+
ulimit -d $((1024 * 1024 * 8)) # 8 GiB
10+
811
# Note that the gdb must be Python enabled.
9-
PATH=/opt/gdb-8.2/bin:${PATH} RUST_BACKTRACE=1 YK_DEBUG_SECTIONS=1 \
10-
./x.py test --config .buildbot.toml
12+
/usr/bin/time -v env PATH=/opt/gdb-8.2/bin:${PATH} \
13+
RUST_BACKTRACE=1 ./x.py test --config .buildbot.toml

Cargo.lock

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3062,8 +3062,10 @@ version = "0.0.0"
30623062
name = "rustc_yk_sections"
30633063
version = "0.0.0"
30643064
dependencies = [
3065+
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
30653066
"rustc 0.0.0",
30663067
"rustc_codegen_utils 0.0.0",
3068+
"rustc_data_structures 0.0.0",
30673069
"rustc_yk_link 0.0.0",
30683070
"ykpack 0.1.0 (git+https://github.com/softdevteam/ykpack)",
30693071
]
@@ -4044,7 +4046,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
40444046
[[package]]
40454047
name = "ykpack"
40464048
version = "0.1.0"
4047-
source = "git+https://github.com/softdevteam/ykpack#e0fd6162b9522fd04b6bbb77a232986c4ea5c257"
4049+
source = "git+https://github.com/softdevteam/ykpack#358a7403a5b8c03809f5c5b07933a6850060afa4"
40484050
dependencies = [
40494051
"fallible-iterator 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
40504052
"rmp-serde 0.14.0 (git+https://github.com/3Hren/msgpack-rust?rev=40b3d480b20961e6eeceb416b32bcd0a3383846a)",

src/librustc_yk_sections/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,5 @@ rustc = { path = "../librustc" }
1414
rustc_yk_link = { path = "../librustc_yk_link" }
1515
ykpack = { git = "https://github.com/softdevteam/ykpack" }
1616
rustc_codegen_utils = { path = "../librustc_codegen_utils" }
17+
rustc_data_structures = { path = "../librustc_data_structures" }
18+
log = "0.4.5"

src/librustc_yk_sections/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,7 @@ extern crate rustc;
1313
extern crate rustc_yk_link;
1414
extern crate rustc_codegen_utils;
1515
extern crate ykpack;
16+
extern crate rustc_data_structures;
17+
#[macro_use] extern crate log;
1618

1719
pub mod mir_cfg;

0 commit comments

Comments
 (0)