コード例 #1
0
 @Override
 public void run(StructuredGraph graph) {
   schedulePhase.apply(graph, false);
   schedule = graph.getLastSchedule();
   schedule.getCFG().computePostdominators();
   Block startBlock = schedule.getCFG().getStartBlock();
   ProcessFrame rootFrame =
       new ProcessFrame(startBlock, graph.createNodeBitMap(), startBlock.getBeginNode(), null);
   LoweringPhase.processBlock(rootFrame);
 }
コード例 #2
0
    @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));
    }