コード例 #1
0
  /**
   * Insert the list of <code>newPasses</code> into <code>passes</code> immediately after the pass
   * named <code>id</code>.
   */
  public void afterPass(List passes, Pass.ID id, List newPasses) {
    for (ListIterator i = passes.listIterator(); i.hasNext(); ) {
      Pass p = (Pass) i.next();

      if (p.id() == id) {
        for (Iterator j = newPasses.iterator(); j.hasNext(); ) {
          i.add(j.next());
        }

        return;
      }
    }

    throw new InternalCompilerError("Pass " + id + " not found.");
  }
コード例 #2
0
  /** Remove the pass named <code>id</code> from <code>passes</code>. */
  public void removePass(List passes, Pass.ID id) {
    for (ListIterator i = passes.listIterator(); i.hasNext(); ) {
      Pass p = (Pass) i.next();

      if (p.id() == id) {
        if (p instanceof BarrierPass) {
          throw new InternalCompilerError("Cannot remove a barrier pass.");
        }

        i.remove();
        return;
      }
    }

    throw new InternalCompilerError("Pass " + id + " not found.");
  }
コード例 #3
0
  /**
   * Insert the list of <code>newPasses</code> into <code>passes</code> immediately before the pass
   * named <code>id</code>.
   */
  public void beforePass(List passes, Pass.ID id, List newPasses) {
    for (ListIterator i = passes.listIterator(); i.hasNext(); ) {
      Pass p = (Pass) i.next();

      if (p.id() == id) {
        // Backup one position.
        i.previous();

        for (Iterator j = newPasses.iterator(); j.hasNext(); ) {
          i.add(j.next());
        }

        return;
      }
    }

    throw new InternalCompilerError("Pass " + id + " not found.");
  }