From 16da88c70c4bdbd97b8482be8b42103a52f22d59 Mon Sep 17 00:00:00 2001 From: buzbee Date: Tue, 20 Mar 2012 10:38:17 -0700 Subject: Custom codegen for small frameless methods. Added a general mechanism that will allow pattern matching of small methods and (generally) frameless code generation. Prevously, all frames were at least 16 bytes, not you can have zero-length frames (and thus some old asserts had to go). Change-Id: Ic786940a602e25b48cbc317ac601ac84cc307762 --- src/compiler/codegen/MethodCodegenDriver.cc | 44 +++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'src/compiler/codegen/MethodCodegenDriver.cc') diff --git a/src/compiler/codegen/MethodCodegenDriver.cc b/src/compiler/codegen/MethodCodegenDriver.cc index 8f4df4714f..671eb7344c 100644 --- a/src/compiler/codegen/MethodCodegenDriver.cc +++ b/src/compiler/codegen/MethodCodegenDriver.cc @@ -887,6 +887,50 @@ bool methodBlockCodeGen(CompilationUnit* cUnit, BasicBlock* bb) return false; } +/* Set basic block labels */ +bool labelBlocks(CompilationUnit* cUnit, BasicBlock* bb) +{ + LIR* labelList = (LIR*) cUnit->blockLabelList; + int blockId = bb->id; + + cUnit->curBlock = bb; + labelList[blockId].operands[0] = bb->startOffset; + + /* Insert the block label */ + labelList[blockId].opcode = kPseudoNormalBlockLabel; + return false; +} + +void oatSpecialMIR2LIR(CompilationUnit* cUnit, SpecialCaseHandler specialCase) +{ + /* Find the first DalvikByteCode block */ + int numReachableBlocks = cUnit->numReachableBlocks; + const GrowableList *blockList = &cUnit->blockList; + BasicBlock*bb = NULL; + for (int idx = 0; idx < numReachableBlocks; idx++) { + int dfsIndex = cUnit->dfsOrder.elemList[idx]; + bb = (BasicBlock*)oatGrowableListGetElement(blockList, dfsIndex); + if (bb->blockType == kDalvikByteCode) { + break; + } + } + if (bb == NULL) { + return; + } + DCHECK_EQ(bb->startOffset, 0); + DCHECK(bb->firstMIRInsn != 0); + + /* Get the first instruction */ + MIR* mir = bb->firstMIRInsn; + + /* Free temp registers and reset redundant store tracking */ + oatResetRegPool(cUnit); + oatResetDefTracking(cUnit); + oatClobberAllRegs(cUnit); + + genSpecialCase(cUnit, bb, mir, specialCase); +} + void oatMethodMIR2LIR(CompilationUnit* cUnit) { /* Used to hold the labels of each block */ -- cgit v1.2.3-59-g8ed1b