Compare commits

..

2 Commits

Author SHA1 Message Date
T0b1
55211229ef better vcode printing 2023-04-18 12:19:51 +02:00
T0b1
e3117a84c8 local changes 2023-04-18 12:19:51 +02:00
3 changed files with 48 additions and 15 deletions

25
Cargo.lock generated
View File

@@ -607,7 +607,7 @@ dependencies = [
"cranelift-isle",
"criterion",
"gimli",
"hashbrown 0.13.1",
"hashbrown 0.13.2",
"log",
"regalloc2",
"serde",
@@ -677,7 +677,7 @@ name = "cranelift-frontend"
version = "0.96.0"
dependencies = [
"cranelift-codegen",
"hashbrown 0.13.1",
"hashbrown 0.13.2",
"log",
"similar",
"smallvec",
@@ -747,7 +747,7 @@ dependencies = [
"anyhow",
"cranelift-codegen",
"cranelift-control",
"hashbrown 0.13.1",
"hashbrown 0.13.2",
]
[[package]]
@@ -837,7 +837,7 @@ dependencies = [
"cranelift-codegen",
"cranelift-entity",
"cranelift-frontend",
"hashbrown 0.13.1",
"hashbrown 0.13.2",
"itertools",
"log",
"serde",
@@ -1498,9 +1498,9 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
[[package]]
name = "hashbrown"
version = "0.13.1"
version = "0.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "33ff8ae62cd3a9102e5637afc8452c55acf3844001bd5374e0b0bd7b6616c038"
checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e"
dependencies = [
"ahash",
]
@@ -2049,7 +2049,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea86265d3d3dcb6a27fc51bd29a4bf387fae9d2986b823079d4986af253eb439"
dependencies = [
"crc32fast",
"hashbrown 0.13.1",
"hashbrown 0.13.2",
"indexmap",
"memchr",
]
@@ -2578,11 +2578,10 @@ dependencies = [
[[package]]
name = "regalloc2"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "80535183cae11b149d618fbd3c37e38d7cda589d82d7769e196ca9a9042d7621"
dependencies = [
"fxhash",
"hashbrown 0.13.2",
"log",
"rustc-hash",
"serde",
"slice-group-by",
"smallvec",
@@ -2674,6 +2673,12 @@ version = "0.1.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342"
[[package]]
name = "rustc-hash"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
[[package]]
name = "rustix"
version = "0.36.8"

View File

@@ -771,6 +771,7 @@ impl<I: VCodeInst> VCode<I> {
{
// To write into disasm string.
use core::fmt::Write;
let want_disasm = true;
let _tt = timing::vcode_emit();
let mut buffer = MachBuffer::new();
@@ -934,7 +935,7 @@ impl<I: VCodeInst> VCode<I> {
// and they come out the other end, if
// still needed (not elided), as
// regalloc-inserted moves.
continue;
//continue;
}
// Update the srcloc at this point in the buffer.
@@ -1349,12 +1350,39 @@ impl<I: VCodeInst> fmt::Debug for VCode<I> {
for block in 0..self.num_blocks() {
let block = BlockIndex::new(block);
writeln!(f, "Block {}:", block.index())?;
write!(f, "Block {}(", block.index())?;
{
let mut first = true;
for vreg in self.block_params(block) {
if !first {
write!(f, ", ")?;
} else {
first = false;
}
write!(f, "{}", vreg)?;
}
}
writeln!(f, "):")?;
if let Some(bb) = self.bindex_to_bb(block) {
writeln!(f, " (original IR block: {})", bb)?;
}
for succ in self.succs(block) {
writeln!(f, " (successor: Block {})", succ.index())?;
for (i, succ) in self.succs(block).iter().enumerate() {
let last_inst = self.block_insns(block).last();
if self.is_branch(last_inst) {
write!(f, " (successor: Block {}(", succ.index())?;
let mut first = true;
for vreg in self.branch_blockparams(block, last_inst, i) {
if !first {
write!(f, ", ")?;
} else {
first = false;
}
write!(f, "{}", vreg)?;
}
writeln!(f, "))")?;
} else {
write!(f, " (successor: Block {})", succ.index())?;
}
}
let (start, end) = self.block_ranges[block.index()];
writeln!(

View File

@@ -17,7 +17,7 @@ target-lexicon = { workspace = true, features = ["std"] }
# In the next iteration we'll factor out the common bits so that they can be consumed
# by Cranelift and Winch.
cranelift-codegen = { workspace = true }
regalloc2 = "0.6.0"
regalloc2 = { path = "../../../regalloc2" }
gimli = { workspace = true }
[features]