From e196567b50a084b163937ea9605b51ee1e48adeb Mon Sep 17 00:00:00 2001 From: buzbee Date: Sun, 11 Mar 2012 18:39:19 -0700 Subject: SSA rework and support compiler temps in the frame Add ability for the compiler to allocate new frame temporaries that play nicely with the register allocation mechanism. To do this we assign negative virtual register numbers and give them SSA names. As part of this change, I did a general cleanup of the ssa naming. An ssa name (or SReg) is in index into an array of (virtual reg, subscript) pairs. Previously, 16 bits were allocated for the reg and the subscript. This CL expands the virtual reg and subscript to 32 bits each. Method* is now treated as a RegLocation, and will be subject to temp register tracking and reuse. This CL does not yet include support for promotion of Method* - that will show up in the next one. Also included is the beginning of a basic block optimization pass (not yet in a runable state, so conditionally compiled out). (cherry picked from commit f689ffec8827f1dd6b31084f8a6bb240338c7acf) Change-Id: Ibbdeb97fe05d0e33c1f4a9a6ccbdef1cac7646fc --- src/compiler/codegen/MethodCodegenDriver.cc | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'src/compiler/codegen/MethodCodegenDriver.cc') diff --git a/src/compiler/codegen/MethodCodegenDriver.cc b/src/compiler/codegen/MethodCodegenDriver.cc index 6b3283e13f..5baabf2f32 100644 --- a/src/compiler/codegen/MethodCodegenDriver.cc +++ b/src/compiler/codegen/MethodCodegenDriver.cc @@ -716,8 +716,7 @@ const char* extendedMIROpNames[kMirOpLast - kMirOpFirst] = { "kMirOpNullNRangeUpCheck", "kMirOpNullNRangeDownCheck", "kMirOpLowerBound", - "kMirOpPunt", - "kMirOpCheckInlinePrediction", + "kMirOpCopy", }; /* Extended MIR instructions like PHI */ @@ -742,6 +741,9 @@ void handleExtendedMethodMIR(CompilationUnit* cUnit, MIR* mir) newLIR1(cUnit, kPseudoSSARep, (int) ssaString); break; } + case kMirOpCopy: + UNIMPLEMENTED(FATAL) << "Need kMirOpCopy"; + break; default: break; } @@ -761,11 +763,19 @@ bool methodBlockCodeGen(CompilationUnit* cUnit, BasicBlock* bb) labelList[blockId].opcode = kPseudoNormalBlockLabel; oatAppendLIR(cUnit, (LIR*) &labelList[blockId]); - /* Reset local optimization data on block boundaries */ + /* Free temp registers and reset redundant store tracking */ oatResetRegPool(cUnit); - oatClobberAllRegs(cUnit); oatResetDefTracking(cUnit); + /* + * If control reached us from our immediate predecessor via + * fallthrough and we have no other incoming arcs we can + * reuse existing liveness. Otherwise, reset. + */ + if (!bb->fallThroughTarget || bb->predecessors->numUsed != 1) { + oatClobberAllRegs(cUnit); + } + LIR* headLIR = NULL; if (bb->blockType == kEntryBlock) { -- cgit v1.2.3-59-g8ed1b