WARNING! Access to this system is limited to authorised users only.
Unauthorised users may be subject to prosecution.
Unauthorised access to this system is a criminal offence under Australian law (Federal Crimes Act 1914 Part VIA)
It is a criminal offence to:
(1) Obtain access to data without authority. -Penalty 2 years imprisonment.
(2) Damage, delete, alter or insert data without authority. -Penalty 10 years imprisonment.
User activity is monitored and recorded. Anyone using this system expressly consents to such monitoring and recording.

Commit e0b055f7 authored by qinsoon's avatar qinsoon
Browse files

add a freeze heuristics that prioritize freezing less frequenly used

nodes
parent a25abd66
......@@ -835,14 +835,40 @@ impl<'a> GraphColoring<'a> {
fn freeze(&mut self) {
// it is not empty (checked before)
let node = self.worklist_freeze.pop_front().unwrap();
let node = self.freeze_heuristics();
trace!("Freezing {}...", node);
trace!(" insert {} to worklistSimplify", node);
trace!(" move {} from worklistFreeze to worklistSimplify", node);
self.worklist_freeze.remove(&node);
self.worklist_simplify.insert(node);
self.freeze_moves(node);
}
fn freeze_heuristics(&mut self) -> MuID {
use std::f32;
// we try to freeze a node that appears less frequently
// we compute freeze cost based on all the moves related with this node
let mut candidate = None;
let mut candidate_cost = f32::MAX;
for &n in self.worklist_freeze.iter() {
// freeze_cost(n) = SUM ((spill_cost(src) + spill_cost(dst)) for m (mov src->dst)
// in movelist[n])
let mut freeze_cost = 0f32;
for m in self.get_movelist(n).iter() {
freeze_cost += self.ig.get_spill_cost(m.from);
freeze_cost += self.ig.get_spill_cost(m.to);
}
if freeze_cost < candidate_cost {
candidate = Some(n);
candidate_cost = freeze_cost;
}
}
assert!(candidate.is_some());
candidate.unwrap()
}
fn freeze_moves(&mut self, u: MuID) {
trace!(" freeze moves for {}", u);
for m in self.node_moves(u).iter() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment