Lines Matching full:cunit
27 static void storePair(CompilationUnit *cUnit, int base, int lowReg,
29 static void loadPair(CompilationUnit *cUnit, int base, int lowReg, int highReg);
30 static ArmLIR *loadWordDisp(CompilationUnit *cUnit, int rBase, int displacement,
32 static ArmLIR *storeWordDisp(CompilationUnit *cUnit, int rBase,
34 static ArmLIR *genRegRegCheck(CompilationUnit *cUnit,
49 static ArmLIR *loadConstantNoClobber(CompilationUnit *cUnit, int rDest,
53 int tDest = LOWREG(rDest) ? rDest : dvmCompilerAllocTemp(cUnit);
56 res = newLIR2(cUnit, kThumbMovImm, tDest, value);
58 opRegReg(cUnit, kOpMov, rDest, tDest);
59 dvmCompilerFreeTemp(cUnit, tDest);
63 res = newLIR2(cUnit, kThumbMovImm, tDest, ~value);
64 newLIR2(cUnit, kThumbMvn, tDest, tDest);
66 opRegReg(cUnit, kOpMov, rDest, tDest);
67 dvmCompilerFreeTemp(cUnit, tDest);
72 ArmLIR *dataTarget = scanLiteralPool(cUnit->literalList, value, 255);
74 dataTarget = addWordData(cUnit, &cUnit->literalList, value);
84 dvmCompilerAppendLIR(cUnit, (LIR *) loadPcRel);
91 newLIR2(cUnit, kThumbAddRI8, tDest, value - dataTarget->operands[0]);
94 opRegReg(cUnit, kOpMov, rDest, tDest);
95 dvmCompilerFreeTemp(cUnit, tDest);
104 static ArmLIR *loadConstant(CompilationUnit *cUnit, int rDest, int value)
106 if (dvmCompilerIsTemp(cUnit, rDest)) {
107 dvmCompilerClobber(cUnit, rDest);
108 dvmCompilerMarkInUse(cUnit, rDest);
110 return loadConstantNoClobber(cUnit, rDest, value);
117 static ArmLIR *loadClassPointer(CompilationUnit *cUnit, int rDest, int value)
120 cUnit->hasClassLiterals = true;
121 if (dvmCompilerIsTemp(cUnit, rDest)) {
122 dvmCompilerClobber(cUnit, rDest);
123 dvmCompilerMarkInUse(cUnit, rDest);
125 ArmLIR *dataTarget = scanLiteralPool(cUnit->classPointerList, value, 0);
127 dataTarget = addWordData(cUnit, &cUnit->classPointerList, value);
129 cUnit->numClassPointers++;
139 dvmCompilerAppendLIR(cUnit, (LIR *) loadPcRel);
143 static ArmLIR *opNone(CompilationUnit *cUnit, OpKind op)
152 dvmCompilerAbort(cUnit);
154 return newLIR0(cUnit, opcode);
157 static ArmLIR *opCondBranch(CompilationUnit *cUnit, ArmConditionCode cc)
159 return newLIR2(cUnit, kThumbBCond, 0 /* offset to be patched */, cc);
162 static ArmLIR *opImm(CompilationUnit *cUnit, OpKind op, int value)
174 dvmCompilerAbort(cUnit);
176 return newLIR1(cUnit, opcode, value);
179 static ArmLIR *opReg(CompilationUnit *cUnit, OpKind op, int rDestSrc)
188 dvmCompilerAbort(cUnit);
190 return newLIR1(cUnit, opcode, rDestSrc);
193 static ArmLIR *opRegImm(CompilationUnit *cUnit, OpKind op, int rDestSrc1,
205 return newLIR1(cUnit, kThumbAddSpI7, value >> 2);
214 return newLIR1(cUnit, kThumbSubSpI7, value >> 2);
234 dvmCompilerAbort(cUnit);
238 res = newLIR2(cUnit, opcode, rDestSrc1, absValue);
240 int rScratch = dvmCompilerAllocTemp(cUnit);
241 res = loadConstant(cUnit, rScratch, value);
243 newLIR2(cUnit, opcode, rDestSrc1, rScratch);
245 newLIR3(cUnit, opcode, rDestSrc1, rDestSrc1, rScratch);
250 static ArmLIR *opRegRegReg(CompilationUnit *cUnit, OpKind op, int rDest,
263 return opRegReg(cUnit, op, rDest, rSrc2);
265 assert(dvmCompilerIsTemp(cUnit, rSrc1));
266 dvmCompilerClobber(cUnit, rSrc1);
267 opRegReg(cUnit, op, rSrc1, rSrc2);
268 return opRegReg(cUnit, kOpMov, rDest, rSrc1);
270 opRegReg(cUnit, kOpMov, rDest, rSrc1);
271 return opRegReg(cUnit, op, rDest, rSrc2);
275 return newLIR3(cUnit, opcode, rDest, rSrc1, rSrc2);
278 static ArmLIR *opRegRegImm(CompilationUnit *cUnit, OpKind op, int rDest,
289 return opRegImm(cUnit, op, rDest, value);
305 res = newLIR3(cUnit, opcode, rDest, rSrc1, 7);
307 newLIR2(cUnit, opcode, rDest, absValue - 7);
315 return opRegImm(cUnit, op, rDest, value);
321 res = newLIR3(cUnit, opcode, rDest, rSrc1, 7);
323 newLIR2(cUnit, opcode, rDest, absValue - 7);
345 int rScratch = dvmCompilerAllocTemp(cUnit);
346 res = loadConstant(cUnit, rScratch, value);
347 opRegReg(cUnit, op, rDest, rScratch);
349 res = loadConstant(cUnit, rDest, value);
350 opRegReg(cUnit, op, rDest, rSrc1);
355 dvmCompilerAbort(cUnit);
359 res = newLIR3(cUnit, opcode, rDest, rSrc1, absValue);
362 res = loadConstant(cUnit, rDest, value);
363 newLIR3(cUnit, opcode, rDest, rSrc1, rDest);
365 int rScratch = dvmCompilerAllocTemp(cUnit);
366 res = loadConstant(cUnit, rScratch, value);
367 newLIR3(cUnit, opcode, rDest, rSrc1, rScratch);
373 static ArmLIR *opRegReg(CompilationUnit *cUnit, OpKind op, int rDestSrc1,
438 return opRegRegReg(cUnit, op, rDestSrc1, rDestSrc1, rSrc2);
440 res = opRegRegImm(cUnit, kOpLsl, rDestSrc1, rSrc2, 24);
441 opRegRegImm(cUnit, kOpAsr, rDestSrc1, rDestSrc1, 24);
444 res = opRegRegImm(cUnit, kOpLsl, rDestSrc1, rSrc2, 16);
445 opRegRegImm(cUnit, kOpAsr, rDestSrc1, rDestSrc1, 16);
448 res = opRegRegImm(cUnit, kOpLsl, rDestSrc1, rSrc2, 16);
449 opRegRegImm(cUnit, kOpLsr, rDestSrc1, rDestSrc1, 16);
453 dvmCompilerAbort(cUnit);
456 return newLIR2(cUnit, opcode, rDestSrc1, rSrc2);
459 static ArmLIR *loadConstantValueWide(CompilationUnit *cUnit, int rDestLo,
463 res = loadConstantNoClobber(cUnit, rDestLo, valLo);
464 loadConstantNoClobber(cUnit, rDestHi, valHi);
469 static ArmLIR *loadBaseIndexed(CompilationUnit *cUnit, int rBase,
478 rNewIndex = dvmCompilerAllocTemp(cUnit);
479 first = opRegRegImm(cUnit, kOpLsl, rNewIndex, rIndex, scale);
499 dvmCompilerAbort(cUnit);
501 res = newLIR3(cUnit, opcode, rDest, rBase, rNewIndex);
503 if (cUnit->heapMemOp)
507 dvmCompilerFreeTemp(cUnit, rNewIndex);
512 static ArmLIR *storeBaseIndexed(CompilationUnit *cUnit, int rBase,
520 rNewIndex = dvmCompilerAllocTemp(cUnit);
521 first = opRegRegImm(cUnit, kOpLsl, rNewIndex, rIndex, scale);
537 dvmCompilerAbort(cUnit);
539 res = newLIR3(cUnit, opcode, rSrc, rBase, rNewIndex);
541 if (cUnit->heapMemOp)
545 dvmCompilerFreeTemp(cUnit, rNewIndex);
549 static ArmLIR *loadMultiple(CompilationUnit *cUnit, int rBase, int rMask)
552 genBarrier(cUnit);
553 res = newLIR2(cUnit, kThumbLdmia, rBase, rMask);
555 if (cUnit->heapMemOp)
558 genBarrier(cUnit);
562 static ArmLIR *storeMultiple(CompilationUnit *cUnit, int rBase, int rMask)
565 genBarrier(cUnit);
566 res = newLIR2(cUnit, kThumbStmia, rBase, rMask);
568 if (cUnit->heapMemOp)
571 genBarrier(cUnit);
575 static ArmLIR *loadBaseDispBody(CompilationUnit *cUnit, MIR *mir, int rBase,
654 dvmCompilerAbort(cUnit);
657 load = res = newLIR3(cUnit, opcode, rDest, rBase, encodedDisp);
659 load2 = newLIR3(cUnit, opcode, rDestHi, rBase, encodedDisp+1);
663 int rTmp = dvmCompilerAllocFreeTemp(cUnit);
664 res = opRegRegImm(cUnit, kOpAdd, rTmp, rBase, displacement);
665 load = newLIR3(cUnit, kThumbLdrRRI5, rDest, rTmp, 0);
666 load2 = newLIR3(cUnit, kThumbLdrRRI5, rDestHi, rTmp, 1);
667 dvmCompilerFreeTemp(cUnit, rTmp);
669 int rTmp = (rBase == rDest) ? dvmCompilerAllocFreeTemp(cUnit)
671 res = loadConstant(cUnit, rTmp, displacement);
672 load = newLIR3(cUnit, opcode, rDest, rBase, rTmp);
677 dvmCompilerFreeTemp(cUnit, rTmp);
689 if (load != NULL && cUnit->heapMemOp)
691 if (load2 != NULL && cUnit->heapMemOp)
697 static ArmLIR *loadBaseDisp(CompilationUnit *cUnit, MIR *mir, int rBase,
701 return loadBaseDispBody(cUnit, mir, rBase, displacement, rDest, -1,
705 static ArmLIR *loadBaseDispWide(CompilationUnit *cUnit, MIR *mir, int rBase,
709 return loadBaseDispBody(cUnit, mir, rBase, displacement, rDestLo, rDestHi,
713 static ArmLIR *storeBaseDispBody(CompilationUnit *cUnit, int rBase,
771 dvmCompilerAbort(cUnit);
774 store = res = newLIR3(cUnit, opcode, rSrc, rBase, encodedDisp);
776 store2 = newLIR3(cUnit, opcode, rSrcHi, rBase, encodedDisp + 1);
779 int rScratch = dvmCompilerAllocTemp(cUnit);
781 res = opRegRegImm(cUnit, kOpAdd, rScratch, rBase, displacement);
782 store = newLIR3(cUnit, kThumbStrRRI5, rSrc, rScratch, 0);
783 store2 = newLIR3(cUnit, kThumbStrRRI5, rSrcHi, rScratch, 1);
785 res = loadConstant(cUnit, rScratch, displacement);
786 store = newLIR3(cUnit, opcode, rSrc, rBase, rScratch);
788 dvmCompilerFreeTemp(cUnit, rScratch);
799 if (store != NULL && cUnit->heapMemOp)
801 if (store2 != NULL && cUnit->heapMemOp)
807 static ArmLIR *storeBaseDisp(CompilationUnit *cUnit, int rBase,
810 return storeBaseDispBody(cUnit, rBase, displacement, rSrc, -1, size);
813 static ArmLIR *storeBaseDispWide(CompilationUnit *cUnit, int rBase,
816 return storeBaseDispBody(cUnit, rBase, displacement, rSrcLo, rSrcHi, kLong);
819 static void storePair(CompilationUnit *cUnit, int base, int lowReg, int highReg)
822 storeMultiple(cUnit, base, (1 << lowReg) | (1 << highReg));
824 storeWordDisp(cUnit, base, 0, lowReg);
825 storeWordDisp(cUnit, base, 4, highReg);
829 static void loadPair(CompilationUnit *cUnit, int base, int lowReg, int highReg)
832 loadMultiple(cUnit, base, (1 << lowReg) | (1 << highReg));
834 loadWordDisp(cUnit, base, 0 , lowReg);
835 loadWordDisp(cUnit, base, 4 , highReg);
839 static ArmLIR* genRegCopyNoInsert(CompilationUnit *cUnit, int rDest, int rSrc)
863 static ArmLIR* genRegCopy(CompilationUnit *cUnit, int rDest, int rSrc)
865 ArmLIR *res = genRegCopyNoInsert(cUnit, rDest, rSrc);
866 dvmCompilerAppendLIR(cUnit, (LIR*)res);
870 static void genRegCopyWide(CompilationUnit *cUnit, int destLo, int destHi,
875 genRegCopy(cUnit, destHi, srcHi);
876 genRegCopy(cUnit, destLo, srcLo);
878 genRegCopy(cUnit, destLo, srcLo);
879 genRegCopy(cUnit, destHi, srcHi);
883 static ArmLIR *genCmpImmBranch(CompilationUnit *cUnit,
888 int tReg = dvmCompilerAllocTemp(cUnit);
889 loadConstant(cUnit, tReg, checkValue);
890 newLIR2(cUnit, kThumbCmpRR, reg, tReg);
891 dvmCompilerFreeTemp(cUnit, tReg);
893 newLIR2(cUnit, kThumbCmpRI8, reg, checkValue);
895 ArmLIR *branch = newLIR2(cUnit, kThumbBCond, 0, cond);
900 static void genSelfVerificationPreBranch(CompilationUnit *cUnit,
920 static void genSelfVerificationPostBranch(CompilationUnit *cUnit,
934 ArmLIR *copy = genRegCopyNoInsert(cUnit, r14lr, r5FP);