/** Run a job up to the <code>goal</code> pass. */
  public boolean runToPass(Job job, Pass goal) {
    if (Report.should_report(Report.frontend, 1))
      Report.report(1, "Running " + job + " to pass " + goal);

    while (!job.pendingPasses().isEmpty()) {
      Pass pass = (Pass) job.pendingPasses().get(0);

      try {
        runPass(job, pass);
      } catch (CyclicDependencyException e) {
        // cause the pass to fail.
        job.finishPass(pass, false);
      }

      if (pass == goal) {
        break;
      }
    }

    if (job.completed()) {
      if (Report.should_report(Report.frontend, 1)) Report.report(1, "Job " + job + " completed");
    }

    return job.status();
  }
  /** Run all pending passes on <code>job</code>. */
  public boolean runAllPasses(Job job) {
    List pending = job.pendingPasses();

    // Run until there are no more passes.
    if (!pending.isEmpty()) {
      Pass lastPass = (Pass) pending.get(pending.size() - 1);
      return runToPass(job, lastPass);
    }

    return true;
  }