Home | History | Annotate | Download | only in compiler

Lines Matching full:cunit

23 static void recordDFSPreOrder(CompilationUnit *cUnit, BasicBlock *block)
30 dvmInsertGrowableList(&cUnit->dfsOrder, block->id);
32 if (block->fallThrough) recordDFSPreOrder(cUnit, block->fallThrough);
33 if (block->taken) recordDFSPreOrder(cUnit, block->taken);
43 recordDFSPreOrder(cUnit, succBB);
50 static void computeDFSOrder(CompilationUnit *cUnit)
53 if (cUnit->dfsOrder.elemList == NULL) {
54 dvmInitGrowableList(&cUnit->dfsOrder, cUnit->numBlocks);
57 cUnit->dfsOrder.numUsed = 0;
60 dvmCompilerDataFlowAnalysisDispatcher(cUnit, dvmCompilerClearVisitedFlag,
64 recordDFSPreOrder(cUnit, cUnit->entryBlock);
65 cUnit->numReachableBlocks = cUnit->dfsOrder.numUsed;
72 static bool fillDefBlockMatrix(CompilationUnit *cUnit, BasicBlock *bb)
83 dvmCompilerSetBit(cUnit->defBlockMatrix[idx], bb->id);
88 static void computeDefBlockMatrix(CompilationUnit *cUnit)
90 int numRegisters = cUnit->numDalvikRegisters;
92 cUnit->defBlockMatrix = (BitVector **)
98 cUnit->defBlockMatrix[i] = dvmCompilerAllocBitVector(cUnit->numBlocks,
101 dvmCompilerDataFlowAnalysisDispatcher(cUnit, dvmCompilerFindLocalLiveIn,
104 dvmCompilerDataFlowAnalysisDispatcher(cUnit, fillDefBlockMatrix,
108 if (cUnit->jitMode == kJitMethod) {
113 int inReg = cUnit->method->registersSize - cUnit->method->insSize;
114 for (; inReg < cUnit->method->registersSize; inReg++) {
115 dvmCompilerSetBit(cUnit->defBlockMatrix[inReg],
116 cUnit->entryBlock->id);
122 static void computeDomPostOrderTraversal(CompilationUnit *cUnit, BasicBlock *bb)
126 GrowableList *blockList = &cUnit->blockList;
134 computeDomPostOrderTraversal(cUnit, dominatedBB);
138 dvmInsertGrowableList(&cUnit->domPostOrderTraversal, bb->id);
142 cUnit->hasLoop = true;
161 static bool computeDominanceFrontier(CompilationUnit *cUnit, BasicBlock *bb)
163 GrowableList *blockList = &cUnit->blockList;
208 static bool initializeDominationInfo(CompilationUnit *cUnit, BasicBlock *bb)
210 int numTotalBlocks = cUnit->blockList.numUsed;
231 static bool computeBlockDominators(CompilationUnit *cUnit, BasicBlock *bb)
233 GrowableList *blockList = &cUnit->blockList;
235 BitVector *tempBlockV = cUnit->tempBlockV;
242 if (bb == cUnit->entryBlock) return false;
265 static bool computeImmediateDominator(CompilationUnit *cUnit, BasicBlock *bb)
267 GrowableList *blockList = &cUnit->blockList;
268 BitVector *tempBlockV = cUnit->tempBlockV;
272 if (bb == cUnit->entryBlock) return false;
308 static void computeDominators(CompilationUnit *cUnit)
310 int numReachableBlocks = cUnit->numReachableBlocks;
311 int numTotalBlocks = cUnit->blockList.numUsed;
314 dvmCompilerDataFlowAnalysisDispatcher(cUnit, initializeDominationInfo,
319 dvmClearAllBits(cUnit->entryBlock->dominators);
320 dvmSetBit(cUnit->entryBlock->dominators, cUnit->entryBlock->id);
322 if (cUnit->tempBlockV == NULL) {
323 cUnit->tempBlockV = dvmCompilerAllocBitVector(numTotalBlocks,
326 dvmClearAllBits(cUnit->tempBlockV);
328 dvmCompilerDataFlowAnalysisDispatcher(cUnit, computeBlockDominators,
332 cUnit->entryBlock->iDom = NULL;
333 dvmCompilerDataFlowAnalysisDispatcher(cUnit, computeImmediateDominator,
341 if (cUnit->domPostOrderTraversal.elemList == NULL) {
342 dvmInitGrowableList(&cUnit->domPostOrderTraversal, numReachableBlocks);
344 cUnit->domPostOrderTraversal.numUsed = 0;
347 computeDomPostOrderTraversal(cUnit, cUnit->entryBlock);
348 assert(cUnit->domPostOrderTraversal.numUsed ==
349 (unsigned) cUnit->numReachableBlocks);
352 dvmCompilerDataFlowAnalysisDispatcher(cUnit, computeDominanceFrontier,
384 static bool computeBlockLiveIns(CompilationUnit *cUnit, BasicBlock *bb)
386 BitVector *tempDalvikRegisterV = cUnit->tempDalvikRegisterV;
421 static void insertPhiNodes(CompilationUnit *cUnit)
424 const GrowableList *blockList = &cUnit->blockList;
426 dvmCompilerAllocBitVector(cUnit->numBlocks, false);
428 dvmCompilerAllocBitVector(cUnit->numBlocks, false);
430 dvmCompilerAllocBitVector(cUnit->numBlocks, false);
432 cUnit->tempDalvikRegisterV =
433 dvmCompilerAllocBitVector(cUnit->numDalvikRegisters, false);
435 dvmCompilerDataFlowAnalysisDispatcher(cUnit, computeBlockLiveIns,
440 for (dalvikReg = 0; dalvikReg < cUnit->numDalvikRegisters; dalvikReg++) {
444 dvmCopyBitVector(inputBlocks, cUnit->defBlockMatrix[dalvikReg]);
472 cUnit->defBlockMatrix[dalvikReg]);
501 static bool insertPhiNodeOperands(CompilationUnit *cUnit, BasicBlock *bb)
503 BitVector *ssaRegV = cUnit->tempSSARegisterV;
505 GrowableList *blockList = &cUnit->blockList;
514 (int) dvmGrowableListGetElement(cUnit->ssaToDalvikMap, ssaReg);
557 void dvmCompilerMethodSSATransformation(CompilationUnit *cUnit)
560 computeDFSOrder(cUnit);
563 computeDominators(cUnit);
566 dvmInitializeSSAConversion(cUnit);
569 computeDefBlockMatrix(cUnit);
572 insertPhiNodes(cUnit);
575 dvmCompilerDataFlowAnalysisDispatcher(cUnit, dvmCompilerDoSSAConversion,
583 cUnit->tempSSARegisterV = dvmCompilerAllocBitVector(cUnit->numSSARegs,
587 dvmCompilerDataFlowAnalysisDispatcher(cUnit, insertPhiNodeOperands,
593 bool dvmCompilerBuildLoop(CompilationUnit *cUnit)
596 computeDFSOrder(cUnit);
599 computeDominators(cUnit);
602 if (dvmCompilerFilterLoopBlocks(cUnit) == false)
606 computeDFSOrder(cUnit);
609 computeDominators(cUnit);
612 dvmInitializeSSAConversion(cUnit);
615 computeDefBlockMatrix(cUnit);
618 insertPhiNodes(cUnit);
621 dvmCompilerDataFlowAnalysisDispatcher(cUnit, dvmCompilerDoSSAConversion,
629 cUnit->tempSSARegisterV = dvmCompilerAllocBitVector(cUnit->numSSARegs,
633 dvmCompilerDataFlowAnalysisDispatcher(cUnit, insertPhiNodeOperands,
638 dvmDumpCFG(cUnit, "/sdcard/cfg/");