loadPcRel->generic.target = (LIR *) dataTarget;
loadPcRel->operands[0] = tDest;
setupResourceMasks(loadPcRel);
+ /*
+ * Special case for literal loads with a link register target.
+ * Self-cosim mode will insert calls prior to heap references
+ * after optimization, and those will destroy r14. The easy
+ * workaround is to treat literal loads into r14 as heap references
+ * to prevent them from being hoisted. Use of r14 in this manner
+ * is currently rare. Revist if that changes.
+ */
+ if (rDest != rlr)
+ setMemRefType(loadPcRel, true, kLiteral);
+ loadPcRel->aliasInfo = dataTarget->operands[0];
res = loadPcRel;
dvmCompilerAppendLIR(cUnit, (LIR *) loadPcRel);
opCode = kThumbBUncond;
break;
default:
- assert(0);
+ dvmAbort(); // FIXME: abort trace instead of VM
}
return newLIR0(cUnit, opCode);
}
opCode = kThumbPop;
break;
default:
- assert(0);
+ dvmAbort(); // FIXME: abort trace instead of VM
}
return newLIR1(cUnit, opCode, value);
}
opCode = kThumbBlxR;
break;
default:
- assert(0);
+ dvmAbort(); // FIXME: abort trace instead of VM
}
return newLIR1(cUnit, opCode, rDestSrc);
}
}
break;
default:
- assert(0);
+ dvmAbort(); // FIXME: abort trace instead of VM
break;
}
if (shortForm)
}
return res;
default:
- assert(0);
+ dvmAbort(); // FIXME - abort trace instead of VM
break;
}
if (shortForm)
opRegRegImm(cUnit, kOpLsr, rDestSrc1, rDestSrc1, 16);
return res;
default:
- assert(0);
+ dvmAbort(); // FIXME - abort trace instead of VM
break;
}
return newLIR2(cUnit, opCode, rDestSrc1, rSrc2);
opCode = kThumbLdrsbRRR;
break;
default:
- assert(0);
+ dvmAbort(); // FIXME: abort trace instead of VM
}
res = newLIR3(cUnit, opCode, rDest, rBase, rNewIndex);
#if defined(WITH_SELF_VERIFICATION)
opCode = kThumbStrbRRR;
break;
default:
- assert(0);
+ dvmAbort(); // FIXME - abort trace instead of VM
}
res = newLIR3(cUnit, opCode, rSrc, rBase, rNewIndex);
#if defined(WITH_SELF_VERIFICATION)
opCode = kThumbLdrsbRRR;
break;
default:
- assert(0);
+ dvmAbort(); // FIXME - abort trace instead of VM
}
if (shortForm) {
load = res = newLIR3(cUnit, opCode, rDest, rBase, encodedDisp);
} else {
if (pair) {
int rTmp = dvmCompilerAllocFreeTemp(cUnit);
- if (rTmp < 0) {
- //UNIMP: need to spill if no temps.
- assert(0);
- }
res = opRegRegImm(cUnit, kOpAdd, rTmp, rBase, displacement);
- //TUNING: how to mark loadPair if Dalvik access?
- loadPair(cUnit, rTmp, rDest, rDestHi);
+ load = newLIR3(cUnit, kThumbLdrRRI5, rDest, rTmp, 0);
+ load2 = newLIR3(cUnit, kThumbLdrRRI5, rDestHi, rTmp, 1);
dvmCompilerFreeTemp(cUnit, rTmp);
} else {
- int rTmp = (rBase == rDest) ? dvmCompilerAllocFreeTemp(cUnit) : rDest;
- if (rTmp < 0) {
- //UNIMP: need to spill if no temps.
- assert(0);
- }
+ int rTmp = (rBase == rDest) ? dvmCompilerAllocFreeTemp(cUnit)
+ : rDest;
res = loadConstant(cUnit, rTmp, displacement);
load = newLIR3(cUnit, opCode, rDest, rBase, rTmp);
if (rBase == rFP)
dvmCompilerFreeTemp(cUnit, rTmp);
}
}
+ if (rBase == rFP) {
+ if (load != NULL)
+ annotateDalvikRegAccess(load, displacement >> 2,
+ true /* isLoad */);
+ if (load2 != NULL)
+ annotateDalvikRegAccess(load2, (displacement >> 2) + 1,
+ true /* isLoad */);
+ }
#if defined(WITH_SELF_VERIFICATION)
if (load != NULL && cUnit->heapMemOp)
load->branchInsertSV = true;
}
break;
default:
- assert(0);
+ dvmAbort(); // FIXME - abort trace instead of VM
}
if (shortForm) {
store = res = newLIR3(cUnit, opCode, rSrc, rBase, encodedDisp);
} else {
int rScratch = dvmCompilerAllocTemp(cUnit);
if (pair) {
- //TUNING: how to mark storePair as Dalvik access if it is?
res = opRegRegImm(cUnit, kOpAdd, rScratch, rBase, displacement);
- storePair(cUnit, rScratch, rSrc, rSrcHi);
+ store = newLIR3(cUnit, kThumbStrRRI5, rSrc, rScratch, 0);
+ store2 = newLIR3(cUnit, kThumbStrRRI5, rSrcHi, rScratch, 1);
} else {
res = loadConstant(cUnit, rScratch, displacement);
store = newLIR3(cUnit, opCode, rSrc, rBase, rScratch);
- if (rBase == rFP) {
- annotateDalvikRegAccess(store, displacement >> 2,
- false /* isLoad */);
- }
}
dvmCompilerFreeTemp(cUnit, rScratch);
}
+ if (rBase == rFP) {
+ if (store != NULL)
+ annotateDalvikRegAccess(store, displacement >> 2,
+ false /* isLoad */);
+ if (store2 != NULL)
+ annotateDalvikRegAccess(store2, (displacement >> 2) + 1,
+ false /* isLoad */);
+ }
#if defined(WITH_SELF_VERIFICATION)
if (store != NULL && cUnit->heapMemOp)
store->branchInsertSV = true;