Java Code Examples for com.android.dx.ssa.SsaMethod#getRegCount()

The following examples show how to use com.android.dx.ssa.SsaMethod#getRegCount() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LivenessAnalyzer.java    From Box with Apache License 2.0 5 votes vote down vote up
/**
 * Runs register liveness algorithm for a method, updating the
 * live in/out information in {@code SsaBasicBlock} instances and
 * returning an interference graph.
 *
 * @param ssaMeth {@code non-null;} method to process
 * @return {@code non-null;} interference graph indexed by SSA
 * registers in both directions
 */
public static InterferenceGraph constructInterferenceGraph(
        SsaMethod ssaMeth) {
    int szRegs = ssaMeth.getRegCount();
    InterferenceGraph interference = new InterferenceGraph(szRegs);

    for (int i = 0; i < szRegs; i++) {
        new LivenessAnalyzer(ssaMeth, i, interference).run();
    }

    coInterferePhis(ssaMeth, interference);

    return interference;
}
 
Example 2
Source File: FirstFitLocalCombiningAllocator.java    From Box with Apache License 2.0 5 votes vote down vote up
/**
 * Constructs instance.
 *
 * @param ssaMeth {@code non-null;} method to process
 * @param interference non-null interference graph for SSA registers
 * @param minimizeRegisters true if converter should take steps to
 * minimize rop-form registers
 */
public FirstFitLocalCombiningAllocator(
        SsaMethod ssaMeth, InterferenceGraph interference,
        boolean minimizeRegisters) {
    super(ssaMeth, interference);

    ssaRegsMapped = new BitSet(ssaMeth.getRegCount());

    mapper = new InterferenceRegisterMapper(
            interference, ssaMeth.getRegCount());

    this.minimizeRegisters = minimizeRegisters;

    /*
     * Reserve space for the params at the bottom of the register
     * space. Later, we'll flip the params to the end of the register
     * space.
     */

    paramRangeEnd = ssaMeth.getParamWidth();

    reservedRopRegs = new BitSet(paramRangeEnd * 2);
    reservedRopRegs.set(0, paramRangeEnd);
    usedRopRegs = new BitSet(paramRangeEnd * 2);
    localVariables = new TreeMap<LocalItem, ArrayList<RegisterSpec>>();
    moveResultPseudoInsns = new ArrayList<NormalSsaInsn>();
    invokeRangeInsns = new ArrayList<NormalSsaInsn>();
    phiInsns = new ArrayList<PhiInsn>();
}
 
Example 3
Source File: FirstFitAllocator.java    From Box with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
public FirstFitAllocator(
        final SsaMethod ssaMeth, final InterferenceGraph interference) {
    super(ssaMeth, interference);

    mapped = new BitSet(ssaMeth.getRegCount());
}
 
Example 4
Source File: LivenessAnalyzer.java    From Box with Apache License 2.0 5 votes vote down vote up
/**
 * Runs register liveness algorithm for a method, updating the
 * live in/out information in {@code SsaBasicBlock} instances and
 * returning an interference graph.
 *
 * @param ssaMeth {@code non-null;} method to process
 * @return {@code non-null;} interference graph indexed by SSA
 * registers in both directions
 */
public static InterferenceGraph constructInterferenceGraph(
        SsaMethod ssaMeth) {
    int szRegs = ssaMeth.getRegCount();
    InterferenceGraph interference = new InterferenceGraph(szRegs);

    for (int i = 0; i < szRegs; i++) {
        new LivenessAnalyzer(ssaMeth, i, interference).run();
    }

    coInterferePhis(ssaMeth, interference);

    return interference;
}
 
Example 5
Source File: FirstFitLocalCombiningAllocator.java    From Box with Apache License 2.0 5 votes vote down vote up
/**
 * Constructs instance.
 *
 * @param ssaMeth {@code non-null;} method to process
 * @param interference non-null interference graph for SSA registers
 * @param minimizeRegisters true if converter should take steps to
 * minimize rop-form registers
 */
public FirstFitLocalCombiningAllocator(
        SsaMethod ssaMeth, InterferenceGraph interference,
        boolean minimizeRegisters) {
    super(ssaMeth, interference);

    ssaRegsMapped = new BitSet(ssaMeth.getRegCount());

    mapper = new InterferenceRegisterMapper(
            interference, ssaMeth.getRegCount());

    this.minimizeRegisters = minimizeRegisters;

    /*
     * Reserve space for the params at the bottom of the register
     * space. Later, we'll flip the params to the end of the register
     * space.
     */

    paramRangeEnd = ssaMeth.getParamWidth();

    reservedRopRegs = new BitSet(paramRangeEnd * 2);
    reservedRopRegs.set(0, paramRangeEnd);
    usedRopRegs = new BitSet(paramRangeEnd * 2);
    localVariables = new TreeMap<LocalItem, ArrayList<RegisterSpec>>();
    moveResultPseudoInsns = new ArrayList<NormalSsaInsn>();
    invokeRangeInsns = new ArrayList<NormalSsaInsn>();
    phiInsns = new ArrayList<PhiInsn>();
}
 
Example 6
Source File: FirstFitAllocator.java    From Box with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
public FirstFitAllocator(
        final SsaMethod ssaMeth, final InterferenceGraph interference) {
    super(ssaMeth, interference);

    mapped = new BitSet(ssaMeth.getRegCount());
}
 
