private static void runSsaFormSteps(SsaMethod ssaMeth, EnumSet<OptionalStep> steps) {
    boolean needsDeadCodeRemover = true;

    if (steps.contains(OptionalStep.MOVE_PARAM_COMBINER)) {
      MoveParamCombiner.process(ssaMeth);
    }

    if (steps.contains(OptionalStep.SCCP)) {
      SCCP.process(ssaMeth);
      DeadCodeRemover.process(ssaMeth);
      needsDeadCodeRemover = false;
    }

    if (steps.contains(OptionalStep.LITERAL_UPGRADE)) {
      LiteralOpUpgrader.process(ssaMeth);
      DeadCodeRemover.process(ssaMeth);
      needsDeadCodeRemover = false;
    }

    /*
     * ESCAPE_ANALYSIS impacts debuggability, so left off by default
     */
    steps.remove(OptionalStep.ESCAPE_ANALYSIS);
    if (steps.contains(OptionalStep.ESCAPE_ANALYSIS)) {
      EscapeAnalysis.process(ssaMeth);
      DeadCodeRemover.process(ssaMeth);
      needsDeadCodeRemover = false;
    }

    if (steps.contains(OptionalStep.CONST_COLLECTOR)) {
      ConstCollector.process(ssaMeth);
      DeadCodeRemover.process(ssaMeth);
      needsDeadCodeRemover = false;
    }

    // dead code remover must be run before phi type resolver
    if (needsDeadCodeRemover) {
      DeadCodeRemover.process(ssaMeth);
    }

    PhiTypeResolver.process(ssaMeth);
  }
Runs the optimizer with a strategy to minimize the number of rop-form registers used by the end
result. Dex bytecode does not have instruction forms that take register numbers larger than 15
for all instructions. If we've produced a method that uses more than 16 registers, try again
with a different strategy to see if we can get under the bar. The end result will be much more
efficient.

@param rmeth method to process
@param paramWidth the total width, in register-units, of this method's parameters
@param isStatic true if this method has no 'this' pointer argument.
@param steps set of optional optimization steps to run
@return optimized method
android/android_framework/dex-maker/src/main/java/com/android/dx/ssa/Optimizer.java