Also write out register assignments in write_instruction.
The value locations appear after the encodings: > [R#0c,%x2] v0 = iadd vx0, vx1 > [Iret#19] return_reg v0
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
//! equivalent textual representation. This textual representation can be read back by the
|
//! equivalent textual representation. This textual representation can be read back by the
|
||||||
//! `cretonne-reader` crate.
|
//! `cretonne-reader` crate.
|
||||||
|
|
||||||
use ir::{Function, Ebb, Inst, Value, Type};
|
use ir::{Function, Ebb, Inst, Value, Type, ValueLoc};
|
||||||
use isa::TargetIsa;
|
use isa::TargetIsa;
|
||||||
use std::fmt::{Result, Error, Write};
|
use std::fmt::{Result, Error, Write};
|
||||||
use std::result;
|
use std::result;
|
||||||
@@ -172,7 +172,19 @@ fn write_instruction(w: &mut Write,
|
|||||||
if let Some(enc) = func.encodings.get(inst).cloned() {
|
if let Some(enc) = func.encodings.get(inst).cloned() {
|
||||||
let mut s = String::with_capacity(16);
|
let mut s = String::with_capacity(16);
|
||||||
if let Some(isa) = isa {
|
if let Some(isa) = isa {
|
||||||
try!(write!(s, "[{}]", isa.display_enc(enc)));
|
try!(write!(s, "[{}", isa.display_enc(enc)));
|
||||||
|
// Write value locations, if we have them.
|
||||||
|
if !func.locations.is_empty() {
|
||||||
|
let regs = isa.register_info();
|
||||||
|
for r in func.dfg.inst_results(inst) {
|
||||||
|
match func.locations[r] {
|
||||||
|
ValueLoc::Unassigned => write!(s, ",-")?,
|
||||||
|
ValueLoc::Reg(ru) => write!(s, ",{}", regs.display_regunit(ru))?,
|
||||||
|
ValueLoc::Stack(ss) => write!(s, ",{}", ss)?,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try!(write!(s, "]"));
|
||||||
} else {
|
} else {
|
||||||
try!(write!(s, "[{}]", enc));
|
try!(write!(s, "[{}]", enc));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user