mirror of
https://github.com/revanced/Apktool.git
synced 2024-12-12 05:47:46 +01:00
baksmali: added DIFFPRE reg info
This commit is contained in:
parent
a417cba9e1
commit
2ca53880b1
@ -40,6 +40,8 @@ import java.io.IOException;
|
||||
import java.util.BitSet;
|
||||
|
||||
public class PreInstructionRegisterInfoMethodItem extends MethodItem {
|
||||
private static AnalyzedInstruction lastInstruction;
|
||||
|
||||
private final int registerInfo;
|
||||
@Nonnull private final MethodAnalyzer methodAnalyzer;
|
||||
@Nonnull private final RegisterFormatter registerFormatter;
|
||||
@ -77,6 +79,9 @@ public class PreInstructionRegisterInfoMethodItem extends MethodItem {
|
||||
if ((registerInfo & baksmaliOptions.ARGS) != 0) {
|
||||
addArgsRegs(registers);
|
||||
}
|
||||
if ((registerInfo & baksmaliOptions.DIFFPRE) != 0) {
|
||||
addDiffRegs(registers);
|
||||
}
|
||||
if ((registerInfo & baksmaliOptions.MERGE) != 0) {
|
||||
if (analyzedInstruction.isBeginningInstruction()) {
|
||||
addParamRegs(registers, registerCount);
|
||||
@ -144,6 +149,19 @@ public class PreInstructionRegisterInfoMethodItem extends MethodItem {
|
||||
}
|
||||
}
|
||||
|
||||
private void addDiffRegs(BitSet registers) {
|
||||
if (! analyzedInstruction.isBeginningInstruction()) {
|
||||
for (int i = 0; i < analyzedInstruction.getRegisterCount(); i++) {
|
||||
if (lastInstruction.getPreInstructionRegisterType(i).category !=
|
||||
analyzedInstruction.getPreInstructionRegisterType(i).category) {
|
||||
registers.set(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lastInstruction = analyzedInstruction;
|
||||
}
|
||||
|
||||
private void addMergeRegs(BitSet registers, int registerCount) {
|
||||
if (analyzedInstruction.getPredecessorCount() <= 1) {
|
||||
//in the common case of an instruction that only has a single predecessor which is the previous
|
||||
|
@ -49,6 +49,8 @@ public class baksmaliOptions {
|
||||
public static final int MERGE = 32;
|
||||
public static final int FULLMERGE = 64;
|
||||
|
||||
public static final int DIFFPRE = 128;
|
||||
|
||||
public int apiLevel = 15;
|
||||
public String outputDirectory = "out";
|
||||
public List<String> bootClassPathDirs = Lists.newArrayList();
|
||||
|
Loading…
Reference in New Issue
Block a user