Add FiveRegisterInstruction and RegisterRangeInstruction interfaces

Implement new interfaces on appropriate Instruction classes

git-svn-id: https://smali.googlecode.com/svn/trunk@549 55b6fa8a-2a1e-11de-a435-ffa8d773f76a
This commit is contained in:
JesusFreke@JesusFreke.com 2010-01-12 07:13:09 +00:00
parent 4238ac2dd1
commit 4610bfd7a9
10 changed files with 53 additions and 28 deletions

View File

@ -0,0 +1,10 @@
package org.jf.dexlib.Code;
public interface FiveRegisterInstruction {
byte getRegCount();
byte getRegisterA();
byte getRegisterD();
byte getRegisterE();
byte getRegisterF();
byte getRegisterG();
}

View File

@ -28,6 +28,7 @@
package org.jf.dexlib.Code.Format;
import org.jf.dexlib.Code.FiveRegisterInstruction;
import org.jf.dexlib.Code.Instruction;
import org.jf.dexlib.Code.InstructionWithReference;
import org.jf.dexlib.Code.Opcode;
@ -39,7 +40,7 @@ import org.jf.dexlib.TypeIdItem;
import org.jf.dexlib.Util.NumberUtils;
import org.jf.dexlib.Util.AnnotatedOutput;
public class Instruction35c extends InstructionWithReference {
public class Instruction35c extends InstructionWithReference implements FiveRegisterInstruction {
public static final Instruction.InstructionFactory Factory = new Factory();
private byte regCount;
private byte regA;
@ -103,14 +104,14 @@ public class Instruction35c extends InstructionWithReference {
return Format.Format35c;
}
public byte getRegisterA() {
return regA;
}
public byte getRegCount() {
return regCount;
}
public byte getRegisterA() {
return regA;
}
public byte getRegisterD() {
return regD;
}

View File

@ -28,6 +28,7 @@
package org.jf.dexlib.Code.Format;
import org.jf.dexlib.Code.FiveRegisterInstruction;
import org.jf.dexlib.Code.Instruction;
import org.jf.dexlib.Code.Opcode;
import org.jf.dexlib.Util.NumberUtils;
@ -35,7 +36,7 @@ import org.jf.dexlib.Util.AnnotatedOutput;
import org.jf.dexlib.DexFile;
public class Instruction35ms extends Instruction {
public class Instruction35ms extends Instruction implements FiveRegisterInstruction {
public static final Instruction.InstructionFactory Factory = new Factory();
private byte regCount;
private byte regA;
@ -97,14 +98,14 @@ public class Instruction35ms extends Instruction {
return Format.Format35ms;
}
public byte getRegisterA() {
return regA;
}
public byte getRegCount() {
return regCount;
}
public byte getRegisterA() {
return regA;
}
public byte getRegisterD() {
return regD;
}

View File

@ -28,12 +28,13 @@
package org.jf.dexlib.Code.Format;
import org.jf.dexlib.Code.FiveRegisterInstruction;
import org.jf.dexlib.Code.Opcode;
import org.jf.dexlib.Code.InstructionWithReference;
import org.jf.dexlib.MethodIdItem;
import org.jf.dexlib.Util.AnnotatedOutput;
public class Instruction35msf extends InstructionWithReference {
public class Instruction35msf extends InstructionWithReference implements FiveRegisterInstruction {
private final Instruction35ms unfixedInstruction;
public Instruction35msf(Opcode opcode, Instruction35ms unfixedInstruction, MethodIdItem method) {
@ -61,14 +62,14 @@ public class Instruction35msf extends InstructionWithReference {
return Format.Format35msf;
}
public byte getRegisterA() {
return unfixedInstruction.getRegisterA();
}
public byte getRegCount() {
return unfixedInstruction.getRegCount();
}
public byte getRegisterA() {
return unfixedInstruction.getRegisterA();
}
public byte getRegisterD() {
return unfixedInstruction.getRegisterD();
}

View File

@ -28,6 +28,7 @@
package org.jf.dexlib.Code.Format;
import org.jf.dexlib.Code.FiveRegisterInstruction;
import org.jf.dexlib.Code.Instruction;
import org.jf.dexlib.Code.Opcode;
import org.jf.dexlib.Code.InstructionWithReference;
@ -39,7 +40,7 @@ import org.jf.dexlib.DexFile;
import org.jf.dexlib.TypeIdItem;
import org.jf.dexlib.MethodIdItem;
public class Instruction35s extends InstructionWithReference {
public class Instruction35s extends InstructionWithReference implements FiveRegisterInstruction {
public static final Instruction.InstructionFactory Factory = new Factory();
private byte regCount;
private byte regA;
@ -103,14 +104,14 @@ public class Instruction35s extends InstructionWithReference {
return Format.Format35s;
}
public byte getRegisterA() {
return regA;
}
public byte getRegCount() {
return regCount;
}
public byte getRegisterA() {
return regA;
}
public byte getRegisterD() {
return regD;
}

View File

@ -28,11 +28,12 @@
package org.jf.dexlib.Code.Format;
import org.jf.dexlib.Code.FiveRegisterInstruction;
import org.jf.dexlib.Code.Opcode;
import org.jf.dexlib.Code.InstructionWithReference;
import org.jf.dexlib.Util.AnnotatedOutput;
public class Instruction35sf extends InstructionWithReference {
public class Instruction35sf extends InstructionWithReference implements FiveRegisterInstruction {
private final Instruction35s unfixedInstruction;
public Instruction35sf(Instruction35s unfixedInstruction) {
@ -59,14 +60,14 @@ public class Instruction35sf extends InstructionWithReference {
return Format.Format35sf;
}
public byte getRegisterA() {
return unfixedInstruction.getRegisterA();
}
public byte getRegCount() {
return unfixedInstruction.getRegCount();
}
public byte getRegisterA() {
return unfixedInstruction.getRegisterA();
}
public byte getRegisterD() {
return unfixedInstruction.getRegisterD();
}

View File

@ -32,6 +32,8 @@ import org.jf.dexlib.Code.Instruction;
import org.jf.dexlib.Code.InstructionWithReference;
import org.jf.dexlib.Code.Opcode;
import static org.jf.dexlib.Code.Opcode.*;
import org.jf.dexlib.Code.RegisterRangeInstruction;
import org.jf.dexlib.DexFile;
import org.jf.dexlib.Item;
import org.jf.dexlib.MethodIdItem;
@ -39,7 +41,7 @@ import org.jf.dexlib.TypeIdItem;
import org.jf.dexlib.Util.NumberUtils;
import org.jf.dexlib.Util.AnnotatedOutput;
public class Instruction3rc extends InstructionWithReference {
public class Instruction3rc extends InstructionWithReference implements RegisterRangeInstruction {
public static final Instruction.InstructionFactory Factory = new Factory();
private byte regCount;
private short startReg;

View File

@ -30,11 +30,12 @@ package org.jf.dexlib.Code.Format;
import org.jf.dexlib.Code.Instruction;
import org.jf.dexlib.Code.Opcode;
import org.jf.dexlib.Code.RegisterRangeInstruction;
import org.jf.dexlib.Util.NumberUtils;
import org.jf.dexlib.Util.AnnotatedOutput;
import org.jf.dexlib.DexFile;
public class Instruction3rms extends Instruction {
public class Instruction3rms extends Instruction implements RegisterRangeInstruction {
public static final Instruction.InstructionFactory Factory = new Factory();
private byte regCount;
private short startReg;

View File

@ -30,10 +30,11 @@ package org.jf.dexlib.Code.Format;
import org.jf.dexlib.Code.Opcode;
import org.jf.dexlib.Code.InstructionWithReference;
import org.jf.dexlib.Code.RegisterRangeInstruction;
import org.jf.dexlib.MethodIdItem;
import org.jf.dexlib.Util.AnnotatedOutput;
public class Instruction3rmsf extends InstructionWithReference {
public class Instruction3rmsf extends InstructionWithReference implements RegisterRangeInstruction {
private final Instruction3rms unfixedInstruction;
public Instruction3rmsf(Opcode opcode, Instruction3rms unfixedInstruction, MethodIdItem method) {

View File

@ -0,0 +1,6 @@
package org.jf.dexlib.Code;
public interface RegisterRangeInstruction {
short getRegCount();
int getStartRegister();
}