summaryrefslogtreecommitdiffstats
path: root/compiler/dex/quick/ralloc_util.cc
diff options
context:
space:
mode:
authorVladimir Marko <vmarko@google.com>2014-05-12 16:22:14 +0100
committerVladimir Marko <vmarko@google.com>2014-05-12 16:48:58 +0100
commit0dc242d6fc1254e6ca1c31e08e612bbf45644b17 (patch)
treea3389b2a7642745cd71843e903a77ea4282be284 /compiler/dex/quick/ralloc_util.cc
parent6663c90d2f94b0035fabcaee1f26fd840c9f9161 (diff)
downloadart-0dc242d6fc1254e6ca1c31e08e612bbf45644b17.tar.gz
art-0dc242d6fc1254e6ca1c31e08e612bbf45644b17.tar.bz2
art-0dc242d6fc1254e6ca1c31e08e612bbf45644b17.zip
Avoid unnecessary copy/load in EvalLoc() and LoadValue().
EvalLoc()/EvalLocWide() are used to prepare a register where a value is subsequently stored, so they shouldn't copy the old value to the new register for register class mismatch. The only exception where we actually need a copy is LoadValue()/LoadValueWide(), so we inline the old code that makes the copy there. We also avoid loading inexpensive constants when the value is already in the register. Change-Id: I07519e9d4d9b3f7272233d196435f3035e4a3ca9
Diffstat (limited to 'compiler/dex/quick/ralloc_util.cc')
-rw-r--r--compiler/dex/quick/ralloc_util.cc6
1 files changed, 2 insertions, 4 deletions
diff --git a/compiler/dex/quick/ralloc_util.cc b/compiler/dex/quick/ralloc_util.cc
index ca9a3ab64f..04de286ae2 100644
--- a/compiler/dex/quick/ralloc_util.cc
+++ b/compiler/dex/quick/ralloc_util.cc
@@ -937,9 +937,8 @@ RegLocation Mir2Lir::EvalLocWide(RegLocation loc, int reg_class, bool update) {
/* If already in registers, we can assume proper form. Right reg class? */
if (loc.location == kLocPhysReg) {
if (!RegClassMatches(reg_class, loc.reg)) {
- /* Wrong register class. Reallocate and copy */
+ // Wrong register class. Reallocate and transfer ownership.
RegStorage new_regs = AllocTypedTempWide(loc.fp, reg_class);
- OpRegCopyWide(new_regs, loc.reg);
// Associate the old sreg with the new register and clobber the old register.
GetRegInfo(new_regs)->SetSReg(GetRegInfo(loc.reg)->SReg());
Clobber(loc.reg);
@@ -971,9 +970,8 @@ RegLocation Mir2Lir::EvalLoc(RegLocation loc, int reg_class, bool update) {
if (loc.location == kLocPhysReg) {
if (!RegClassMatches(reg_class, loc.reg)) {
- /* Wrong register class. Realloc, copy and transfer ownership */
+ // Wrong register class. Reallocate and transfer ownership.
RegStorage new_reg = AllocTypedTemp(loc.fp, reg_class);
- OpRegCopy(new_reg, loc.reg);
// Associate the old sreg with the new register and clobber the old register.
GetRegInfo(new_reg)->SetSReg(GetRegInfo(loc.reg)->SReg());
Clobber(loc.reg);