summaryrefslogtreecommitdiff
path: root/src/compiler/codegen/RallocUtil.cc
diff options
context:
space:
mode:
author buzbee <buzbee@google.com> 2012-06-12 17:49:27 -0700
committer buzbee <buzbee@google.com> 2012-06-13 10:44:04 -0700
commit15bf9804820b73765899e4b3e0d8a1fa15e0dbd3 (patch)
treebcc0a0e3c0037e86041d769c1bde4b9cb9330048 /src/compiler/codegen/RallocUtil.cc
parenta168c83a1d247094e9efb1244b0f73a5f1e1ed97 (diff)
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
Diffstat (limited to 'src/compiler/codegen/RallocUtil.cc')
-rw-r--r--src/compiler/codegen/RallocUtil.cc32
1 files changed, 20 insertions, 12 deletions
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;
}