Making Cetus Execute Your Pass

There are two ways to extend Cetus to run a new pass.

  1. For passes accepted into the main Cetus distribution, provide a static void run method that accepts a Program object as its only parameter. We will add a flag to Cetus, named similarly to your pass, that will cause the Cetus driver to call your pass.
  2. Derive a class from cetus.exec.Driver and override the runPasses method. You must provide your own main method, which should contain a single line:
    public class MyDriver extends Driver
    {
      // ...
    
      public static void main(String[] args)
      {
        (new MyDriver()).run(args);
      }
    }
    

    where args is simply the command line argument of your main method. You can optionally override the printUsage and printHelp methods if your pass has additional command-line options. The Driver class contains a protected Program object that your derived class will be able to access in its runPasses method. Note that the run method called in the example above is the run method of the Driver class. It will process command-line arguments, run the parsers, and get everything ready for your code before calling runPasses.