Lines Matching full:cunit
32 static void storePair(CompilationUnit *cUnit, int base, int lowReg,
34 static void loadPair(CompilationUnit *cUnit, int base, int lowReg, int highReg);
35 static MipsLIR *loadWordDisp(CompilationUnit *cUnit, int rBase, int displacement,
37 static MipsLIR *storeWordDisp(CompilationUnit *cUnit, int rBase,
39 static MipsLIR *genRegRegCheck(CompilationUnit *cUnit,
43 static MipsLIR *loadConstant(CompilationUnit *cUnit, int rDest, int value);
46 static MipsLIR *fpRegCopy(CompilationUnit *cUnit, int rDest, int rSrc)
88 static MipsLIR *loadConstantNoClobber(CompilationUnit *cUnit, int rDest,
98 rDest = dvmCompilerAllocTemp(cUnit);
104 res = newLIR2(cUnit, kMipsMove, rDest, r_ZERO);
106 res = newLIR3(cUnit, kMipsOri, rDest, r_ZERO, value);
108 res = newLIR3(cUnit, kMipsAddiu, rDest, r_ZERO, value);
110 res = newLIR2(cUnit, kMipsLui, rDest, value>>16);
112 newLIR3(cUnit, kMipsOri, rDest, rDest, value);
117 newLIR2(cUnit, kMipsMtc1, rDest, rDestSave);
118 dvmCompilerFreeTemp(cUnit, rDest);
129 static MipsLIR *loadConstant(CompilationUnit *cUnit, int rDest, int value)
131 if (dvmCompilerIsTemp(cUnit, rDest)) {
132 dvmCompilerClobber(cUnit, rDest);
133 dvmCompilerMarkInUse(cUnit, rDest);
135 return loadConstantNoClobber(cUnit, rDest, value);
142 static MipsLIR *loadClassPointer(CompilationUnit *cUnit, int rDest, int value)
145 if (dvmCompilerIsTemp(cUnit, rDest)) {
146 dvmCompilerClobber(cUnit, rDest);
147 dvmCompilerMarkInUse(cUnit, rDest);
149 res = newLIR2(cUnit, kMipsLui, rDest, value>>16);
151 newLIR3(cUnit, kMipsOri, rDest, rDest, value);
155 static MipsLIR *opNone(CompilationUnit *cUnit, OpKind op)
165 dvmCompilerAbort(cUnit);
167 res = newLIR0(cUnit, opcode);
171 static MipsLIR *opCompareBranch(CompilationUnit *cUnit, MipsOpCode opc, int rs, int rt)
176 res = newLIR1(cUnit, opc, rs);
179 res = newLIR2(cUnit, opc, rs, rt);
184 static MipsLIR *loadMultiple(CompilationUnit *cUnit, int rBase, int rMask);
186 static MipsLIR *opReg(CompilationUnit *cUnit, OpKind op, int rDestSrc)
196 return newLIR2(cUnit, opcode, r_RA, rDestSrc);
199 static MipsLIR *opRegRegImm(CompilationUnit *cUnit, OpKind op, int rDest,
201 static MipsLIR *opRegImm(CompilationUnit *cUnit, OpKind op, int rDestSrc1,
211 return opRegRegImm(cUnit, op, rDestSrc1, rDestSrc1, value);
214 return opRegRegImm(cUnit, op, rDestSrc1, rDestSrc1, value);
218 dvmCompilerAbort(cUnit);
222 res = newLIR2(cUnit, opcode, rDestSrc1, absValue);
224 int rScratch = dvmCompilerAllocTemp(cUnit);
225 res = loadConstant(cUnit, rScratch, value);
227 newLIR2(cUnit, opcode, rDestSrc1, rScratch);
229 newLIR3(cUnit, opcode, rDestSrc1, rDestSrc1, rScratch);
234 static MipsLIR *opRegRegReg(CompilationUnit *cUnit, OpKind op, int rDest,
268 dvmCompilerAbort(cUnit);
271 return newLIR3(cUnit, opcode, rDest, rSrc1, rSrc2);
274 static MipsLIR *opRegRegImm(CompilationUnit *cUnit, OpKind op, int rDest,
346 dvmCompilerAbort(cUnit);
351 res = newLIR3(cUnit, opcode, rDest, rSrc1, value);
354 res = loadConstant(cUnit, rDest, value);
355 newLIR3(cUnit, opcode, rDest, rSrc1, rDest);
357 int rScratch = dvmCompilerAllocTemp(cUnit);
358 res = loadConstant(cUnit, rScratch, value);
359 newLIR3(cUnit, opcode, rDest, rSrc1, rScratch);
365 static MipsLIR *opRegReg(CompilationUnit *cUnit, OpKind op, int rDestSrc1,
375 return newLIR3(cUnit, kMipsNor, rDestSrc1, rSrc2, r_ZERO);
377 return newLIR3(cUnit, kMipsSubu, rDestSrc1, r_ZERO, rSrc2);
384 return opRegRegReg(cUnit, op, rDestSrc1, rDestSrc1, rSrc2);
387 res = newLIR2(cUnit, kMipsSeb, rDestSrc1, rSrc2);
389 res = opRegRegImm(cUnit, kOpLsl, rDestSrc1, rSrc2, 24);
390 opRegRegImm(cUnit, kOpAsr, rDestSrc1, rDestSrc1, 24);
395 res = newLIR2(cUnit, kMipsSeh, rDestSrc1, rSrc2);
397 res = opRegRegImm(cUnit, kOpLsl, rDestSrc1, rSrc2, 16);
398 opRegRegImm(cUnit, kOpAsr, rDestSrc1, rDestSrc1, 16);
402 return newLIR3(cUnit, kMipsAndi, rDestSrc1, rSrc2, 0xFFFF);
405 dvmCompilerAbort(cUnit);
408 return newLIR2(cUnit, opcode, rDestSrc1, rSrc2);
411 static MipsLIR *loadConstantValueWide(CompilationUnit *cUnit, int rDestLo,
415 res = loadConstantNoClobber(cUnit, rDestLo, valLo);
416 loadConstantNoClobber(cUnit, rDestHi, valHi);
421 static MipsLIR *loadBaseIndexed(CompilationUnit *cUnit, int rBase,
427 int tReg = dvmCompilerAllocTemp(cUnit);
441 first = newLIR3(cUnit, kMipsAddu, tReg , rBase, rIndex);
443 first = opRegRegImm(cUnit, kOpLsl, tReg, rIndex, scale);
444 newLIR3(cUnit, kMipsAddu, tReg , rBase, tReg);
470 dvmCompilerAbort(cUnit);
473 res = newLIR3(cUnit, opcode, rDest, 0, tReg);
475 if (cUnit->heapMemOp)
478 dvmCompilerFreeTemp(cUnit, tReg);
483 static MipsLIR *storeBaseIndexed(CompilationUnit *cUnit, int rBase,
490 int tReg = dvmCompilerAllocTemp(cUnit);
504 first = newLIR3(cUnit, kMipsAddu, tReg , rBase, rIndex);
506 first = opRegRegImm(cUnit, kOpLsl, tReg, rIndex, scale);
507 newLIR3(cUnit, kMipsAddu, tReg , rBase, tReg);
529 dvmCompilerAbort(cUnit);
531 res = newLIR3(cUnit, opcode, rSrc, 0, tReg);
533 if (cUnit->heapMemOp)
536 dvmCompilerFreeTemp(cUnit, rNewIndex);
540 static MipsLIR *loadMultiple(CompilationUnit *cUnit, int rBase, int rMask)
545 genBarrier(cUnit);
549 newLIR3(cUnit, kMipsLw, i+r_A0, loadCnt*4, rBase);
555 newLIR3(cUnit, kMipsAddiu, rBase, rBase, loadCnt*4);
559 cUnit->heapMemOp)
562 genBarrier(cUnit);
566 static MipsLIR *storeMultiple(CompilationUnit *cUnit, int rBase, int rMask)
571 genBarrier(cUnit);
575 newLIR3(cUnit, kMipsSw, i+r_A0, storeCnt*4, rBase);
581 newLIR3(cUnit, kMipsAddiu, rBase, rBase, storeCnt*4);
585 if (cUnit->heapMemOp)
588 genBarrier(cUnit);
592 static MipsLIR *loadBaseDispBody(CompilationUnit *cUnit, MIR *mir, int rBase,
658 dvmCompilerAbort(cUnit);
663 load = res = newLIR3(cUnit, opcode, rDest, displacement, rBase);
665 load = res = newLIR3(cUnit, opcode, rDest, displacement + LOWORD_OFFSET, rBase);
666 load2 = newLIR3(cUnit, opcode, rDestHi, displacement + HIWORD_OFFSET, rBase);
670 int rTmp = dvmCompilerAllocFreeTemp(cUnit);
671 res = opRegRegImm(cUnit, kOpAdd, rTmp, rBase, displacement);
672 load = newLIR3(cUnit, opcode, rDest, LOWORD_OFFSET, rTmp);
673 load2 = newLIR3(cUnit, opcode, rDestHi, HIWORD_OFFSET, rTmp);
674 dvmCompilerFreeTemp(cUnit, rTmp);
676 int rTmp = (rBase == rDest) ? dvmCompilerAllocFreeTemp(cUnit)
678 res = loadConstant(cUnit, rTmp, displacement);
679 load = newLIR3(cUnit, opcode, rDest, rBase, rTmp);
681 dvmCompilerFreeTemp(cUnit, rTmp);
694 if (load != NULL && cUnit->heapMemOp)
696 if (load2 != NULL && cUnit->heapMemOp)
702 static MipsLIR *loadBaseDisp(CompilationUnit *cUnit, MIR *mir, int rBase,
706 return loadBaseDispBody(cUnit, mir, rBase, displacement, rDest, -1,
710 static MipsLIR *loadBaseDispWide(CompilationUnit *cUnit, MIR *mir, int rBase,
714 return loadBaseDispBody(cUnit, mir, rBase, displacement, rDestLo, rDestHi,
718 static MipsLIR *storeBaseDispBody(CompilationUnit *cUnit, int rBase,
771 dvmCompilerAbort(cUnit);
776 store = res = newLIR3(cUnit, opcode, rSrc, displacement, rBase);
778 store = res = newLIR3(cUnit, opcode, rSrc, displacement + LOWORD_OFFSET, rBase);
779 store2 = newLIR3(cUnit, opcode, rSrcHi, displacement + HIWORD_OFFSET, rBase);
782 int rScratch = dvmCompilerAllocTemp(cUnit);
783 res = opRegRegImm(cUnit, kOpAdd, rScratch, rBase, displacement);
785 store = newLIR3(cUnit, opcode, rSrc, 0, rScratch);
787 store = newLIR3(cUnit, opcode, rSrc, LOWORD_OFFSET, rScratch);
788 store2 = newLIR3(cUnit, opcode, rSrcHi, HIWORD_OFFSET, rScratch);
790 dvmCompilerFreeTemp(cUnit, rScratch);
803 if (store != NULL && cUnit->heapMemOp)
805 if (store2 != NULL && cUnit->heapMemOp)
811 static MipsLIR *storeBaseDisp(CompilationUnit *cUnit, int rBase,
814 return storeBaseDispBody(cUnit, rBase, displacement, rSrc, -1, size);
817 static MipsLIR *storeBaseDispWide(CompilationUnit *cUnit, int rBase,
820 return storeBaseDispBody(cUnit, rBase, displacement, rSrcLo, rSrcHi, kLong);
823 static void storePair(CompilationUnit *cUnit, int base, int lowReg, int highReg)
825 storeWordDisp(cUnit, base, LOWORD_OFFSET, lowReg);
826 storeWordDisp(cUnit, base, HIWORD_OFFSET, highReg);
829 static void loadPair(CompilationUnit *cUnit, int base, int lowReg, int highReg)
831 loadWordDisp(cUnit, base, LOWORD_OFFSET , lowReg);
832 loadWordDisp(cUnit, base, HIWORD_OFFSET , highReg);
835 static MipsLIR* genRegCopyNoInsert(CompilationUnit *cUnit, int rDest, int rSrc)
841 return fpRegCopy(cUnit, rDest, rSrc);
856 static MipsLIR* genRegCopy(CompilationUnit *cUnit, int rDest, int rSrc)
858 MipsLIR *res = genRegCopyNoInsert(cUnit, rDest, rSrc);
859 dvmCompilerAppendLIR(cUnit, (LIR*)res);
863 static void genRegCopyWide(CompilationUnit *cUnit, int destLo, int destHi,
873 genRegCopy(cUnit, S2D(destLo, destHi), S2D(srcLo, srcHi));
876 newLIR2(cUnit, kMipsMtc1, srcLo, destLo);
877 newLIR2(cUnit, kMipsMtc1, srcHi, destHi);
881 newLIR2(cUnit, kMipsMfc1, destLo, srcLo);
882 newLIR2(cUnit, kMipsMfc1, destHi, srcHi);
886 genRegCopy(cUnit, destHi, srcHi);
887 genRegCopy(cUnit, destLo, srcLo);
889 genRegCopy(cUnit, destLo, srcLo);
890 genRegCopy(cUnit, destHi, srcHi);
897 genRegCopy(cUnit, destHi, srcHi);
898 genRegCopy(cUnit, destLo, srcLo);
900 genRegCopy(cUnit, destLo, srcLo);
901 genRegCopy(cUnit, destHi, srcHi);
906 static inline MipsLIR *genRegImmCheck(CompilationUnit *cUnit,
929 dvmCompilerAbort(cUnit);
931 branch = opCompareBranch(cUnit, opc, reg, -1);
934 int tReg = dvmCompilerAllocTemp(cUnit);
935 newLIR3(cUnit, kMipsSlti, tReg, reg, checkValue);
936 branch = opCompareBranch(cUnit, kMipsBne, tReg, r_ZERO);
937 dvmCompilerFreeTemp(cUnit, tReg);
940 dvmCompilerAbort(cUnit);
944 dvmCompilerAbort(cUnit);
947 if (cUnit->jitMode == kJitMethod) {
948 BasicBlock *bb = cUnit->curBlock;
950 MipsLIR *exceptionLabel = (MipsLIR *) cUnit->blockLabelList;
960 return genCheckCommon(cUnit, dOffset, branch, pcrLabel);
965 static void genSelfVerificationPreBranch(CompilationUnit *cUnit,
988 static void genSelfVerificationPostBranch(CompilationUnit *cUnit,
1004 MipsLIR *copy = genRegCopyNoInsert(cUnit, r14lr, r5FP);