Convert all log::debug to log::trace.

This commit is contained in:
Chris Fallin
2021-08-12 12:05:19 -07:00
parent 38323e0c27
commit 3e1e0f39b6
14 changed files with 282 additions and 251 deletions

View File

@@ -20,10 +20,9 @@ use super::{
use crate::moves::ParallelMoves;
use crate::{
Allocation, Block, Edit, Function, Inst, InstPosition, OperandKind, OperandConstraint, OperandPos,
ProgPoint, RegClass, VReg,
Allocation, Block, Edit, Function, Inst, InstPosition, OperandConstraint, OperandKind,
OperandPos, ProgPoint, RegClass, VReg,
};
use log::debug;
use smallvec::{smallvec, SmallVec};
use std::fmt::Debug;
@@ -45,9 +44,12 @@ impl<'a, F: Function> Env<'a, F> {
to_alloc: Allocation,
to_vreg: Option<VReg>,
) {
debug!(
log::trace!(
"insert_move: pos {:?} prio {:?} from_alloc {:?} to_alloc {:?}",
pos, prio, from_alloc, to_alloc
pos,
prio,
from_alloc,
to_alloc
);
match (from_alloc.as_reg(), to_alloc.as_reg()) {
(Some(from), Some(to)) => {
@@ -75,16 +77,16 @@ impl<'a, F: Function> Env<'a, F> {
}
pub fn get_alloc_for_range(&self, range: LiveRangeIndex) -> Allocation {
log::debug!("get_alloc_for_range: {:?}", range);
log::trace!("get_alloc_for_range: {:?}", range);
let bundle = self.ranges[range.index()].bundle;
log::debug!(" -> bundle: {:?}", bundle);
log::trace!(" -> bundle: {:?}", bundle);
let bundledata = &self.bundles[bundle.index()];
log::debug!(" -> allocation {:?}", bundledata.allocation);
log::trace!(" -> allocation {:?}", bundledata.allocation);
if bundledata.allocation != Allocation::none() {
bundledata.allocation
} else {
log::debug!(" -> spillset {:?}", bundledata.spillset);
log::debug!(
log::trace!(" -> spillset {:?}", bundledata.spillset);
log::trace!(
" -> spill slot {:?}",
self.spillsets[bundledata.spillset.index()].slot
);
@@ -93,9 +95,9 @@ impl<'a, F: Function> Env<'a, F> {
}
pub fn apply_allocations_and_insert_moves(&mut self) {
log::debug!("apply_allocations_and_insert_moves");
log::debug!("blockparam_ins: {:?}", self.blockparam_ins);
log::debug!("blockparam_outs: {:?}", self.blockparam_outs);
log::trace!("apply_allocations_and_insert_moves");
log::trace!("blockparam_ins: {:?}", self.blockparam_ins);
log::trace!("blockparam_outs: {:?}", self.blockparam_outs);
// Now that all splits are done, we can pay the cost once to
// sort VReg range lists and update with the final ranges.
@@ -191,7 +193,7 @@ impl<'a, F: Function> Env<'a, F> {
.map(|preg| Allocation::reg(preg))
.unwrap_or_else(|| self.get_alloc_for_range(entry.index));
let range = entry.range;
log::debug!(
log::trace!(
"apply_allocations: vreg {:?} LR {:?} with range {:?} has alloc {:?} (pinned {:?})",
vreg,
entry.index,
@@ -258,7 +260,7 @@ impl<'a, F: Function> Env<'a, F> {
&& !self.is_start_of_block(range.from)
&& !first_is_def
{
log::debug!(
log::trace!(
"prev LR {} abuts LR {} in same block; moving {} -> {} for v{}",
prev.index(),
entry.index.index(),
@@ -292,9 +294,9 @@ impl<'a, F: Function> Env<'a, F> {
if range.to < self.cfginfo.block_exit[block.index()].next() {
break;
}
log::debug!("examining block with end in range: block{}", block.index());
log::trace!("examining block with end in range: block{}", block.index());
for &succ in self.func.block_succs(block) {
log::debug!(
log::trace!(
" -> has succ block {} with entry {:?}",
succ.index(),
self.cfginfo.block_entry[succ.index()]
@@ -302,9 +304,9 @@ impl<'a, F: Function> Env<'a, F> {
if range.contains_point(self.cfginfo.block_entry[succ.index()]) {
continue;
}
log::debug!(" -> out of this range, requires half-move if live");
log::trace!(" -> out of this range, requires half-move if live");
if self.is_live_in(succ, vreg) {
log::debug!(" -> live at input to succ, adding halfmove");
log::trace!(" -> live at input to succ, adding halfmove");
half_moves.push(HalfMove {
key: half_move_key(block, succ, vreg, HalfMoveKind::Source),
alloc,
@@ -315,7 +317,7 @@ impl<'a, F: Function> Env<'a, F> {
// Scan forward in `blockparam_outs`, adding all
// half-moves for outgoing values to blockparams
// in succs.
log::debug!(
log::trace!(
"scanning blockparam_outs for v{} block{}: blockparam_out_idx = {}",
vreg.index(),
block.index(),
@@ -328,7 +330,7 @@ impl<'a, F: Function> Env<'a, F> {
break;
}
if (from_vreg, from_block) == (vreg, block) {
log::debug!(
log::trace!(
" -> found: from v{} block{} to v{} block{}",
from_vreg.index(),
from_block.index(),
@@ -380,7 +382,7 @@ impl<'a, F: Function> Env<'a, F> {
}
// Add half-moves for blockparam inputs.
log::debug!(
log::trace!(
"scanning blockparam_ins at vreg {} block {}: blockparam_in_idx = {}",
vreg.index(),
block.index(),
@@ -402,7 +404,7 @@ impl<'a, F: Function> Env<'a, F> {
),
alloc,
});
log::debug!(
log::trace!(
"match: blockparam_in: v{} in block{} from block{} into {}",
to_vreg.index(),
to_block.index(),
@@ -433,7 +435,7 @@ impl<'a, F: Function> Env<'a, F> {
continue;
}
log::debug!(
log::trace!(
"scanning preds at vreg {} block {} for ends outside the range",
vreg.index(),
block.index()
@@ -442,7 +444,7 @@ impl<'a, F: Function> Env<'a, F> {
// Now find any preds whose ends are not in the
// same range, and insert appropriate moves.
for &pred in self.func.block_preds(block) {
log::debug!(
log::trace!(
"pred block {} has exit {:?}",
pred.index(),
self.cfginfo.block_exit[pred.index()]
@@ -450,7 +452,7 @@ impl<'a, F: Function> Env<'a, F> {
if range.contains_point(self.cfginfo.block_exit[pred.index()]) {
continue;
}
log::debug!(" -> requires half-move");
log::trace!(" -> requires half-move");
half_moves.push(HalfMove {
key: half_move_key(pred, block, vreg, HalfMoveKind::Dest),
alloc,
@@ -479,7 +481,7 @@ impl<'a, F: Function> Env<'a, F> {
// Scan over def/uses and apply allocations.
for use_idx in 0..self.ranges[entry.index.index()].uses.len() {
let usedata = self.ranges[entry.index.index()].uses[use_idx];
log::debug!("applying to use: {:?}", usedata);
log::trace!("applying to use: {:?}", usedata);
debug_assert!(range.contains_point(usedata.pos));
let inst = usedata.pos.inst();
let slot = usedata.slot;
@@ -508,7 +510,7 @@ impl<'a, F: Function> Env<'a, F> {
// covers only prev inst's After; so includes move
// srcs to (exclusive) inst.
let move_src_end = (vreg, range.to.inst());
log::debug!(
log::trace!(
"vreg {:?} range {:?}: looking for program-move sources from {:?} to {:?}",
vreg,
range,
@@ -518,13 +520,13 @@ impl<'a, F: Function> Env<'a, F> {
while prog_move_src_idx < self.prog_move_srcs.len()
&& self.prog_move_srcs[prog_move_src_idx].0 < move_src_start
{
log::debug!(" -> skipping idx {}", prog_move_src_idx);
log::trace!(" -> skipping idx {}", prog_move_src_idx);
prog_move_src_idx += 1;
}
while prog_move_src_idx < self.prog_move_srcs.len()
&& self.prog_move_srcs[prog_move_src_idx].0 < move_src_end
{
log::debug!(
log::trace!(
" -> setting idx {} ({:?}) to alloc {:?}",
prog_move_src_idx,
self.prog_move_srcs[prog_move_src_idx].0,
@@ -551,7 +553,7 @@ impl<'a, F: Function> Env<'a, F> {
} else {
(vreg, range.to.inst().next())
};
log::debug!(
log::trace!(
"vreg {:?} range {:?}: looking for program-move dests from {:?} to {:?}",
vreg,
range,
@@ -561,13 +563,13 @@ impl<'a, F: Function> Env<'a, F> {
while prog_move_dst_idx < self.prog_move_dsts.len()
&& self.prog_move_dsts[prog_move_dst_idx].0 < move_dst_start
{
log::debug!(" -> skipping idx {}", prog_move_dst_idx);
log::trace!(" -> skipping idx {}", prog_move_dst_idx);
prog_move_dst_idx += 1;
}
while prog_move_dst_idx < self.prog_move_dsts.len()
&& self.prog_move_dsts[prog_move_dst_idx].0 < move_dst_end
{
log::debug!(
log::trace!(
" -> setting idx {} ({:?}) to alloc {:?}",
prog_move_dst_idx,
self.prog_move_dsts[prog_move_dst_idx].0,
@@ -585,7 +587,7 @@ impl<'a, F: Function> Env<'a, F> {
// from-vreg) tuple, find the from-alloc and all the
// to-allocs, and insert moves on the block edge.
half_moves.sort_unstable_by_key(|h| h.key);
log::debug!("halfmoves: {:?}", half_moves);
log::trace!("halfmoves: {:?}", half_moves);
self.stats.halfmoves_count = half_moves.len();
let mut i = 0;
@@ -608,7 +610,7 @@ impl<'a, F: Function> Env<'a, F> {
}
let last_dest = i;
log::debug!(
log::trace!(
"halfmove match: src {:?} dests {:?}",
src,
&half_moves[first_dest..last_dest]
@@ -687,7 +689,7 @@ impl<'a, F: Function> Env<'a, F> {
for (progpoint, from_preg, to_preg, slot) in
std::mem::replace(&mut self.multi_fixed_reg_fixups, vec![])
{
log::debug!(
log::trace!(
"multi-fixed-move constraint at {:?} from p{} to p{}",
progpoint,
from_preg.index(),
@@ -761,7 +763,7 @@ impl<'a, F: Function> Env<'a, F> {
input_reused.push(input_idx);
let input_alloc = self.get_alloc(inst, input_idx);
let output_alloc = self.get_alloc(inst, output_idx);
log::debug!(
log::trace!(
"reuse-input inst {:?}: output {} has alloc {:?}, input {} has alloc {:?}",
inst,
output_idx,
@@ -808,7 +810,7 @@ impl<'a, F: Function> Env<'a, F> {
for (&((_, from_inst), from_alloc), &((to_vreg, to_inst), to_alloc)) in
prog_move_srcs.iter().zip(prog_move_dsts.iter())
{
log::debug!(
log::trace!(
"program move at inst {:?}: alloc {:?} -> {:?} (v{})",
from_inst,
from_alloc,
@@ -947,10 +949,10 @@ impl<'a, F: Function> Env<'a, F> {
// that can be done one at a time.
let scratch = self.env.scratch_by_class[regclass as u8 as usize];
let mut parallel_moves = ParallelMoves::new(Allocation::reg(scratch));
log::debug!("parallel moves at pos {:?} prio {:?}", pos, prio);
log::trace!("parallel moves at pos {:?} prio {:?}", pos, prio);
for m in moves {
if (m.from_alloc != m.to_alloc) || m.to_vreg.is_some() {
log::debug!(" {} -> {}", m.from_alloc, m.to_alloc,);
log::trace!(" {} -> {}", m.from_alloc, m.to_alloc,);
parallel_moves.add(m.from_alloc, m.to_alloc, m.to_vreg);
}
}
@@ -981,7 +983,7 @@ impl<'a, F: Function> Env<'a, F> {
let mut scratch_used_yet = false;
for (src, dst, to_vreg) in resolved {
log::debug!(" resolved: {} -> {} ({:?})", src, dst, to_vreg);
log::trace!(" resolved: {} -> {} ({:?})", src, dst, to_vreg);
let action = redundant_moves.process_move(src, dst, to_vreg);
if !action.elide {
if dst == Allocation::reg(scratch) {
@@ -1058,10 +1060,10 @@ impl<'a, F: Function> Env<'a, F> {
);
}
} else {
log::debug!(" -> redundant move elided");
log::trace!(" -> redundant move elided");
}
if let Some((alloc, vreg)) = action.def_alloc {
log::debug!(
log::trace!(
" -> converted to DefAlloc: alloc {} vreg {}",
alloc,
vreg
@@ -1072,7 +1074,7 @@ impl<'a, F: Function> Env<'a, F> {
}
for m in &self_moves {
log::debug!(
log::trace!(
"self move at pos {:?} prio {:?}: {} -> {} to_vreg {:?}",
pos,
prio,
@@ -1083,7 +1085,7 @@ impl<'a, F: Function> Env<'a, F> {
let action = redundant_moves.process_move(m.from_alloc, m.to_alloc, m.to_vreg);
assert!(action.elide);
if let Some((alloc, vreg)) = action.def_alloc {
log::debug!(" -> DefAlloc: alloc {} vreg {}", alloc, vreg);
log::trace!(" -> DefAlloc: alloc {} vreg {}", alloc, vreg);
self.add_edit(pos, prio, Edit::DefAlloc { alloc, vreg });
}
}