summaryrefslogtreecommitdiff
path: root/src/compiler/codegen/MethodCodegenDriver.cc
diff options
context:
space:
mode:
author buzbee <buzbee@google.com> 2012-03-20 10:38:17 -0700
committer buzbee <buzbee@google.com> 2012-03-20 14:36:11 -0700
commit16da88c70c4bdbd97b8482be8b42103a52f22d59 (patch)
tree905c1bfc68c7a301706a5cd2b7a3d7d9084a06b3 /src/compiler/codegen/MethodCodegenDriver.cc
parentb41b33b5e5f08083e35f84818b4f44d26feb4a8b (diff)
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
Diffstat (limited to 'src/compiler/codegen/MethodCodegenDriver.cc')
-rw-r--r--src/compiler/codegen/MethodCodegenDriver.cc44
1 files changed, 44 insertions, 0 deletions
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 */