Cranelift: include return values in instruction pretty print output. (#5489)

This commit is contained in:
KarelPeeters
2023-01-03 18:06:47 +01:00
committed by GitHub
parent e3c7bf638a
commit 320d67fe8d
4 changed files with 39 additions and 6 deletions

View File

@@ -2657,7 +2657,16 @@ impl Inst {
} }
s s
} }
&Inst::Ret { .. } => "ret".to_string(), &Inst::Ret { ref rets } => {
let mut s = "ret".to_string();
for ret in rets {
use std::fmt::Write;
let preg = pretty_print_reg(ret.preg, &mut empty_allocs);
let vreg = pretty_print_reg(ret.vreg, allocs);
write!(&mut s, " {}={}", vreg, preg).unwrap();
}
s
}
&Inst::AuthenticatedRet { key, is_hint, .. } => { &Inst::AuthenticatedRet { key, is_hint, .. } => {
let key = match key { let key = match key {
APIKey::A => "a", APIKey::A => "a",

View File

@@ -1406,8 +1406,16 @@ impl Inst {
} }
s s
} }
&Inst::Ret { .. } => { &Inst::Ret { ref rets } => {
format!("ret") let mut s = "ret".to_string();
let mut empty_allocs = AllocationConsumer::default();
for ret in rets {
use std::fmt::Write;
let preg = format_reg(ret.preg, &mut empty_allocs);
let vreg = format_reg(ret.vreg, allocs);
write!(&mut s, " {}={}", vreg, preg).unwrap();
}
s
} }
&MInst::Extend { &MInst::Extend {

View File

@@ -3145,9 +3145,16 @@ impl Inst {
} }
s s
} }
&Inst::Ret { link, .. } => { &Inst::Ret { link, ref rets } => {
debug_assert_eq!(link, gpr(14)); debug_assert_eq!(link, gpr(14));
format!("br {}", show_reg(link)) let mut s = format!("br {}", show_reg(link));
for ret in rets {
use std::fmt::Write;
let preg = pretty_print_reg(ret.preg, &mut empty_allocs);
let vreg = pretty_print_reg(ret.vreg, allocs);
write!(&mut s, " {}={}", vreg, preg).unwrap();
}
s
} }
&Inst::Jump { dest } => { &Inst::Jump { dest } => {
let dest = dest.to_string(); let dest = dest.to_string();

View File

@@ -1537,7 +1537,16 @@ impl PrettyPrint for Inst {
s s
} }
Inst::Ret { .. } => "ret".to_string(), Inst::Ret { rets } => {
let mut s = "ret".to_string();
for ret in rets {
use std::fmt::Write;
let preg = regs::show_reg(ret.preg);
let vreg = pretty_print_reg(ret.vreg, 8, allocs);
write!(&mut s, " {}={}", vreg, preg).unwrap();
}
s
}
Inst::JmpKnown { dst } => { Inst::JmpKnown { dst } => {
format!("{} {}", ljustify("jmp".to_string()), dst.to_string()) format!("{} {}", ljustify("jmp".to_string()), dst.to_string())