private void Build() { foreach (BasicBlock b in Blocks) { HashSet <Temp.Temp> live = new HashSet <Temp.Temp>(b.LiveOut); for (int i = b.List.Count - 1; i >= 0; i--) { TExp inst = b.List[i]; if (inst is Move) { live.ExceptWith(inst.LivenessNode.Use); HashSet <Temp.Temp> nodes = new HashSet <Temp.Temp>(inst.LivenessNode.Def); nodes.UnionWith(inst.LivenessNode.Use); foreach (Temp.Temp n in nodes) { GetNodeByTemp(n).MoveList.Add((Move)inst); } WorklistMoves.Add((Move)inst); } live.UnionWith(inst.LivenessNode.Def); foreach (Temp.Temp d in inst.LivenessNode.Def) { foreach (Temp.Temp l in live) { AddEdge(l, d); } } live.ExceptWith(inst.LivenessNode.Def); live.UnionWith(inst.LivenessNode.Use); } } }
private void EnableMoves(List <Node> nodes) { foreach (Node n in nodes) { foreach (Move m in NodeMoves(n)) { if (ActiveMoves.Contains(m)) { ActiveMoves.Remove(m); WorklistMoves.Add(m); } } } }