@SuppressWarnings("try") public void run( StructuredGraph graph, SchedulingStrategy selectedStrategy, boolean immutableGraph) { // assert GraphOrder.assertNonCyclicGraph(graph); cfg = ControlFlowGraph.compute(graph, true, true, true, false); NodeMap<Block> currentNodeMap = graph.createNodeMap(); NodeBitMap visited = graph.createNodeBitMap(); BlockMap<List<Node>> earliestBlockToNodesMap = new BlockMap<>(cfg); this.nodeToBlockMap = currentNodeMap; this.blockToNodesMap = earliestBlockToNodesMap; scheduleEarliestIterative( earliestBlockToNodesMap, currentNodeMap, visited, graph, immutableGraph); if (selectedStrategy != SchedulingStrategy.EARLIEST) { // For non-earliest schedules, we need to do a second pass. BlockMap<List<Node>> latestBlockToNodesMap = new BlockMap<>(cfg); for (Block b : cfg.getBlocks()) { latestBlockToNodesMap.put(b, new ArrayList<Node>()); } BlockMap<ArrayList<FloatingReadNode>> watchListMap = calcLatestBlocks( selectedStrategy, currentNodeMap, earliestBlockToNodesMap, visited, latestBlockToNodesMap, immutableGraph); sortNodesLatestWithinBlock( cfg, earliestBlockToNodesMap, latestBlockToNodesMap, currentNodeMap, watchListMap, visited); assert verifySchedule(cfg, latestBlockToNodesMap, currentNodeMap); assert MemoryScheduleVerification.check(cfg.getStartBlock(), latestBlockToNodesMap); this.blockToNodesMap = latestBlockToNodesMap; cfg.setNodeToBlock(currentNodeMap); } graph.setLastSchedule( new ScheduleResult(this.cfg, this.nodeToBlockMap, this.blockToNodesMap)); }
public void clearLastSchedule() { setLastSchedule(null); }