Add an ISA argument to dfg.display_inst().

Include ISA-specific annotations in tracing and error messages.
This commit is contained in:
Jakob Stoklund Olesen
2017-07-12 10:12:20 -07:00
parent e4da2e1f22
commit 69f974ba5d
10 changed files with 42 additions and 33 deletions

View File

@@ -399,7 +399,7 @@ impl<'a> Context<'a> {
dbg!("Checking {}: {}: {}",
pred_val,
pred_ebb,
self.func.dfg.display_inst(pred_inst));
self.func.dfg.display_inst(pred_inst, self.isa));
// Never coalesce incoming function arguments on the stack. These arguments are
// pre-spilled, and the rest of the virtual register would be forced to spill to the
@@ -474,9 +474,9 @@ impl<'a> Context<'a> {
let ty = self.func.dfg.value_type(copy);
dbg!("Inserted {}, before {}: {}",
self.func.dfg.display_inst(inst),
self.func.dfg.display_inst(inst, self.isa),
pred_ebb,
self.func.dfg.display_inst(pred_inst));
self.func.dfg.display_inst(pred_inst, self.isa));
// Give it an encoding.
let encoding = self.isa
@@ -519,7 +519,7 @@ impl<'a> Context<'a> {
self.liveness.move_def_locally(succ_val, inst);
dbg!("Inserted {}, following {}({}: {})",
self.func.dfg.display_inst(inst),
self.func.dfg.display_inst(inst, self.isa),
ebb,
new_val,
ty);

View File

@@ -73,6 +73,7 @@ pub struct Coloring {
/// Immutable context information and mutable references that don't need to be borrowed across
/// method calls should go in this struct.
struct Context<'a> {
isa: &'a TargetIsa,
// Cached ISA information.
// We save it here to avoid frequent virtual function calls on the `TargetIsa` trait object.
reginfo: RegInfo,
@@ -111,6 +112,7 @@ impl Coloring {
tracker: &mut LiveValueTracker) {
dbg!("Coloring for:\n{}", func.display(isa));
let mut ctx = Context {
isa,
reginfo: isa.register_info(),
encinfo: isa.encoding_info(),
domtree,
@@ -279,7 +281,7 @@ impl<'a> Context<'a> {
locations: &mut ValueLocations,
func_signature: &Signature) {
dbg!("Coloring {}\n {}",
dfg.display_inst(inst),
dfg.display_inst(inst, self.isa),
regs.display(&self.reginfo));
// EBB whose arguments should be colored to match the current branch instruction's
@@ -308,7 +310,7 @@ impl<'a> Context<'a> {
assert_eq!(dfg.inst_variable_args(inst).len(),
0,
"Can't handle EBB arguments: {}",
dfg.display_inst(inst));
dfg.display_inst(inst, self.isa));
self.undivert_regs(|lr| !lr.is_local());
}
}

View File

@@ -246,7 +246,9 @@ impl<'a> Context<'a> {
pos: &mut Cursor,
dfg: &mut DataFlowGraph,
tracker: &mut LiveValueTracker) {
dbg!("Inst {}, {}", dfg.display_inst(inst), self.pressure);
dbg!("Inst {}, {}",
dfg.display_inst(inst, self.isa),
self.pressure);
// We may need to resolve register constraints if there are any noteworthy uses.
assert!(self.reg_uses.is_empty());
@@ -292,7 +294,7 @@ impl<'a> Context<'a> {
None => {
panic!("Ran out of {} registers for {}",
op.regclass,
dfg.display_inst(inst))
dfg.display_inst(inst, self.isa))
}
}
}
@@ -429,7 +431,7 @@ impl<'a> Context<'a> {
None => {
panic!("Ran out of {} registers when inserting copy before {}",
rc,
dfg.display_inst(inst))
dfg.display_inst(inst, self.isa))
}
}
}