Example 7
Source File: LivenessAnalyzer.java    From J2ME-Loader with Apache License 2.0 5 votes vote down vote up
/**
 * Runs register liveness algorithm for a method, updating the
 * live in/out information in {@code SsaBasicBlock} instances and
 * returning an interference graph.
 *
 * @param ssaMeth {@code non-null;} method to process
 * @return {@code non-null;} interference graph indexed by SSA
 * registers in both directions
 */
public static InterferenceGraph constructInterferenceGraph(
        SsaMethod ssaMeth) {
    int szRegs = ssaMeth.getRegCount();
    InterferenceGraph interference = new InterferenceGraph(szRegs);

    for (int i = 0; i < szRegs; i++) {
        new LivenessAnalyzer(ssaMeth, i, interference).run();
    }

    coInterferePhis(ssaMeth, interference);

    return interference;
}
 
Example 8
Source File: FirstFitLocalCombiningAllocator.java    From J2ME-Loader with Apache License 2.0 5 votes vote down vote up
/**
   * Constructs instance.
   *
   * @param ssaMeth {@code non-null;} method to process
   * @param interference non-null interference graph for SSA registers
   * @param minimizeRegisters true if converter should take steps to
   * minimize rop-form registers
   */
  public FirstFitLocalCombiningAllocator(
          SsaMethod ssaMeth, InterferenceGraph interference,
          boolean minimizeRegisters) {
      super(ssaMeth, interference);

      ssaRegsMapped = new BitSet(ssaMeth.getRegCount());

      mapper = new InterferenceRegisterMapper(
              interference, ssaMeth.getRegCount());

/*
       * Reserve space for the params at the bottom of the register
       * space. Later, we'll flip the params to the end of the register
       * space.
       */

      paramRangeEnd = ssaMeth.getParamWidth();

      reservedRopRegs = new BitSet(paramRangeEnd * 2);
      reservedRopRegs.set(0, paramRangeEnd);
      usedRopRegs = new BitSet(paramRangeEnd * 2);
      localVariables = new TreeMap<LocalItem, ArrayList<RegisterSpec>>();
      moveResultPseudoInsns = new ArrayList<NormalSsaInsn>();
      invokeRangeInsns = new ArrayList<NormalSsaInsn>();
      phiInsns = new ArrayList<PhiInsn>();
  }
 
Example 9
Source File: FirstFitAllocator.java    From J2ME-Loader with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
public FirstFitAllocator(
        final SsaMethod ssaMeth, final InterferenceGraph interference) {
    super(ssaMeth, interference);

    mapped = new BitSet(ssaMeth.getRegCount());
}
 
Example 10
Source File: LivenessAnalyzer.java    From buck with Apache License 2.0 5 votes vote down vote up
/**
 * Runs register liveness algorithm for a method, updating the
 * live in/out information in {@code SsaBasicBlock} instances and
 * returning an interference graph.
 *
 * @param ssaMeth {@code non-null;} method to process
 * @return {@code non-null;} interference graph indexed by SSA
 * registers in both directions
 */
public static InterferenceGraph constructInterferenceGraph(
        SsaMethod ssaMeth) {
    int szRegs = ssaMeth.getRegCount();
    InterferenceGraph interference = new InterferenceGraph(szRegs);

    for (int i = 0; i < szRegs; i++) {
        new LivenessAnalyzer(ssaMeth, i, interference).run();
    }

    coInterferePhis(ssaMeth, interference);

    return interference;
}
 
Example 11
Source File: FirstFitLocalCombiningAllocator.java    From buck with Apache License 2.0 5 votes vote down vote up
/**
 * Constructs instance.
 *
 * @param ssaMeth {@code non-null;} method to process
 * @param interference non-null interference graph for SSA registers
 * @param minimizeRegisters true if converter should take steps to
 * minimize rop-form registers
 */
public FirstFitLocalCombiningAllocator(
        SsaMethod ssaMeth, InterferenceGraph interference,
        boolean minimizeRegisters) {
    super(ssaMeth, interference);

    ssaRegsMapped = new BitSet(ssaMeth.getRegCount());

    mapper = new InterferenceRegisterMapper(
            interference, ssaMeth.getRegCount());

    this.minimizeRegisters = minimizeRegisters;

    /*
     * Reserve space for the params at the bottom of the register
     * space. Later, we'll flip the params to the end of the register
     * space.
     */

    paramRangeEnd = ssaMeth.getParamWidth();

    reservedRopRegs = new BitSet(paramRangeEnd * 2);
    reservedRopRegs.set(0, paramRangeEnd);
    usedRopRegs = new BitSet(paramRangeEnd * 2);
    localVariables = new TreeMap<LocalItem, ArrayList<RegisterSpec>>();
    moveResultPseudoInsns = new ArrayList<NormalSsaInsn>();
    invokeRangeInsns = new ArrayList<NormalSsaInsn>();
    phiInsns = new ArrayList<PhiInsn>();
}
 
Example 12
Source File: FirstFitAllocator.java    From buck with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
public FirstFitAllocator(
        final SsaMethod ssaMeth, final InterferenceGraph interference) {
    super(ssaMeth, interference);

    mapped = new BitSet(ssaMeth.getRegCount());
}