Compiler intrinsics
Add intrinsic support. Some of these appear to be of
limited value, so we may end up removing a few. In general,
the instrinsics provide small, but measurable, gains.
Only Arm is currently supported, but most of these should
work for our other targets as well.
This is an interim solution. My plan is to the intrinsic
recognition action up into the basic block building phase once
we start doing inlining.
Change-Id: Ia2913f2cdecaa4e80469caf69dbf8e2f61d4506a
diff --git a/src/compiler/codegen/GenCommon.cc b/src/compiler/codegen/GenCommon.cc
index 3ca0450..0ef1641 100644
--- a/src/compiler/codegen/GenCommon.cc
+++ b/src/compiler/codegen/GenCommon.cc
@@ -21,7 +21,8 @@
* be applicable to most targets. Only mid-level support utilities
* and "op" calls may be used here.
*/
-
+void genInvoke(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir,
+ InvokeType type, bool isRange);
#if defined(TARGET_ARM)
LIR* opIT(CompilationUnit* cUnit, ArmConditionCode cond, const char* guide);
#endif
@@ -835,6 +836,7 @@
int numElems = cUnit->suspendLaunchpads.numUsed;
for (int i = 0; i < numElems; i++) {
oatResetRegPool(cUnit);
+ oatResetDefTracking(cUnit);
LIR* lab = suspendLabel[i];
LIR* resumeLab = (LIR*)lab->operands[0];
cUnit->currentDalvikOffset = lab->operands[1];
@@ -851,12 +853,34 @@
}
}
+void handleIntrinsicLaunchpads(CompilationUnit *cUnit)
+{
+ LIR** intrinsicLabel = (LIR **)cUnit->intrinsicLaunchpads.elemList;
+ int numElems = cUnit->intrinsicLaunchpads.numUsed;
+ for (int i = 0; i < numElems; i++) {
+ oatResetRegPool(cUnit);
+ oatResetDefTracking(cUnit);
+ LIR* lab = intrinsicLabel[i];
+ MIR* mir = (MIR*)lab->operands[0];
+ InvokeType type = (InvokeType)lab->operands[1];
+ BasicBlock* bb = (BasicBlock*)lab->operands[3];
+ cUnit->currentDalvikOffset = mir->offset;
+ oatAppendLIR(cUnit, lab);
+ genInvoke(cUnit, bb, mir, type, false /* isRange */);
+ LIR* resumeLab = (LIR*)lab->operands[2];
+ if (resumeLab != NULL) {
+ opUnconditionalBranch(cUnit, resumeLab);
+ }
+ }
+}
+
void handleThrowLaunchpads(CompilationUnit *cUnit)
{
LIR** throwLabel = (LIR **)cUnit->throwLaunchpads.elemList;
int numElems = cUnit->throwLaunchpads.numUsed;
for (int i = 0; i < numElems; i++) {
oatResetRegPool(cUnit);
+ oatResetDefTracking(cUnit);
LIR* lab = throwLabel[i];
cUnit->currentDalvikOffset = lab->operands[1];
oatAppendLIR(cUnit, lab);