Lines Matching full:cunit
26 static void dumpConstants(CompilationUnit *cUnit)
29 ALOGE("LOOP starting offset: %x", cUnit->entryBlock->startOffset);
30 for (i = 0; i < cUnit->numSSARegs; i++) {
31 if (dvmIsBitSet(cUnit->isConstantV, i)) {
32 int subNReg = dvmConvertSSARegToDalvik(cUnit, i);
35 cUnit->constantValues[i]);
40 static void dumpIVList(CompilationUnit *cUnit)
43 GrowableList *ivList = cUnit->loopAnalysis->ivList;
48 int iv = dvmConvertSSARegToDalvik(cUnit, ivInfo->ssaReg);
57 int biv = dvmConvertSSARegToDalvik(cUnit, ivInfo->basicSSAReg);
70 static void dumpHoistedChecks(CompilationUnit *cUnit)
72 LoopAnalysis *loopAnalysis = cUnit->loopAnalysis;
80 dvmConvertSSARegToDalvik(cUnit, arrayAccessInfo->arrayReg));
82 dvmConvertSSARegToDalvik(cUnit, arrayAccessInfo->ivReg));
95 static BasicBlock *findPredecessorBlock(const CompilationUnit *cUnit,
104 return (BasicBlock *) dvmGrowableListGetElement(&cUnit->blockList,
108 dvmIsBitSet(bb->predecessors, cUnit->entryBlock->id)) {
111 if (predIdx == cUnit->entryBlock->id) continue;
112 return (BasicBlock *) dvmGrowableListGetElement(&cUnit->blockList,
170 static bool isSimpleCountedLoop(CompilationUnit *cUnit)
173 BasicBlock *loopBackBlock = cUnit->entryBlock->fallThrough;
174 LoopAnalysis *loopAnalysis = cUnit->loopAnalysis;
194 loopBackBlock = findPredecessorBlock(cUnit, loopBackBlock);
227 endDalvikReg = dvmConvertSSARegToDalvik(cUnit, endSSAReg);
236 !dvmIsBitSet(cUnit->isConstantV, endSSAReg)) {
299 static void updateRangeCheckInfo(CompilationUnit *cUnit, int arrayReg,
303 LoopAnalysis *loopAnalysis = cUnit->loopAnalysis;
343 static bool doLoopBodyCodeMotion(CompilationUnit *cUnit)
345 BasicBlock *loopBody = cUnit->entryBlock->fallThrough;
395 dvmCompilerAbort(cUnit);
400 dvmConvertSSARegToDalvik(cUnit, mir->ssaRep->uses[refIdx]);
416 if (dvmIsBitSet(cUnit->loopAnalysis->isIndVarV,
420 updateRangeCheckInfo(cUnit, mir->ssaRep->uses[refIdx],
429 static void genHoistedChecks(CompilationUnit *cUnit)
432 BasicBlock *entry = cUnit->entryBlock;
433 LoopAnalysis *loopAnalysis = cUnit->loopAnalysis;
444 dvmConvertSSARegToDalvik(cUnit, arrayAccessInfo->arrayReg));
446 dvmConvertSSARegToDalvik(cUnit, arrayAccessInfo->ivReg));
508 dvmCompilerAbort(cUnit);
521 static bool clearPredecessorVector(struct CompilationUnit *cUnit,
528 bool dvmCompilerFilterLoopBlocks(CompilationUnit *cUnit)
530 BasicBlock *firstBB = cUnit->entryBlock->fallThrough;
538 GrowableList *blockList = &cUnit->blockList;
541 dvmClearAllBits(cUnit->tempBlockV);
543 dvmCompilerSetBit(cUnit->tempBlockV, cUnit->entryBlock->id);
544 dvmCompilerSetBit(cUnit->tempBlockV, firstBB->id);
558 dvmIsBitSet(cUnit->tempBlockV, bodyBB->fallThrough->id)) {
566 dvmIsBitSet(cUnit->tempBlockV, bodyBB->taken->id)) {
575 dvmIsBitSet(cUnit->tempBlockV, bodyBB->fallThrough->id)) {
579 dvmIsBitSet(cUnit->tempBlockV, bodyBB->taken->id)) {
586 dvmCompilerSetBit(cUnit->tempBlockV, bodyBB->id);
597 dvmCompilerSetBit(cUnit->tempBlockV, bodyBB->id);
619 if (!dvmIsBitSet(cUnit->tempBlockV, bb->id)) {
627 dvmCompilerDataFlowAnalysisDispatcher(cUnit, clearPredecessorVector,
634 if (dvmIsBitSet(cUnit->tempBlockV, bb->id)) {
640 if (bb->taken == cUnit->exitBlock) {
654 if (bb->fallThrough == cUnit->exitBlock) {
674 bool dvmCompilerLoopOpt(CompilationUnit *cUnit)
678 cUnit->loopAnalysis = loopAnalysis;
681 cUnit->isConstantV = dvmCompilerAllocBitVector(cUnit->numSSARegs, false);
682 cUnit->constantValues =
683 (int *)dvmCompilerNew(sizeof(int) * cUnit->numSSARegs,
685 dvmCompilerDataFlowAnalysisDispatcher(cUnit,
689 DEBUG_LOOP(dumpConstants(cUnit);)
695 loopAnalysis->isIndVarV = dvmCompilerAllocBitVector(cUnit->numSSARegs, false);
696 dvmCompilerDataFlowAnalysisDispatcher(cUnit,
700 DEBUG_LOOP(dumpIVList(cUnit);)
703 if (!isSimpleCountedLoop(cUnit))
709 loopAnalysis->bodyIsClean = doLoopBodyCodeMotion(cUnit);
710 DEBUG_LOOP(dumpHoistedChecks(cUnit);)
716 genHoistedChecks(cUnit);
723 void dvmCompilerInsertBackwardChaining(CompilationUnit *cUnit)
743 BasicBlock *firstBB = cUnit->entryBlock->fallThrough;
744 BasicBlock *backBranchBB = findPredecessorBlock(cUnit, firstBB);
746 backBranchBB->taken = cUnit->backChainBlock;
749 backBranchBB->fallThrough = cUnit->backChainBlock;
751 cUnit->backChainBlock->startOffset = firstBB->startOffset;