From c7d1f91e024c5c560810376340aecb39d4e47fdc Mon Sep 17 00:00:00 2001 From: buzbee Date: Thu, 7 Feb 2013 15:22:39 -0800 Subject: Codegen tweaks Minor codegen cleanup. Most significant part of change is fixing dalvik register use counting to correctly record cost of high word of register pair. Significant boost to Reversi benchmark; modest gain for Caffeinemark. Change-Id: I41819e6d7be93e62d259240269339a94a934f312 --- src/compiler/codegen/ralloc_util.cc | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'src/compiler/codegen/ralloc_util.cc') diff --git a/src/compiler/codegen/ralloc_util.cc b/src/compiler/codegen/ralloc_util.cc index 1d5f3aca86..3a3aeba332 100644 --- a/src/compiler/codegen/ralloc_util.cc +++ b/src/compiler/codegen/ralloc_util.cc @@ -1082,27 +1082,22 @@ RegLocation GetSrcWide(CompilationUnit* cu, MIR* mir, static void CountRefs(CompilationUnit *cu, BasicBlock* bb, RefCounts* core_counts, RefCounts* fp_counts) { + // TUNING: this routine could use some tweaking. if ((cu->disable_opt & (1 << kPromoteRegs)) || !((bb->block_type == kEntryBlock) || (bb->block_type == kExitBlock) || (bb->block_type == kDalvikByteCode))) { return; } - for (int i = 0; i < cu->num_ssa_regs;) { + for (int i = 0; i < cu->num_ssa_regs; i++) { RegLocation loc = cu->reg_location[i]; RefCounts* counts = loc.fp ? fp_counts : core_counts; int p_map_idx = SRegToPMap(cu, loc.s_reg_low); //Don't count easily regenerated immediates - if (loc.fp || loc.wide || !IsInexpensiveConstant(cu, loc)) { - counts[p_map_idx].count += cu->use_counts.elem_list[i]; + if (loc.fp || !IsInexpensiveConstant(cu, loc)) { + counts[p_map_idx].count += cu->raw_use_counts.elem_list[i]; } - if (loc.wide) { - if (loc.fp) { - counts[p_map_idx].double_start = true; - counts[p_map_idx+1].count += cu->use_counts.elem_list[i+1]; - } - i += 2; - } else { - i++; + if (loc.wide && loc.fp && !loc.high_word) { + counts[p_map_idx].double_start = true; } } } -- cgit v1.2.3-59-g8ed1b