Home | History | Annotate | Download | only in Thumb2

Lines Matching full:cunit

51 static ArmLIR *loadFPConstantValue(CompilationUnit *cUnit, int rDest,
60 newLIR2(cUnit, kThumb2Vmovs_IMM8, rDest, 0);
62 return newLIR3(cUnit, kThumb2Vsubs, rDest, rDest, rDest);
64 return newLIR2(cUnit, kThumb2Vmovs_IMM8, rDest, encodedImm);
66 ArmLIR *dataTarget = scanLiteralPool(cUnit->literalList, value, 0);
68 dataTarget = addWordData(cUnit, &cUnit->literalList, value);
78 dvmCompilerAppendLIR(cUnit, (LIR *) loadPcRel);
143 static ArmLIR *loadConstantNoClobber(CompilationUnit *cUnit, int rDest,
150 return loadFPConstantValue(cUnit, rDest, value);
155 return newLIR2(cUnit, kThumbMovImm, rDest, value);
160 res = newLIR2(cUnit, kThumb2MovImmShift, rDest, modImm);
165 res = newLIR2(cUnit, kThumb2MvnImmShift, rDest, modImm);
170 res = newLIR2(cUnit, kThumb2MovImm16, rDest, value);
174 ArmLIR *dataTarget = scanLiteralPool(cUnit->literalList, value, 0);
176 dataTarget = addWordData(cUnit, &cUnit->literalList, value);
186 dvmCompilerAppendLIR(cUnit, (LIR *) loadPcRel);
193 opRegImm(cUnit, kOpAdd, rDest, value - dataTarget->operands[0]);
202 static ArmLIR *loadConstant(CompilationUnit *cUnit, int rDest, int value)
204 if (dvmCompilerIsTemp(cUnit, rDest)) {
205 dvmCompilerClobber(cUnit, rDest);
206 dvmCompilerMarkInUse(cUnit, rDest);
208 return loadConstantNoClobber(cUnit, rDest, value);
215 static ArmLIR *loadClassPointer(CompilationUnit *cUnit, int rDest, int value)
218 cUnit->hasClassLiterals = true;
219 if (dvmCompilerIsTemp(cUnit, rDest)) {
220 dvmCompilerClobber(cUnit, rDest);
221 dvmCompilerMarkInUse(cUnit, rDest);
223 ArmLIR *dataTarget = scanLiteralPool(cUnit->classPointerList, value, 0);
225 dataTarget = addWordData(cUnit, &cUnit->classPointerList, value);
227 cUnit->numClassPointers++;
237 dvmCompilerAppendLIR(cUnit, (LIR *) loadPcRel);
241 static ArmLIR *opNone(CompilationUnit *cUnit, OpKind op)
251 return newLIR0(cUnit, opcode);
254 static ArmLIR *opCondBranch(CompilationUnit *cUnit, ArmConditionCode cc)
256 return newLIR2(cUnit, kThumb2BCond, 0 /* offset to be patched */, cc);
259 static ArmLIR *opImm(CompilationUnit *cUnit, OpKind op, int value)
290 return newLIR1(cUnit, opcode, value);
293 static ArmLIR *opReg(CompilationUnit *cUnit, OpKind op, int rDestSrc)
303 return newLIR1(cUnit, opcode, rDestSrc);
306 static ArmLIR *opRegRegShift(CompilationUnit *cUnit, OpKind op, int rDestSrc1,
395 return newLIR4(cUnit, kThumb2Sbfx, rDestSrc1, rSrc2, 0, 8);
398 return newLIR4(cUnit, kThumb2Sbfx, rDestSrc1, rSrc2, 0, 16);
401 return newLIR4(cUnit, kThumb2Ubfx, rDestSrc1, rSrc2, 0, 16);
408 return newLIR2(cUnit, opcode, rDestSrc1, rSrc2);
411 return newLIR3(cUnit, opcode, rDestSrc1, rSrc2, shift);
413 return newLIR3(cUnit, opcode, rDestSrc1, rDestSrc1, rSrc2);
415 return newLIR4(cUnit, opcode, rDestSrc1, rDestSrc1, rSrc2, shift);
422 static ArmLIR *opRegReg(CompilationUnit *cUnit, OpKind op, int rDestSrc1,
425 return opRegRegShift(cUnit, op, rDestSrc1, rSrc2, 0);
428 static ArmLIR *opRegRegRegShift(CompilationUnit *cUnit, OpKind op,
485 return newLIR4(cUnit, opcode, rDest, rSrc1, rSrc2, shift);
488 return newLIR3(cUnit, opcode, rDest, rSrc1, rSrc2);
492 static ArmLIR *opRegRegReg(CompilationUnit *cUnit, OpKind op, int rDest,
495 return opRegRegRegShift(cUnit, op, rDest, rSrc1, rSrc2, 0);
498 static ArmLIR *opRegRegImm(CompilationUnit *cUnit, OpKind op, int rDest,
513 return newLIR3(cUnit, kThumbLslRRI5, rDest, rSrc1, value);
515 return newLIR3(cUnit, kThumb2LslRRI5, rDest, rSrc1, value);
518 return newLIR3(cUnit, kThumbLsrRRI5, rDest, rSrc1, value);
520 return newLIR3(cUnit, kThumb2LsrRRI5, rDest, rSrc1, value);
523 return newLIR3(cUnit, kThumbAsrRRI5, rDest, rSrc1, value);
525 return newLIR3(cUnit, kThumb2AsrRRI5, rDest, rSrc1, value);
527 return newLIR3(cUnit, kThumb2RorRRI5, rDest, rSrc1, value);
531 return newLIR3(cUnit, kThumbAddSpRel, rDest, rSrc1,
535 return newLIR3(cUnit, kThumbAddPcRel, rDest, rSrc1,
547 return newLIR3(cUnit, opcode, rDest, rSrc1, absValue);
553 return newLIR3(cUnit, opcode, rDest, rSrc1, absValue);
593 res = newLIR2(cUnit, kThumb2CmpRI8, rSrc1, modImm);
595 int rTmp = dvmCompilerAllocTemp(cUnit);
596 res = loadConstant(cUnit, rTmp, value);
597 opRegReg(cUnit, kOpCmp, rSrc1, rTmp);
598 dvmCompilerFreeTemp(cUnit, rTmp);
607 return newLIR3(cUnit, opcode, rDest, rSrc1, modImm);
609 int rScratch = dvmCompilerAllocTemp(cUnit);
610 loadConstant(cUnit, rScratch, value);
612 res = newLIR4(cUnit, altOpcode, rDest, rSrc1, rScratch, 0);
614 res = newLIR3(cUnit, altOpcode, rDest, rSrc1, rScratch);
615 dvmCompilerFreeTemp(cUnit, rScratch);
621 static ArmLIR *opRegImm(CompilationUnit *cUnit, OpKind op, int rDestSrc1,
632 return newLIR1(cUnit, kThumbAddSpI7, value >> 2);
640 return newLIR1(cUnit, kThumbSubSpI7, value >> 2);
661 return newLIR2(cUnit, opcode, rDestSrc1, absValue);
663 return opRegRegImm(cUnit, op, rDestSrc1, rDestSrc1, value);
701 static ArmLIR *loadConstantValueWide(CompilationUnit *cUnit, int rDestLo,
713 newLIR2(cUnit, kThumb2Vmovd_IMM8, targetReg, 0);
715 res = newLIR3(cUnit, kThumb2Vsubd, targetReg, targetReg, targetReg);
717 res = newLIR2(cUnit, kThumb2Vmovd_IMM8, targetReg, encodedImm);
719 ArmLIR* dataTarget = scanLiteralPoolWide(cUnit->literalList, valLo, valHi);
721 dataTarget = addWideData(cUnit, &cUnit->literalList, valLo, valHi);
732 dvmCompilerAppendLIR(cUnit, (LIR *) loadPcRel);
736 res = loadConstantNoClobber(cUnit, rDestLo, valLo);
737 loadConstantNoClobber(cUnit, rDestHi, valHi);
746 static ArmLIR *loadBaseIndexed(CompilationUnit *cUnit, int rBase,
767 regPtr = dvmCompilerAllocTemp(cUnit);
769 newLIR4(cUnit, kThumb2AddRRR, regPtr, rBase, rIndex,
772 opRegRegReg(cUnit, kOpAdd, regPtr, rBase, rIndex);
774 load = newLIR3(cUnit, opcode, rDest, regPtr, 0);
776 if (cUnit->heapMemOp)
799 load = newLIR3(cUnit, opcode, rDest, rBase, rIndex);
801 load = newLIR4(cUnit, opcode, rDest, rBase, rIndex, scale);
804 if (cUnit->heapMemOp)
810 static ArmLIR *storeBaseIndexed(CompilationUnit *cUnit, int rBase,
831 regPtr = dvmCompilerAllocTemp(cUnit);
833 newLIR4(cUnit, kThumb2AddRRR, regPtr, rBase, rIndex,
836 opRegRegReg(cUnit, kOpAdd, regPtr, rBase, rIndex);
838 store = newLIR3(cUnit, opcode, rSrc, regPtr, 0);
840 if (cUnit->heapMemOp)
859 store = newLIR3(cUnit, opcode, rSrc, rBase, rIndex);
861 store = newLIR4(cUnit, opcode, rSrc, rBase, rIndex, scale);
864 if (cUnit->heapMemOp)
875 static ArmLIR *loadBaseDispBody(CompilationUnit *cUnit, MIR *mir, int rBase,
901 res = loadBaseDispBody(cUnit, mir, rBase, displacement, rDest,
903 loadBaseDispBody(cUnit, NULL, rBase, displacement + 4, rDestHi,
974 load = res = newLIR3(cUnit, opcode, rDest, rBase, encodedDisp);
976 int regOffset = dvmCompilerAllocTemp(cUnit);
977 res = loadConstant(cUnit, regOffset, encodedDisp);
978 load = loadBaseIndexed(cUnit, rBase, regOffset, rDest, 0, size);
979 dvmCompilerFreeTemp(cUnit, regOffset);
986 if (cUnit->heapMemOp)
992 static ArmLIR *loadBaseDisp(CompilationUnit *cUnit, MIR *mir, int rBase,
996 return loadBaseDispBody(cUnit, mir, rBase, displacement, rDest, -1,
1000 static ArmLIR *loadBaseDispWide(CompilationUnit *cUnit, MIR *mir, int rBase,
1004 return loadBaseDispBody(cUnit, mir, rBase, displacement, rDestLo, rDestHi,
1009 static ArmLIR *storeBaseDispBody(CompilationUnit *cUnit, int rBase,
1024 res = storeBaseDispBody(cUnit, rBase, displacement, rSrc,
1026 storeBaseDispBody(cUnit, rBase, displacement + 4, rSrcHi,
1087 store = res = newLIR3(cUnit, opcode, rSrc, rBase, encodedDisp);
1089 int rScratch = dvmCompilerAllocTemp(cUnit);
1090 res = loadConstant(cUnit, rScratch, encodedDisp);
1091 store = storeBaseIndexed(cUnit, rBase, rScratch, rSrc, 0, size);
1092 dvmCompilerFreeTemp(cUnit, rScratch);
1099 if (cUnit->heapMemOp)
1105 static ArmLIR *storeBaseDisp(CompilationUnit *cUnit, int rBase,
1108 return storeBaseDispBody(cUnit, rBase, displacement, rSrc, -1, size);
1111 static ArmLIR *storeBaseDispWide(CompilationUnit *cUnit, int rBase,
1114 return storeBaseDispBody(cUnit, rBase, displacement, rSrcLo, rSrcHi, kLong);
1117 static ArmLIR *loadMultiple(CompilationUnit *cUnit, int rBase, int rMask)
1120 genBarrier(cUnit);
1122 res = newLIR2(cUnit, kThumbLdmia, rBase, rMask);
1124 res = newLIR2(cUnit, kThumb2Ldmia, rBase, rMask);
1127 if (cUnit->heapMemOp)
1130 genBarrier(cUnit);
1134 static ArmLIR *storeMultiple(CompilationUnit *cUnit, int rBase, int rMask)
1137 genBarrier(cUnit);
1139 res = newLIR2(cUnit, kThumbStmia, rBase, rMask);
1141 res = newLIR2(cUnit, kThumb2Stmia, rBase, rMask);
1144 if (cUnit->heapMemOp)
1147 genBarrier(cUnit);
1151 static void storePair(CompilationUnit *cUnit, int base, int lowReg, int highReg)
1153 storeBaseDispWide(cUnit, base, 0, lowReg, highReg);
1156 static void loadPair(CompilationUnit *cUnit, int base, int lowReg, int highReg)
1158 loadBaseDispWide(cUnit, NULL, base, 0, lowReg, highReg, INVALID_SREG);
1165 static ArmLIR *genCmpImmBranch(CompilationUnit *cUnit,
1173 branch = newLIR2(cUnit,
1179 newLIR2(cUnit, kThumbCmpRI8, reg, checkValue);
1181 newLIR2(cUnit, kThumb2CmpRI8, reg, modImm);
1183 int tReg = dvmCompilerAllocTemp(cUnit);
1184 loadConstant(cUnit, tReg, checkValue);
1185 opRegReg(cUnit, kOpCmp, reg, tReg);
1187 branch = newLIR2(cUnit, kThumbBCond, 0, cond);
1192 static ArmLIR *fpRegCopy(CompilationUnit *cUnit, int rDest, int rSrc)
1218 static ArmLIR* genRegCopyNoInsert(CompilationUnit *cUnit, int rDest, int rSrc)
1223 return fpRegCopy(cUnit, rDest, rSrc);
1244 static ArmLIR* genRegCopy(CompilationUnit *cUnit, int rDest, int rSrc)
1246 ArmLIR *res = genRegCopyNoInsert(cUnit, rDest, rSrc);
1247 dvmCompilerAppendLIR(cUnit, (LIR*)res);
1251 static void genRegCopyWide(CompilationUnit *cUnit, int destLo, int destHi,
1260 genRegCopy(cUnit, S2D(destLo, destHi), S2D(srcLo, srcHi));
1262 newLIR3(cUnit, kThumb2Fmdrr, S2D(destLo, destHi), srcLo, srcHi);
1266 newLIR3(cUnit, kThumb2Fmrrd, destLo, destHi, S2D(srcLo, srcHi));
1270 genRegCopy(cUnit, destHi, srcHi);
1271 genRegCopy(cUnit, destLo, srcLo);
1273 genRegCopy(cUnit, destLo, srcLo);
1274 genRegCopy(cUnit, destHi, srcHi);
1281 static void genSelfVerificationPreBranch(CompilationUnit *cUnit,
1291 static void genSelfVerificationPostBranch(CompilationUnit *cUnit,