Avoid Cache*LoweringInfo pass when there's no GET/PUT/INVOKE.
Add new data flow flags indicating instance/static field
access. Record merged flags of all insns and use them to skip
the CacheFieldLoweringInfo pass if the method uses no fields
and the CacheMethodLoweringInfo pass if it has no invokes.
Change-Id: I36a36b438ca9b0f104a7baddc0497d736495cc3c
diff --git a/compiler/dex/mir_graph.cc b/compiler/dex/mir_graph.cc
index 0b50e2f..8bb5615 100644
--- a/compiler/dex/mir_graph.cc
+++ b/compiler/dex/mir_graph.cc
@@ -88,6 +88,7 @@
num_non_special_compiler_temps_(0),
max_available_non_special_compiler_temps_(0),
punt_to_interpreter_(false),
+ merged_df_flags_(0u),
ifield_lowering_infos_(arena, 0u),
sfield_lowering_infos_(arena, 0u),
method_lowering_infos_(arena, 0u) {
@@ -598,9 +599,11 @@
entry_block_->fall_through = cur_block->id;
cur_block->predecessors->Insert(entry_block_->id);
- /* Identify code range in try blocks and set up the empty catch blocks */
+ /* Identify code range in try blocks and set up the empty catch blocks */
ProcessTryCatchBlocks();
+ uint64_t merged_df_flags = 0u;
+
/* Parse all instructions and put them into containing basic blocks */
while (code_ptr < code_end) {
MIR *insn = static_cast<MIR *>(arena_->Alloc(sizeof(MIR), kArenaAllocMIR));
@@ -617,6 +620,7 @@
int verify_flags = Instruction::VerifyFlagsOf(insn->dalvikInsn.opcode);
uint64_t df_flags = oat_data_flow_attributes_[insn->dalvikInsn.opcode];
+ merged_df_flags |= df_flags;
if (df_flags & DF_HAS_DEFS) {
def_count_ += (df_flags & DF_A_WIDE) ? 2 : 1;
@@ -715,6 +719,7 @@
cur_block = next_block;
}
}
+ merged_df_flags_ = merged_df_flags;
if (cu_->enable_debug & (1 << kDebugDumpCFG)) {
DumpCFG("/sdcard/1_post_parse_cfg/", true);