From 15bf9804820b73765899e4b3e0d8a1fa15e0dbd3 Mon Sep 17 00:00:00 2001 From: buzbee Date: Tue, 12 Jun 2012 17:49:27 -0700 Subject: More Quick compiler restructuring Yet another round of compiler restructuring to remove references to MIR and BasicBlock structures in the lower levels of code generation. Eliminating these will make it easer to share code with the LLVM-IR -> LIR lowering pass. This time I'm focusing on the Invokes and special-cased inlined intrinsics. Note that this CL includes a somewhat subtle difference in handling MOVE_RETURNs following an INVOKE. Previously, we fused INVOKEs and MOVE_RETURNs for inlined intrinsics. To simplify the world, we're now fusing all INVOKE/MOVE_RETURN pairs (though it shouldn't impact the codegen non-inlined invokes. Changes in latest patch set: Two of the old intrinsic generators did not fuse the following MOVE_RESULT, so the results were dropped on the floor. Also, allowed match of MOVE_RESULT_OBJECT (which previously had not been matched because no inline intrisic used it as a return value). Change-Id: I93fec0cd557398ad7b04bdcc0393f27d3644913d --- src/compiler/codegen/RallocUtil.cc | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) (limited to 'src/compiler/codegen/RallocUtil.cc') diff --git a/src/compiler/codegen/RallocUtil.cc b/src/compiler/codegen/RallocUtil.cc index 14b4159963..e2f2cd683b 100644 --- a/src/compiler/codegen/RallocUtil.cc +++ b/src/compiler/codegen/RallocUtil.cc @@ -1005,35 +1005,43 @@ extern RegLocation oatEvalLoc(CompilationUnit* cUnit, RegLocation loc, return loc; } -extern RegLocation oatGetDest(CompilationUnit* cUnit, MIR* mir, int num) +extern RegLocation oatGetRawSrc(CompilationUnit* cUnit, MIR* mir, int num) { - RegLocation res = cUnit->regLocation[mir->ssaRep->defs[num]]; - DCHECK(!res.wide); + DCHECK(num < mir->ssaRep->numUses); + RegLocation res = cUnit->regLocation[mir->ssaRep->uses[num]]; + DCHECK(!res.wide || num < (mir->ssaRep->numUses - 1)); return res; } -extern RegLocation oatGetSrc(CompilationUnit* cUnit, MIR* mir, int num) +extern RegLocation oatGetRawDest(CompilationUnit* cUnit, MIR* mir) { - RegLocation res = cUnit->regLocation[mir->ssaRep->uses[num]]; + DCHECK(mir->ssaRep->numDefs > 0); + RegLocation res = cUnit->regLocation[mir->ssaRep->defs[0]]; + DCHECK(!res.wide || mir->ssaRep->numDefs == 2); + return res; +} +extern RegLocation oatGetDest(CompilationUnit* cUnit, MIR* mir) +{ + RegLocation res = oatGetRawDest(cUnit, mir); DCHECK(!res.wide); return res; } -extern RegLocation oatGetRawSrc(CompilationUnit* cUnit, MIR* mir, int num) +extern RegLocation oatGetSrc(CompilationUnit* cUnit, MIR* mir, int num) { - RegLocation res = cUnit->regLocation[mir->ssaRep->uses[num]]; + RegLocation res = oatGetRawSrc(cUnit, mir, num); + DCHECK(!res.wide); return res; } -extern RegLocation oatGetDestWide(CompilationUnit* cUnit, MIR* mir, - int low, int high) +extern RegLocation oatGetDestWide(CompilationUnit* cUnit, MIR* mir) { - RegLocation res = cUnit->regLocation[mir->ssaRep->defs[low]]; + RegLocation res = oatGetRawDest(cUnit, mir); DCHECK(res.wide); return res; } extern RegLocation oatGetSrcWide(CompilationUnit* cUnit, MIR* mir, - int low, int high) + int low) { - RegLocation res = cUnit->regLocation[mir->ssaRep->uses[low]]; + RegLocation res = oatGetRawSrc(cUnit, mir, low); DCHECK(res.wide); return res; } -- cgit v1.2.3-59-g8ed1b