Java Code Examples for com.android.dx.ssa.SsaBasicBlock#getPhiInsns()

The following examples show how to use com.android.dx.ssa.SsaBasicBlock#getPhiInsns() . 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 6 votes vote down vote up
/**
 * Ensures that all the phi result registers for all the phis in the
 * same basic block interfere with each other, and also that a phi's source
 * registers interfere with the result registers from other phis. This is needed since
 * the dead code remover has allowed through "dead-end phis" whose
 * results are not used except as local assignments. Without this step,
 * a the result of a dead-end phi might be assigned the same register
 * as the result of another phi, and the phi removal move scheduler may
 * generate moves that over-write the live result.
 *
 * @param ssaMeth {@code non-null;} method to process
 * @param interference {@code non-null;} interference graph
 */
private static void coInterferePhis(SsaMethod ssaMeth,
        InterferenceGraph interference) {
    for (SsaBasicBlock b : ssaMeth.getBlocks()) {
        List<SsaInsn> phis = b.getPhiInsns();

        int szPhis = phis.size();

        for (int i = 0; i < szPhis; i++) {
            for (int j = 0; j < szPhis; j++) {
                if (i == j) {
                    continue;
                }

                SsaInsn first = phis.get(i);
                SsaInsn second = phis.get(j);
                coInterferePhiRegisters(interference, first.getResult(), second.getSources());
                coInterferePhiRegisters(interference, second.getResult(), first.getSources());
                interference.add(first.getResult().getReg(), second.getResult().getReg());
            }
        }
    }
}
 
Example 2
Source File: LivenessAnalyzer.java    From Box with Apache License 2.0 6 votes vote down vote up
/**
 * Ensures that all the phi result registers for all the phis in the
 * same basic block interfere with each other, and also that a phi's source
 * registers interfere with the result registers from other phis. This is needed since
 * the dead code remover has allowed through "dead-end phis" whose
 * results are not used except as local assignments. Without this step,
 * a the result of a dead-end phi might be assigned the same register
 * as the result of another phi, and the phi removal move scheduler may
 * generate moves that over-write the live result.
 *
 * @param ssaMeth {@code non-null;} method to process
 * @param interference {@code non-null;} interference graph
 */
private static void coInterferePhis(SsaMethod ssaMeth,
        InterferenceGraph interference) {
    for (SsaBasicBlock b : ssaMeth.getBlocks()) {
        List<SsaInsn> phis = b.getPhiInsns();

        int szPhis = phis.size();

        for (int i = 0; i < szPhis; i++) {
            for (int j = 0; j < szPhis; j++) {
                if (i == j) {
                    continue;
                }

                SsaInsn first = phis.get(i);
                SsaInsn second = phis.get(j);
                coInterferePhiRegisters(interference, first.getResult(), second.getSources());
                coInterferePhiRegisters(interference, second.getResult(), first.getSources());
                interference.add(first.getResult().getReg(), second.getResult().getReg());
            }
        }
    }
}
 
Example 3
Source File: LivenessAnalyzer.java    From J2ME-Loader with Apache License 2.0 6 votes vote down vote up
/**
 * Ensures that all the phi result registers for all the phis in the
 * same basic block interfere with each other. This is needed since
 * the dead code remover has allowed through "dead-end phis" whose
 * results are not used except as local assignments. Without this step,
 * a the result of a dead-end phi might be assigned the same register
 * as the result of another phi, and the phi removal move scheduler may
 * generate moves that over-write the live result.
 *
 * @param ssaMeth {@code non-null;} method to pricess
 * @param interference {@code non-null;} interference graph
 */
private static void coInterferePhis(SsaMethod ssaMeth,
        InterferenceGraph interference) {
    for (SsaBasicBlock b : ssaMeth.getBlocks()) {
        List<SsaInsn> phis = b.getPhiInsns();

        int szPhis = phis.size();

        for (int i = 0; i < szPhis; i++) {
            for (int j = 0; j < szPhis; j++) {
                if (i == j) {
                    continue;
                }

                interference.add(phis.get(i).getResult().getReg(),
                    phis.get(j).getResult().getReg());
            }
        }
    }
}
 
Example 4
Source File: LivenessAnalyzer.java    From buck with Apache License 2.0 6 votes vote down vote up
/**
 * Ensures that all the phi result registers for all the phis in the
 * same basic block interfere with each other. This is needed since
 * the dead code remover has allowed through "dead-end phis" whose
 * results are not used except as local assignments. Without this step,
 * a the result of a dead-end phi might be assigned the same register
 * as the result of another phi, and the phi removal move scheduler may
 * generate moves that over-write the live result.
 *
 * @param ssaMeth {@code non-null;} method to pricess
 * @param interference {@code non-null;} interference graph
 */
private static void coInterferePhis(SsaMethod ssaMeth,
        InterferenceGraph interference) {
    for (SsaBasicBlock b : ssaMeth.getBlocks()) {
        List<SsaInsn> phis = b.getPhiInsns();

        int szPhis = phis.size();

        for (int i = 0; i < szPhis; i++) {
            for (int j = 0; j < szPhis; j++) {
                if (i == j) {
                    continue;
                }

                interference.add(phis.get(i).getResult().getReg(),
                    phis.get(j).getResult().getReg());
            }
        }
    }
}