From fc9e6fabed89d948fa8c0e9d673e430076712c60 Mon Sep 17 00:00:00 2001 From: buzbee Date: Fri, 23 Mar 2012 15:14:29 -0700 Subject: 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 --- src/compiler/codegen/GenCommon.cc | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'src/compiler/codegen/GenCommon.cc') diff --git a/src/compiler/codegen/GenCommon.cc b/src/compiler/codegen/GenCommon.cc index 3ca0450e1c..0ef1641858 100644 --- a/src/compiler/codegen/GenCommon.cc +++ b/src/compiler/codegen/GenCommon.cc @@ -21,7 +21,8 @@ namespace art { * 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 @@ void handleSuspendLaunchpads(CompilationUnit *cUnit) 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 handleSuspendLaunchpads(CompilationUnit *cUnit) } } +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); -- cgit v1.2.3-59-g8ed1b