ApfGenerator - remove unused add{Div,Mul}{,R1}
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I97ab2ca02693dee4eb963fa83d5e53a0805b1181
diff --git a/src/android/net/apf/ApfGenerator.java b/src/android/net/apf/ApfGenerator.java
index 7fc5fd3..a5ce2d0 100644
--- a/src/android/net/apf/ApfGenerator.java
+++ b/src/android/net/apf/ApfGenerator.java
@@ -508,26 +508,6 @@
}
/**
- * Add an instruction to the end of the program to multiply register R0 by {@code value}.
- */
- public ApfGenerator addMul(int value) {
- Instruction instruction = new Instruction(Opcodes.MUL);
- instruction.setUnsignedImm(value);
- addInstruction(instruction);
- return this;
- }
-
- /**
- * Add an instruction to the end of the program to divide register R0 by {@code value}.
- */
- public ApfGenerator addDiv(int value) {
- Instruction instruction = new Instruction(Opcodes.DIV);
- instruction.setUnsignedImm(value);
- addInstruction(instruction);
- return this;
- }
-
- /**
* Add an instruction to the end of the program to logically and register R0 with {@code value}.
*/
public ApfGenerator addAnd(int value) {
@@ -578,24 +558,6 @@
}
/**
- * Add an instruction to the end of the program to multiply register R0 by register R1.
- */
- public ApfGenerator addMulR1() {
- Instruction instruction = new Instruction(Opcodes.MUL, Register.R1);
- addInstruction(instruction);
- return this;
- }
-
- /**
- * Add an instruction to the end of the program to divide register R0 by register R1.
- */
- public ApfGenerator addDivR1() {
- Instruction instruction = new Instruction(Opcodes.DIV, Register.R1);
- addInstruction(instruction);
- return this;
- }
-
- /**
* Add an instruction to the end of the program to logically and register R0 with register R1
* and store the result back into register R0.
*/
diff --git a/tests/unit/src/android/net/apf/ApfTest.java b/tests/unit/src/android/net/apf/ApfTest.java
index 10857ee..2702759 100644
--- a/tests/unit/src/android/net/apf/ApfTest.java
+++ b/tests/unit/src/android/net/apf/ApfTest.java
@@ -375,26 +375,6 @@
gen.addJumpIfR0Equals(1234567890 >> 1, gen.DROP_LABEL);
assertDrop(gen);
- // Test multiply.
- gen = new ApfGenerator(MIN_APF_VERSION);
- gen.addLoadImmediate(R0, 123456789);
- gen.addMul(2);
- gen.addJumpIfR0Equals(123456789 * 2, gen.DROP_LABEL);
- assertDrop(gen);
-
- // Test divide.
- gen = new ApfGenerator(MIN_APF_VERSION);
- gen.addLoadImmediate(R0, 1234567890);
- gen.addDiv(2);
- gen.addJumpIfR0Equals(1234567890 / 2, gen.DROP_LABEL);
- assertDrop(gen);
-
- // Test divide by zero.
- gen = new ApfGenerator(MIN_APF_VERSION);
- gen.addDiv(0);
- gen.addJump(gen.DROP_LABEL);
- assertPass(gen);
-
// Test add.
gen = new ApfGenerator(MIN_APF_VERSION);
gen.addLoadImmediate(R1, 1234567890);
@@ -440,28 +420,6 @@
gen.addJumpIfR0Equals(1234567890 >> 1, gen.DROP_LABEL);
assertDrop(gen);
- // Test multiply.
- gen = new ApfGenerator(MIN_APF_VERSION);
- gen.addLoadImmediate(R0, 123456789);
- gen.addLoadImmediate(R1, 2);
- gen.addMulR1();
- gen.addJumpIfR0Equals(123456789 * 2, gen.DROP_LABEL);
- assertDrop(gen);
-
- // Test divide.
- gen = new ApfGenerator(MIN_APF_VERSION);
- gen.addLoadImmediate(R0, 1234567890);
- gen.addLoadImmediate(R1, 2);
- gen.addDivR1();
- gen.addJumpIfR0Equals(1234567890 / 2, gen.DROP_LABEL);
- assertDrop(gen);
-
- // Test divide by zero.
- gen = new ApfGenerator(MIN_APF_VERSION);
- gen.addDivR1();
- gen.addJump(gen.DROP_LABEL);
- assertPass(gen);
-
// Test byte load.
gen = new ApfGenerator(MIN_APF_VERSION);
gen.addLoad8(R0, 1);