Search in sources :

Example 11 with PhiListAttr

use of jadx.core.dex.attributes.nodes.PhiListAttr in project jadx by skylot.

the class SSATransform method removePhiList.

private static boolean removePhiList(MethodNode mth, List<PhiInsn> insnToRemove) {
    for (BlockNode block : mth.getBasicBlocks()) {
        PhiListAttr phiList = block.get(AType.PHI_LIST);
        if (phiList == null) {
            continue;
        }
        List<PhiInsn> list = phiList.getList();
        for (PhiInsn phiInsn : insnToRemove) {
            if (list.remove(phiInsn)) {
                for (InsnArg arg : phiInsn.getArguments()) {
                    if (arg == null) {
                        continue;
                    }
                    SSAVar sVar = ((RegisterArg) arg).getSVar();
                    if (sVar != null) {
                        sVar.removeUsedInPhi(phiInsn);
                    }
                }
                InsnRemover.remove(mth, block, phiInsn);
            }
        }
        if (list.isEmpty()) {
            block.remove(AType.PHI_LIST);
        }
    }
    insnToRemove.clear();
    return true;
}
Also used : BlockNode(jadx.core.dex.nodes.BlockNode) RegisterArg(jadx.core.dex.instructions.args.RegisterArg) PhiInsn(jadx.core.dex.instructions.PhiInsn) SSAVar(jadx.core.dex.instructions.args.SSAVar) InsnArg(jadx.core.dex.instructions.args.InsnArg) PhiListAttr(jadx.core.dex.attributes.nodes.PhiListAttr)

Aggregations

PhiListAttr (jadx.core.dex.attributes.nodes.PhiListAttr)11 PhiInsn (jadx.core.dex.instructions.PhiInsn)11 BlockNode (jadx.core.dex.nodes.BlockNode)9 RegisterArg (jadx.core.dex.instructions.args.RegisterArg)8 SSAVar (jadx.core.dex.instructions.args.SSAVar)7 InsnNode (jadx.core.dex.nodes.InsnNode)6 InsnArg (jadx.core.dex.instructions.args.InsnArg)5 JadxRuntimeException (jadx.core.utils.exceptions.JadxRuntimeException)3 ArrayList (java.util.ArrayList)3