Implemented verification for if-ltz/gez/gtz/lez

git-svn-id: https://smali.googlecode.com/svn/trunk@586 55b6fa8a-2a1e-11de-a435-ffa8d773f76a
This commit is contained in:
JesusFreke@JesusFreke.com
2010-01-24 20:44:05 +00:00
parent cb00252b6a
commit 16a709ba04

View File

@ -495,6 +495,11 @@ public class MethodAnalyzer {
case IF_EQZ:
case IF_NEZ:
return handleIfEqzNez(analyzedInstruction);
case IF_LTZ:
case IF_GEZ:
case IF_GTZ:
case IF_LEZ:
return handleIfz(analyzedInstruction);
}
assert false;
return false;
@ -1330,6 +1335,20 @@ public class MethodAnalyzer {
return true;
}
private boolean handleIfz(AnalyzedInstruction analyzedInstruction) {
SingleRegisterInstruction instruction = (SingleRegisterInstruction)analyzedInstruction.instruction;
RegisterType registerType = analyzedInstruction.getPreInstructionRegisterType(instruction.getRegisterA());
assert registerType != null;
if (registerType.category == RegisterType.Category.Unknown) {
return false;
}
checkRegister(registerType, Primitive32BitCategories);
return true;
}
private static void checkRegister(RegisterType registerType, EnumSet validCategories) {
if (!validCategories.contains(registerType.category)) {
//TODO: add expected categories to error message