Search in sources :

Example 16 with PhiInsn

use of jadx.core.dex.instructions.PhiInsn 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.setUsedInPhi(null);
                    }
                }
                InstructionRemover.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

PhiInsn (jadx.core.dex.instructions.PhiInsn)16 RegisterArg (jadx.core.dex.instructions.args.RegisterArg)11 InsnNode (jadx.core.dex.nodes.InsnNode)10 PhiListAttr (jadx.core.dex.attributes.nodes.PhiListAttr)8 BlockNode (jadx.core.dex.nodes.BlockNode)8 SSAVar (jadx.core.dex.instructions.args.SSAVar)7 InsnArg (jadx.core.dex.instructions.args.InsnArg)4 JadxRuntimeException (jadx.core.utils.exceptions.JadxRuntimeException)3 ArrayList (java.util.ArrayList)2 ArgType (jadx.core.dex.instructions.args.ArgType)1 TernaryInsn (jadx.core.dex.instructions.mods.TernaryInsn)1 DexNode (jadx.core.dex.nodes.DexNode)1 IContainer (jadx.core.dex.nodes.IContainer)1 ForLoop (jadx.core.dex.regions.loops.ForLoop)1 LoopType (jadx.core.dex.regions.loops.LoopType)1 HashMap (java.util.HashMap)1 LinkedList (java.util.LinkedList)1 Map (java.util.Map)1