Foundation for Quick LLVM compiler
Ready for review - probably better get this cleaned up and
checked in even though much work remains.
Basic conversion from MIR to GreenlandIR and from GreenlandIR
back to LIR. Support sufficient to run Fibonacci test.
Note some structural changes in MIR to support this work:
o retaining incoming label for phi nodes
o constant propagation
o include object reference detection in type inference pass
Change-Id: I8ba63c73e76d071aa40cae0f744e598b96f68699
diff --git a/src/compiler/SSATransformation.cc b/src/compiler/SSATransformation.cc
index ada9351..b32ad5b 100644
--- a/src/compiler/SSATransformation.cc
+++ b/src/compiler/SSATransformation.cc
@@ -692,15 +692,20 @@
if (!predBB) break;
int ssaReg = predBB->dataFlowInfo->vRegToSSAMap[vReg];
oatSetBit(cUnit, ssaRegV, ssaReg);
+ cUnit->tempSSABlockIdV[ssaReg] = predBB->id;
}
/* Count the number of SSA registers for a Dalvik register */
int numUses = oatCountSetBits(ssaRegV);
mir->ssaRep->numUses = numUses;
mir->ssaRep->uses =
- (int *) oatNew(cUnit, sizeof(int) * numUses, false, kAllocDFInfo);
+ (int*) oatNew(cUnit, sizeof(int) * numUses, false, kAllocDFInfo);
mir->ssaRep->fpUse =
- (bool *) oatNew(cUnit, sizeof(bool) * numUses, true, kAllocDFInfo);
+ (bool*) oatNew(cUnit, sizeof(bool) * numUses, true, kAllocDFInfo);
+ int* incoming =
+ (int*) oatNew(cUnit, sizeof(int) * numUses, false, kAllocDFInfo);
+ // TODO: Ugly, rework (but don't burden each MIR/LIR for Phi-only needs)
+ mir->dalvikInsn.vB = (intptr_t) incoming;
ArenaBitVectorIterator phiIterator;
@@ -712,6 +717,7 @@
int ssaRegIdx = oatBitVectorIteratorNext(&phiIterator);
if (ssaRegIdx == -1) break;
*usePtr++ = ssaRegIdx;
+ *incoming++ = cUnit->tempSSABlockIdV[ssaRegIdx];
}
}
@@ -796,6 +802,10 @@
cUnit->tempSSARegisterV = oatAllocBitVector(cUnit, cUnit->numSSARegs,
false, kBitMapTempSSARegisterV);
+ cUnit->tempSSABlockIdV =
+ (int*)oatNew(cUnit, sizeof(int) * cUnit->numSSARegs, false,
+ kAllocDFInfo);
+
/* Insert phi-operands with latest SSA names from predecessor blocks */
oatDataFlowAnalysisDispatcher(cUnit, insertPhiNodeOperands,
kReachableNodes, false /* isIterative */);