Update counting VR for promotion
For 64-bit it makes sense to compute VR uses together for
int and long because core reg is shared.
Change-Id: Ie8676ece12c928d090da2465dfb4de4e91411920
Signed-off-by: Serguei Katkov <serguei.i.katkov@intel.com>
diff --git a/compiler/dex/quick/ralloc_util.cc b/compiler/dex/quick/ralloc_util.cc
index e8fc919..fa1c36e 100644
--- a/compiler/dex/quick/ralloc_util.cc
+++ b/compiler/dex/quick/ralloc_util.cc
@@ -1157,20 +1157,23 @@
int use_count = mir_graph_->GetUseCount(i);
if (loc.fp) {
if (loc.wide) {
- // Treat doubles as a unit, using upper half of fp_counts array.
- counts[p_map_idx + num_regs].count += use_count;
+ if (WideFPRsAreAliases()) {
+ // Floats and doubles can be counted together.
+ counts[p_map_idx].count += use_count;
+ } else {
+ // Treat doubles as a unit, using upper half of fp_counts array.
+ counts[p_map_idx + num_regs].count += use_count;
+ }
i++;
} else {
counts[p_map_idx].count += use_count;
}
} else if (!IsInexpensiveConstant(loc)) {
- if (loc.wide && cu_->target64) {
- // Treat long as a unit, using upper half of core_counts array.
- counts[p_map_idx + num_regs].count += use_count;
+ if (loc.wide && WideGPRsAreAliases()) {
+ // Longs and doubles can be counted together.
i++;
- } else {
- counts[p_map_idx].count += use_count;
}
+ counts[p_map_idx].count += use_count;
}
}
}