Lines Matching defs:bb

241 int collectInfoOfBasicBlock(Method* method, BasicBlock_O1* bb);
242 void dumpVirtualInfoOfBasicBlock(BasicBlock_O1* bb);
246 int codeGenBasicBlock(const Method* method, BasicBlock_O1* bb);
249 int mergeEntry2(BasicBlock_O1* bb);
254 void insertFromVirtualInfo(BasicBlock_O1* bb, int k); //update compileTable
259 bool isFirstOfHandler(BasicBlock_O1* bb);
279 int fakeUsageAtEndOfBB(BasicBlock_O1* bb);
404 void initializeRegStateOfBB(BasicBlock_O1* bb) {
410 if(bb->bb_index > 0) { //non-entry block
411 if(isFirstOfHandler(bb)) {
515 BasicBlock_O1* createBasicBlockO1(BasicBlock* bb) {
517 bb1->jitBasicBlock = bb;
523 void preprocessingBB(BasicBlock* bb) {
524 currentBB = createBasicBlockO1(bb);
622 int codeGenBasicBlockJit(const Method* method, BasicBlock* bb) {
623 /* search method_bbs_sorted to find the O1 basic block corresponding to bb */
626 if(method_bbs_sorted[k]->jitBasicBlock == bb) {
635 bb->id, bb->blockType);
638 void endOfBasicBlock(BasicBlock* bb) {
648 The usage information of virtual registers is stoerd in bb->infoBasicBlock
652 int collectInfoOfBasicBlock(Method* method, BasicBlock_O1* bb) {
653 bb->num_regs = 0;
654 bb->num_defs = 0;
655 bb->defUseTable = NULL;
656 bb->defUseTail = NULL;
659 bb->endsWithReturn = false;
660 bb->hasAccessToGlue = false;
666 for(mir = bb->jitBasicBlock->firstMIRInsn; mir; mir = mir->next) {
680 /* update bb->hasAccessToGlue */
690 bb->hasAccessToGlue = true;
691 /* update bb->endsWithReturn */
694 bb->endsWithReturn = true;
705 mergeEntry2(bb); //update defUseTable of the basic block
708 //dumpVirtualInfoOfBasicBlock(bb);
711 bb->pc_end = seqNum;
714 for(kk = 0; kk < bb->num_regs; kk++) {
716 ALOGI("sort virtual reg %d type %d -------", bb->infoBasicBlock[kk].regNum,
717 bb->infoBasicBlock[kk].physicalType);
719 sortAllocConstraint(bb->infoBasicBlock[kk].allocConstraints,
720 bb->infoBasicBlock[kk].allocConstraintsSorted, true);
723 ALOGI("sort constraints for BB %d --------", bb->bb_index);
725 sortAllocConstraint(bb->allocConstraints, bb->allocConstraintsSorted, false);
740 int codeGenBasicBlock(const Method* method, BasicBlock_O1* bb) {
744 /* update compileTable with entries in bb->infoBasicBlock */
746 for(k = 0; k < bb->num_regs; k++) {
747 insertFromVirtualInfo(bb, k);
761 ALOGI("At start of basic block %d (num of VRs %d) -------", bb->bb_index, bb->num_regs);
764 initializeRegStateOfBB(bb);
769 ALOGI("At start of basic block %d (num of VRs %d) -------", bb->bb_index, bb->num_regs);
775 for(mir = bb->jitBasicBlock->firstMIRInsn; mir; mir = mir->next) {
806 ALOGI("before one bytecode %d (num of VRs %d) -------", bb->bb_index, bb->num_regs);
810 bool isConst = getConstInfo(bb); //will reset isConst if a VR is updated by the bytecode
870 updateConstInfo(bb);
898 ALOGI("after one bytecode BB %d (num of VRs %d)", bb->bb_index, bb->num_regs);
959 int mergeEntry2(BasicBlock_O1* bb) {
963 int jjend = bb->num_regs;
972 int regA = bb->infoBasicBlock[jj].regNum;
973 LowOpndRegType typeA = bb->infoBasicBlock[jj].physicalType;
978 bb->infoBasicBlock[jj].accessType = mergeAccess2(bb->infoBasicBlock[jj].accessType, currentInfo.accessType,
980 bb->infoBasicBlock[jj].refCount += currentInfo.refCount;
982 currentInfo.num_reaching_defs = bb->infoBasicBlock[jj].num_reaching_defs;
984 currentInfo.reachingDefs[k] = bb->infoBasicBlock[jj].reachingDefs[k];
992 bb->infoBasicBlock[jj].allocConstraints[k].count += currentInfo.allocConstraints[k].count;
997 tmpType = updateAccess2(tmpType, updateAccess1(bb->infoBasicBlock[jj].accessType, isAPartiallyOverlapB));
998 bb->infoBasicBlock[jj].accessType = mergeAccess2(bb->infoBasicBlock[jj].accessType, currentInfo.accessType,
1001 ALOGI("update accessType in case 2: VR %d %d accessType %d", regA, typeA, bb->infoBasicBlock[jj].accessType);
1020 bb->infoBasicBlock[bb->num_regs].refCount = currentInfo.refCount;
1021 bb->infoBasicBlock[bb->num_regs].physicalType = typeB;
1023 bb->infoBasicBlock[bb->num_regs].accessType = updateAccess3(tmpType, currentInfo.accessType);
1025 bb->infoBasicBlock[bb->num_regs].accessType = currentInfo.accessType;
1027 ALOGI("update accessType in case 3: VR %d %d accessType %d", regB, typeB, bb->infoBasicBlock[bb->num_regs].accessType);
1029 bb->infoBasicBlock[bb->num_regs].regNum = regB;
1031 bb->infoBasicBlock[bb->num_regs].allocConstraints[k] = currentInfo.allocConstraints[k];
1038 //copy from currentInfo.reachingDefs to bb->infoBasicBlock[bb->num_regs]
1039 bb->infoBasicBlock[bb->num_regs].num_reaching_defs = currentInfo.num_reaching_defs;
1041 bb->infoBasicBlock[bb->num_regs].reachingDefs[k] = currentInfo.reachingDefs[k];
1044 for(k = 0; k < bb->infoBasicBlock[bb->num_regs].num_reaching_defs; k++)
1049 bb->num_regs++;
1050 if(bb->num_regs >= MAX_REG_PER_BASICBLOCK) {
1439 int fakeUsageAtEndOfBB(BasicBlock_O1* bb) {
1445 for(jj = 0; jj < bb->num_regs; jj++) {
1446 int regA = bb->infoBasicBlock[jj].regNum;
1447 LowOpndRegType typeA = bb->infoBasicBlock[jj].physicalType;
1451 currentInfo.num_reaching_defs = bb->infoBasicBlock[jj].num_reaching_defs;
1453 currentInfo.reachingDefs[k] = bb->infoBasicBlock[jj].reachingDefs[k];
1458 /* update reaching defs of variable B by checking reaching defs of bb->infoBasicBlock[jj] */
2270 int searchVirtualInfoOfBB(LowOpndRegType type, int regNum, BasicBlock_O1* bb);
3145 BasicBlock_O1* bb = currentBB;
3152 for(mir = bb->jitBasicBlock->firstMIRInsn; mir; mir = mir->next) {
3508 bool isUsedInBB(int regNum, int type, BasicBlock_O1* bb) {
3510 for(k = 0; k < bb->num_regs; k++) {
3511 if(bb->infoBasicBlock[k].physicalType == (type&MASK_FOR_TYPE) && bb->infoBasicBlock[k].regNum == regNum)
3519 int searchVirtualInfoOfBB(LowOpndRegType type, int regNum, BasicBlock_O1* bb) {
3521 for(k = 0; k < bb->num_regs; k++) {
3522 if(bb->infoBasicBlock[k].physicalType == type && bb->infoBasicBlock[k].regNum == regNum)
3577 bool hasExposedUsage2(BasicBlock_O1* bb, int index) {
3578 RegAccessType atype = bb->infoBasicBlock[index].accessType;
4507 bool hasExposedUsage(LowOpndRegType type, int regNum, BasicBlock_O1* bb) {
4508 int index = searchVirtualInfoOfBB(type, regNum, bb);
4509 if(index >= 0 && hasExposedUsage2(bb, index)) {
4517 bool hasOtherExposedUsage(OpndSize size, int regNum, BasicBlock_O1* bb) {
4525 BasicBlock_O1* bb = currentBB;
4555 hasExp = hasOtherExposedUsage(OpndSize_32, constVRTable[k].regNum, bb);
4640 /** update compileTable with bb->infoBasicBlock[k]
4642 void insertFromVirtualInfo(BasicBlock_O1* bb, int k) {
4643 int index = searchCompileTable(LowOpndRegType_virtual | bb->infoBasicBlock[k].physicalType, bb->infoBasicBlock[k].regNum);
4647 compileTable[num_compile_entries].physicalType = (LowOpndRegType_virtual | bb->infoBasicBlock[k].physicalType);
4648 compileTable[num_compile_entries].regNum = bb->infoBasicBlock[k].regNum;
4650 compileTable[num_compile_entries].bb = bb;
4653 compileTable[num_compile_entries].gType = bb->infoBasicBlock[k].gType;
4661 compileTable[index].refCount = bb->infoBasicBlock[k].refCount;
4662 compileTable[index].accessType = bb->infoBasicBlock[k].accessType;
4664 compileTable[index].physicalReg_prev = bb->infoBasicBlock[k].physicalReg_GG;
4695 compileTable[num_compile_entries].bb = NULL;
4710 void dumpVirtualInfoOfBasicBlock(BasicBlock_O1* bb) {
4712 ALOGI("Virtual Info for BB%d --------", bb->bb_index);
4713 for(jj = 0; jj < bb->num_regs; jj++) {
4715 bb->infoBasicBlock[jj].regNum, bb->infoBasicBlock[jj].physicalType,
4716 bb->infoBasicBlock[jj].accessType, bb->infoBasicBlock[jj].refCount);
4718 for(k = 0; k < bb->infoBasicBlock[jj].num_reaching_defs; k++)
4719 ALOGI("[%x %d %d %d] ", bb->infoBasicBlock[jj].reachingDefs[k].offsetPC,
4720 bb->infoBasicBlock[jj].reachingDefs[k].regNum,
4721 bb->infoBasicBlock[jj].reachingDefs[k].physicalType,
4722 bb->infoBasicBlock[jj].reachingDefs[k].accessType);
4742 bool isFirstOfHandler(BasicBlock_O1* bb) {
4745 if(bb->pc_start == exceptionHandlers[i]) return true;
4754 BasicBlock_O1* bb = (BasicBlock_O1*)malloc(sizeof(BasicBlock_O1));
4755 if(bb == NULL) {
4759 bb->pc_start = src_pc;
4760 bb->bb_index = num_bbs_for_method;
4761 if(bb_entry == NULL) bb_entry = bb;
4772 method_bbs_sorted[num_bbs_for_method] = bb;
4777 method_bbs_sorted[index] = bb;
4784 return bb;