示例#1
0
  /** The main routine for block splitting. */
  public final void split(Hyperblock hbStart) {
    Stack<Node> wl = WorkArea.<Node>getStack("split");
    DataflowAnalysis df = new DataflowAnalysis(hbStart, regs);
    int trips = 0;

    // Add all the hyperblocks to the working set.

    hbStart.nextVisit();
    hbStart.setVisited();
    wl.push(hbStart);

    while (!wl.isEmpty()) {
      Hyperblock hb = (Hyperblock) wl.pop();
      hb.pushOutEdges(wl);
      workingSet.add(hb);
    }

    // Split the hyperblocks.

    while (!workingSet.isEmpty()) {
      df.computeLiveness3();
      wl.addAll(workingSet);

      while (!wl.isEmpty()) {
        Hyperblock hb = (Hyperblock) wl.pop();
        hb.enterSSA();
        hb.analyzeLeaveSSA();

        if (!hb.isLegalBlock(true)) {
          splitHyperblock(hb);
        } else {
          workingSet.remove(hb);
        }
      }

      if ((++trips % WARN_SPLIT_ATTEMPTS) == 0) {
        System.err.println(
            "** Warning: the block splitter has run "
                + trips
                + " times for "
                + gen.getCurrentRoutine().getName()
                + "().");
      }
    }

    WorkArea.<Node>returnStack(wl);
  }