Invoke support for Quick Compiler
Fleshed out invoke and const-string support. Fixed a bug in Phi node
insertion.
With this CL, the "Recursive Fibonacci" and "HelloWorld" milestones are
met.
Added are a set of "HL" (for High-Level) invoke intrinsics. Until we
complete the merging of the Quick & Iceland runtime models the invoke
code sequences are slightly different. Thus, the Greenland IR needs
to represent invokes at a somewhat higher level than Iceland. The
test for fast/slow path needs to happen during the lowering of the
HLInvokeXXX intrinsics in both the Quick and Portable paths.
This will generally be the case in the short term - push fast/slow
path determination below the Greenland IR level. As unification
proceeds, we'll pull as much as makes sense into the common front end.
Change-Id: I0a18edf1be18583c0afdc3f7e10a3e4691968e77
diff --git a/src/compiler/SSATransformation.cc b/src/compiler/SSATransformation.cc
index aedf4be..6eb0415 100644
--- a/src/compiler/SSATransformation.cc
+++ b/src/compiler/SSATransformation.cc
@@ -816,9 +816,10 @@
*/
bool insertPhiNodeOperands(CompilationUnit* cUnit, BasicBlock* bb)
{
- ArenaBitVector* ssaRegV = cUnit->tempSSARegisterV;
GrowableListIterator iter;
MIR *mir;
+ std::vector<int> uses;
+ std::vector<int> incomingArc;
/* Phi nodes are at the beginning of each block */
for (mir = bb->firstMIRInsn; mir; mir = mir->next) {
@@ -828,7 +829,8 @@
DCHECK_GE(ssaReg, 0); // Shouldn't see compiler temps here
int vReg = SRegToVReg(cUnit, ssaReg);
- oatClearAllBits(ssaRegV);
+ uses.clear();
+ incomingArc.clear();
/* Iterate through the predecessors */
oatGrowableListIteratorInit(bb->predecessors, &iter);
@@ -837,12 +839,12 @@
(BasicBlock*)oatGrowableListIteratorNext(&iter);
if (!predBB) break;
int ssaReg = predBB->dataFlowInfo->vRegToSSAMap[vReg];
- oatSetBit(cUnit, ssaRegV, ssaReg);
- cUnit->tempSSABlockIdV[ssaReg] = predBB->id;
+ uses.push_back(ssaReg);
+ incomingArc.push_back(predBB->id);
}
/* Count the number of SSA registers for a Dalvik register */
- int numUses = oatCountSetBits(ssaRegV);
+ int numUses = uses.size();
mir->ssaRep->numUses = numUses;
mir->ssaRep->uses =
(int*) oatNew(cUnit, sizeof(int) * numUses, false, kAllocDFInfo);
@@ -853,17 +855,11 @@
// TODO: Ugly, rework (but don't burden each MIR/LIR for Phi-only needs)
mir->dalvikInsn.vB = (intptr_t) incoming;
- ArenaBitVectorIterator phiIterator;
-
- oatBitVectorIteratorInit(ssaRegV, &phiIterator);
- int *usePtr = mir->ssaRep->uses;
-
/* Set the uses array for the phi node */
- while (true) {
- int ssaRegIdx = oatBitVectorIteratorNext(&phiIterator);
- if (ssaRegIdx == -1) break;
- *usePtr++ = ssaRegIdx;
- *incoming++ = cUnit->tempSSABlockIdV[ssaRegIdx];
+ int *usePtr = mir->ssaRep->uses;
+ for (int i = 0; i < numUses; i++) {
+ *usePtr++ = uses[i];
+ *incoming++ = incomingArc[i];
}
}