diff options
author | Razvan A Lupusoru <razvan.a.lupusoru@intel.com> | 2014-06-06 17:04:52 -0700 |
---|---|---|
committer | Razvan A Lupusoru <razvan.a.lupusoru@intel.com> | 2014-08-26 18:36:46 -0700 |
commit | 8d0d03e24325463f0060abfd05dba5598044e9b1 (patch) | |
tree | 06e8ed7e47a4cfe108d4ed750de6a60e588b2f7a /compiler/dex/quick/codegen_util.cc | |
parent | 709368e616791209b02d39adb6da5e55782cb45f (diff) | |
download | art-8d0d03e24325463f0060abfd05dba5598044e9b1.tar.gz art-8d0d03e24325463f0060abfd05dba5598044e9b1.tar.bz2 art-8d0d03e24325463f0060abfd05dba5598044e9b1.zip |
ART: Change temporaries to positive names
Changes compiler temporaries to have positive names. The numbering now
puts them above the code VRs (locals + ins, in that order). The patch also
introduces APIs to query the number of temporaries, locals and ins.
The compiler temp infrastructure suffered from several issues
which are also addressed by this patch:
-There is no longer a queue of compiler temps. This would be polluted
with Method* when post opts were called multiple times.
-Sanity checks have been added to allow requesting of temps from BE
and to prevent temps after frame is committed.
-None of the structures holding temps can overflow because they are
allocated to allow holding maximum temps. Thus temps can be requested
by BE with no problem.
-Since the queue of compiler temps is no longer maintained, it is no
longer possible to refer to a temp that has invalid ssa (because it
was requested before ssa was run).
-The BE can now request temps after all ME allocations and it is guaranteed
to actually receive them.
-ME temps are now treated like normal VRs in all cases with no special
handling. Only the BE temps are handled specially because there are no
references to them from MIRs.
-Deprecated and removed several fields in CompilationUnit that saved
register information and updated callsites to call the new interface from
MIRGraph.
Change-Id: Ia8b1fec9384a1a83017800a59e5b0498dfb2698c
Signed-off-by: Razvan A Lupusoru <razvan.a.lupusoru@intel.com>
Signed-off-by: Udayan Banerji <udayan.banerji@intel.com>
Diffstat (limited to 'compiler/dex/quick/codegen_util.cc')
-rw-r--r-- | compiler/dex/quick/codegen_util.cc | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/compiler/dex/quick/codegen_util.cc b/compiler/dex/quick/codegen_util.cc index ebebe70462..08e1c1aa5a 100644 --- a/compiler/dex/quick/codegen_util.cc +++ b/compiler/dex/quick/codegen_util.cc @@ -268,8 +268,8 @@ void Mir2Lir::DumpLIRInsn(LIR* lir, unsigned char* base_addr) { } void Mir2Lir::DumpPromotionMap() { - int num_regs = cu_->num_dalvik_registers + mir_graph_->GetNumUsedCompilerTemps(); - for (int i = 0; i < num_regs; i++) { + uint32_t num_regs = mir_graph_->GetNumOfCodeAndTempVRs(); + for (uint32_t i = 0; i < num_regs; i++) { PromotionMap v_reg_map = promotion_map_[i]; std::string buf; if (v_reg_map.fp_location == kLocPhysReg) { @@ -277,12 +277,13 @@ void Mir2Lir::DumpPromotionMap() { } std::string buf3; - if (i < cu_->num_dalvik_registers) { + if (i < mir_graph_->GetNumOfCodeVRs()) { StringAppendF(&buf3, "%02d", i); - } else if (i == mir_graph_->GetMethodSReg()) { + } else if (i == mir_graph_->GetNumOfCodeVRs()) { buf3 = "Method*"; } else { - StringAppendF(&buf3, "ct%d", i - cu_->num_dalvik_registers); + uint32_t diff = i - mir_graph_->GetNumOfCodeVRs(); + StringAppendF(&buf3, "ct%d", diff); } LOG(INFO) << StringPrintf("V[%s] -> %s%d%s", buf3.c_str(), @@ -313,9 +314,9 @@ void Mir2Lir::CodegenDump() { LIR* lir_insn; int insns_size = cu_->code_item->insns_size_in_code_units_; - LOG(INFO) << "Regs (excluding ins) : " << cu_->num_regs; - LOG(INFO) << "Ins : " << cu_->num_ins; - LOG(INFO) << "Outs : " << cu_->num_outs; + LOG(INFO) << "Regs (excluding ins) : " << mir_graph_->GetNumOfLocalCodeVRs(); + LOG(INFO) << "Ins : " << mir_graph_->GetNumOfInVRs(); + LOG(INFO) << "Outs : " << mir_graph_->GetNumOfOutVRs(); LOG(INFO) << "CoreSpills : " << num_core_spills_; LOG(INFO) << "FPSpills : " << num_fp_spills_; LOG(INFO) << "CompilerTemps : " << mir_graph_->GetNumUsedCompilerTemps(); @@ -1117,7 +1118,8 @@ size_t Mir2Lir::GetNumBytesForCompilerTempSpillRegion() { // By default assume that the Mir2Lir will need one slot for each temporary. // If the backend can better determine temps that have non-overlapping ranges and // temps that do not need spilled, it can actually provide a small region. - return (mir_graph_->GetNumUsedCompilerTemps() * sizeof(uint32_t)); + mir_graph_->CommitCompilerTemps(); + return mir_graph_->GetNumBytesForSpecialTemps() + mir_graph_->GetMaximumBytesForNonSpecialTemps(); } int Mir2Lir::ComputeFrameSize() { @@ -1125,7 +1127,8 @@ int Mir2Lir::ComputeFrameSize() { uint32_t size = num_core_spills_ * GetBytesPerGprSpillLocation(cu_->instruction_set) + num_fp_spills_ * GetBytesPerFprSpillLocation(cu_->instruction_set) + sizeof(uint32_t) // Filler. - + (cu_->num_regs + cu_->num_outs) * sizeof(uint32_t) + + mir_graph_->GetNumOfLocalCodeVRs() * sizeof(uint32_t) + + mir_graph_->GetNumOfOutVRs() * sizeof(uint32_t) + GetNumBytesForCompilerTempSpillRegion(); /* Align and set */ return RoundUp(size, kStackAlignment); |