More Quick compiler mir/bb cleanup
Removed the references to MIR and BasicBlock from the generator
for NEW_ARRAY and the compare/branch. The previously-introduced
InvokeInfo structure was sufficient for handling the NEW_ARRAY call,
so renamed it to cover both.
This CL should end this round of restructuring.
Change-Id: I9bec6a820589a562eb58f0c9688d27fabe98c064
diff --git a/src/compiler/codegen/MethodCodegenDriver.cc b/src/compiler/codegen/MethodCodegenDriver.cc
index 1707a89..e06cf3f 100644
--- a/src/compiler/codegen/MethodCodegenDriver.cc
+++ b/src/compiler/codegen/MethodCodegenDriver.cc
@@ -53,7 +53,7 @@
return res;
}
-void genInvoke(CompilationUnit* cUnit, InvokeInfo* info)
+void genInvoke(CompilationUnit* cUnit, CallInfo* info)
{
if (genIntrinsic(cUnit, info)) {
return;
@@ -72,7 +72,7 @@
cUnit->code_item, cUnit->method_idx,
cUnit->access_flags);
- uint32_t dexMethodIdx = info->methodIdx;
+ uint32_t dexMethodIdx = info->index;
int vtableIdx;
uintptr_t directCode;
uintptr_t directMethod;
@@ -174,10 +174,10 @@
* high-word loc for wide arguments. Also pull up any following
* MOVE_RESULT and incorporate it into the invoke.
*/
-InvokeInfo* newInvokeInfo(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir,
- InvokeType type, bool isRange)
+CallInfo* newCallInfo(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir,
+ InvokeType type, bool isRange)
{
- InvokeInfo* info = (InvokeInfo*)oatNew(cUnit, sizeof(InvokeInfo), true,
+ CallInfo* info = (CallInfo*)oatNew(cUnit, sizeof(CallInfo), true,
kAllocMisc);
MIR* moveResultMIR = oatFindMoveResult(cUnit, bb, mir);
if (moveResultMIR == NULL) {
@@ -195,7 +195,7 @@
info->optFlags = mir->optimizationFlags;
info->type = type;
info->isRange = isRange;
- info->methodIdx = mir->dalvikInsn.vB;
+ info->index = mir->dalvikInsn.vB;
info->offset = mir->offset;
return info;
}
@@ -414,11 +414,13 @@
break;
case Instruction::FILLED_NEW_ARRAY:
- genFilledNewArray(cUnit, mir, false /* not range */);
+ genFilledNewArray(cUnit, newCallInfo(cUnit, bb, mir, kStatic,
+ false /* not range */));
break;
case Instruction::FILLED_NEW_ARRAY_RANGE:
- genFilledNewArray(cUnit, mir, true /* range */);
+ genFilledNewArray(cUnit, newCallInfo(cUnit, bb, mir, kStatic,
+ true /* range */));
break;
case Instruction::NEW_ARRAY:
@@ -460,12 +462,15 @@
case Instruction::IF_GE:
case Instruction::IF_GT:
case Instruction::IF_LE: {
+ LIR* taken = &labelList[bb->taken->id];
+ LIR* fallThrough = &labelList[bb->fallThrough->id];
bool backwardBranch;
backwardBranch = (bb->taken->startOffset <= mir->offset);
if (backwardBranch) {
genSuspendTest(cUnit, optFlags);
}
- genCompareAndBranch(cUnit, bb, opcode, rlSrc[0], rlSrc[1], labelList);
+ genCompareAndBranch(cUnit, opcode, rlSrc[0], rlSrc[1], taken,
+ fallThrough);
break;
}
@@ -475,12 +480,14 @@
case Instruction::IF_GEZ:
case Instruction::IF_GTZ:
case Instruction::IF_LEZ: {
+ LIR* taken = &labelList[bb->taken->id];
+ LIR* fallThrough = &labelList[bb->fallThrough->id];
bool backwardBranch;
backwardBranch = (bb->taken->startOffset <= mir->offset);
if (backwardBranch) {
genSuspendTest(cUnit, optFlags);
}
- genCompareZeroAndBranch(cUnit, bb, opcode, rlSrc[0], labelList);
+ genCompareZeroAndBranch(cUnit, opcode, rlSrc[0], taken, fallThrough);
break;
}
@@ -610,38 +617,38 @@
break;
case Instruction::INVOKE_STATIC_RANGE:
- genInvoke(cUnit, newInvokeInfo(cUnit, bb, mir, kStatic, true));
+ genInvoke(cUnit, newCallInfo(cUnit, bb, mir, kStatic, true));
break;
case Instruction::INVOKE_STATIC:
- genInvoke(cUnit, newInvokeInfo(cUnit, bb, mir, kStatic, false));
+ genInvoke(cUnit, newCallInfo(cUnit, bb, mir, kStatic, false));
break;
case Instruction::INVOKE_DIRECT:
- genInvoke(cUnit, newInvokeInfo(cUnit, bb, mir, kDirect, false));
+ genInvoke(cUnit, newCallInfo(cUnit, bb, mir, kDirect, false));
break;
case Instruction::INVOKE_DIRECT_RANGE:
- genInvoke(cUnit, newInvokeInfo(cUnit, bb, mir, kDirect, true));
+ genInvoke(cUnit, newCallInfo(cUnit, bb, mir, kDirect, true));
break;
case Instruction::INVOKE_VIRTUAL:
- genInvoke(cUnit, newInvokeInfo(cUnit, bb, mir, kVirtual, false));
+ genInvoke(cUnit, newCallInfo(cUnit, bb, mir, kVirtual, false));
break;
case Instruction::INVOKE_VIRTUAL_RANGE:
- genInvoke(cUnit, newInvokeInfo(cUnit, bb, mir, kVirtual, true));
+ genInvoke(cUnit, newCallInfo(cUnit, bb, mir, kVirtual, true));
break;
case Instruction::INVOKE_SUPER:
- genInvoke(cUnit, newInvokeInfo(cUnit, bb, mir, kSuper, false));
+ genInvoke(cUnit, newCallInfo(cUnit, bb, mir, kSuper, false));
break;
case Instruction::INVOKE_SUPER_RANGE:
- genInvoke(cUnit, newInvokeInfo(cUnit, bb, mir, kSuper, true));
+ genInvoke(cUnit, newCallInfo(cUnit, bb, mir, kSuper, true));
break;
case Instruction::INVOKE_INTERFACE:
- genInvoke(cUnit, newInvokeInfo(cUnit, bb, mir, kInterface, false));
+ genInvoke(cUnit, newCallInfo(cUnit, bb, mir, kInterface, false));
break;
case Instruction::INVOKE_INTERFACE_RANGE:
- genInvoke(cUnit, newInvokeInfo(cUnit, bb, mir, kInterface, true));
+ genInvoke(cUnit, newCallInfo(cUnit, bb, mir, kInterface, true));
break;
case Instruction::NEG_INT: