From 4ef3e45d7c6ec3c482a1a48f4df470811aa3cf0a Mon Sep 17 00:00:00 2001 From: buzbee Date: Fri, 14 Dec 2012 13:35:28 -0800 Subject: Compiler constant handling rework In preparation for de-optimization, reworked the constant handling mechanism. Also took advantage of knowledge of constant operands (particularly for long operations). Significant performance improvements for Mandelbrot (~60 seconds to ~34 seconds). Minor improvements in other benchmarks. The new constant handling breaks two of the existing optimization passes: "Skip Large Method" and "Load/Store Elimization." I don't intend to update the large method optimization because it will be superceeded by the upcoming interpreter/ fingerprinting mechanism. Leaving the code in place for now in order to compare compile-time improvements with fingerprinting/interpret. All related code will be deleted when that is complete. The load/store elimination pass needs some rework to handle uses of multiple-register loads and stores. It will be updated & restored in a future CL. Change-Id: Ia979abaf51b8ae81bbb0428031cbcea854625fac --- src/compiler/codegen/ralloc_util.cc | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 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 afd49768d0..1d5f3aca86 100644 --- a/src/compiler/codegen/ralloc_util.cc +++ b/src/compiler/codegen/ralloc_util.cc @@ -64,7 +64,7 @@ void CompilerInitPool(RegisterInfo* regs, int* reg_nums, int num) } } -static void DumpRegPool(RegisterInfo* p, int num_regs) +void DumpRegPool(RegisterInfo* p, int num_regs) { LOG(INFO) << "================================================"; for (int i = 0; i < num_regs; i++) { @@ -1091,21 +1091,14 @@ static void CountRefs(CompilationUnit *cu, BasicBlock* bb, RefCounts* core_count RegLocation loc = cu->reg_location[i]; RefCounts* counts = loc.fp ? fp_counts : core_counts; int p_map_idx = SRegToPMap(cu, loc.s_reg_low); - int sample_reg = loc.fp ? cu->reg_pool->FPRegs[0].reg : cu->reg_pool->core_regs[0].reg; - bool simple_immediate = loc.is_const && - !cu->cg->InexpensiveConstant(sample_reg, cu->constant_values[loc.orig_sreg]); - if (loc.defined) { - // Don't count easily regenerated immediates - if (!simple_immediate) { - counts[p_map_idx].count += cu->use_counts.elem_list[i]; - } + //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.wide) { - if (loc.defined) { - if (loc.fp && !simple_immediate) { - counts[p_map_idx].double_start = true; - counts[p_map_idx+1].count += cu->use_counts.elem_list[i+1]; - } + 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 { -- cgit v1.2.3-59-g8ed1b