summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Bernstein <[email protected]>2025-02-06 16:09:50 -0500
committerTakashi Kokubun <[email protected]>2025-04-18 21:52:57 +0900
commit94f572f6b49f9cd3373cfd8a9c79284e4df32d64 (patch)
tree3fc69052f1978dac3a3671489140d347ffb0012b
parent75724a10e1c864ecf11a9e528ceabb4e90ac61b6 (diff)
Display Test and BranchEdge
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/13131
-rw-r--r--zjit/src/ir.rs15
1 files changed, 14 insertions, 1 deletions
diff --git a/zjit/src/ir.rs b/zjit/src/ir.rs
index a2178a7757..a0af4a99c0 100644
--- a/zjit/src/ir.rs
+++ b/zjit/src/ir.rs
@@ -45,6 +45,18 @@ pub struct BranchEdge {
args: Vec<Opnd>,
}
+impl std::fmt::Display for BranchEdge {
+ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+ write!(f, "{}(", self.target)?;
+ let mut prefix = "";
+ for arg in &self.args {
+ write!(f, "{prefix}{arg}")?;
+ prefix = ", ";
+ }
+ write!(f, ")")
+ }
+}
+
#[derive(Debug, PartialEq)]
pub struct CallInfo {
name: String,
@@ -142,7 +154,7 @@ impl std::fmt::Display for Function {
write!(f, " {insn_id} = ")?;
match &self.insns[insn_id.0] {
Insn::Param { idx } => { write!(f, "Param {idx}")?; }
- Insn::IfFalse { val, target } => { write!(f, "IfFalse {val}, {target:?}")?; }
+ Insn::IfFalse { val, target } => { write!(f, "IfFalse {val}, {target}")?; }
Insn::Return { val } => { write!(f, "Return {val}")?; }
Insn::Add { v0, v1 } => { write!(f, "Add {v0}, {v1}")?; }
Insn::Send { self_val, call_info, args } => {
@@ -151,6 +163,7 @@ impl std::fmt::Display for Function {
write!(f, ", {arg}")?;
}
}
+ Insn::Test { val } => { write!(f, "Test {val}")?; }
insn => { write!(f, "{insn:?}")?; }
}
writeln!(f, "")?;