Lines Matching refs:v_reg
36 inline uint16_t GvnDeadCodeElimination::MIRData::PrevChange(int v_reg) const { in PrevChange()
38 DCHECK(v_reg == vreg_def || v_reg == vreg_def + 1); in PrevChange()
39 return (v_reg == vreg_def) ? prev_value.change : prev_value_high.change; in PrevChange()
42 inline void GvnDeadCodeElimination::MIRData::SetPrevChange(int v_reg, uint16_t change) { in SetPrevChange() argument
44 DCHECK(v_reg == vreg_def || v_reg == vreg_def + 1); in SetPrevChange()
45 if (v_reg == vreg_def) { in SetPrevChange()
52 inline void GvnDeadCodeElimination::MIRData::RemovePrevChange(int v_reg, MIRData* prev_data) { in RemovePrevChange() argument
53 DCHECK_NE(PrevChange(v_reg), kNPos); in RemovePrevChange()
54 DCHECK(v_reg == prev_data->vreg_def || v_reg == prev_data->vreg_def + 1); in RemovePrevChange()
55 if (vreg_def == v_reg) { in RemovePrevChange()
56 if (prev_data->vreg_def == v_reg) { in RemovePrevChange()
64 if (prev_data->vreg_def == v_reg) { in RemovePrevChange()
90 void GvnDeadCodeElimination::VRegChains::AddMIRWithDef(MIR* mir, int v_reg, bool wide, in AddMIRWithDef() argument
97 data->vreg_def = v_reg; in AddMIRWithDef()
99 DCHECK_LT(static_cast<size_t>(v_reg), num_vregs_); in AddMIRWithDef()
100 data->prev_value = vreg_data_[v_reg]; in AddMIRWithDef()
102 (vreg_data_[v_reg].change != kNPos) in AddMIRWithDef()
103 ? GetMIRData(vreg_data_[v_reg].change)->vreg_def + 1 == v_reg in AddMIRWithDef()
104 : vreg_high_words_.IsBitSet(v_reg); in AddMIRWithDef()
105 vreg_data_[v_reg].value = new_value; in AddMIRWithDef()
106 vreg_data_[v_reg].change = pos; in AddMIRWithDef()
107 vreg_high_words_.ClearBit(v_reg); in AddMIRWithDef()
110 DCHECK_LT(static_cast<size_t>(v_reg + 1), num_vregs_); in AddMIRWithDef()
111 data->prev_value_high = vreg_data_[v_reg + 1]; in AddMIRWithDef()
113 (vreg_data_[v_reg + 1].change != kNPos) in AddMIRWithDef()
114 ? GetMIRData(vreg_data_[v_reg + 1].change)->vreg_def == v_reg + 1 in AddMIRWithDef()
115 : !vreg_high_words_.IsBitSet(v_reg + 1); in AddMIRWithDef()
116 vreg_data_[v_reg + 1].value = new_value; in AddMIRWithDef()
117 vreg_data_[v_reg + 1].change = pos; in AddMIRWithDef()
118 vreg_high_words_.SetBit(v_reg + 1); in AddMIRWithDef()
179 void GvnDeadCodeElimination::VRegChains::InsertInitialValueHigh(int v_reg, uint16_t value) { in InsertInitialValueHigh() argument
181 DCHECK_LT(static_cast<size_t>(v_reg), num_vregs_); in InsertInitialValueHigh()
182 uint16_t change = vreg_data_[v_reg].change; in InsertInitialValueHigh()
184 vreg_data_[v_reg].value = value; in InsertInitialValueHigh()
185 vreg_high_words_.SetBit(v_reg); in InsertInitialValueHigh()
189 DCHECK(data->vreg_def == v_reg || data->vreg_def + 1 == v_reg); in InsertInitialValueHigh()
190 if (data->vreg_def == v_reg) { // Low word, use prev_value. in InsertInitialValueHigh()
210 void GvnDeadCodeElimination::VRegChains::UpdateInitialVRegValue(int v_reg, bool wide, in UpdateInitialVRegValue() argument
212 DCHECK_LT(static_cast<size_t>(v_reg), num_vregs_); in UpdateInitialVRegValue()
214 if (vreg_data_[v_reg].value == kNoValue) { in UpdateInitialVRegValue()
215 uint16_t old_value = lvn->GetStartingVregValueNumber(v_reg); in UpdateInitialVRegValue()
219 old_value = lvn->GetStartingVregValueNumberWide(v_reg); in UpdateInitialVRegValue()
221 InsertInitialValueHigh(v_reg + 1, old_value); in UpdateInitialVRegValue()
224 vreg_data_[v_reg].value = old_value; in UpdateInitialVRegValue()
225 DCHECK(!vreg_high_words_.IsBitSet(v_reg)); // Keep marked as low word. in UpdateInitialVRegValue()
228 DCHECK_LT(static_cast<size_t>(v_reg + 1), num_vregs_); in UpdateInitialVRegValue()
230 if (vreg_data_[v_reg].value == kNoValue) { in UpdateInitialVRegValue()
231 uint16_t old_value = lvn->GetStartingVregValueNumberWide(v_reg); in UpdateInitialVRegValue()
233 InsertInitialValueHigh(v_reg + 1, old_value); in UpdateInitialVRegValue()
238 old_value = lvn->GetStartingVregValueNumber(v_reg); in UpdateInitialVRegValue()
240 vreg_data_[v_reg].value = old_value; in UpdateInitialVRegValue()
241 DCHECK(!vreg_high_words_.IsBitSet(v_reg)); // Keep marked as low word. in UpdateInitialVRegValue()
243 if (check_high && vreg_data_[v_reg + 1].value == kNoValue) { in UpdateInitialVRegValue()
244 uint16_t old_value = lvn->GetStartingVregValueNumber(v_reg + 1); in UpdateInitialVRegValue()
245 if (old_value == kNoValue && static_cast<size_t>(v_reg + 2) < num_vregs_) { in UpdateInitialVRegValue()
247 old_value = lvn->GetStartingVregValueNumberWide(v_reg + 1); in UpdateInitialVRegValue()
249 InsertInitialValueHigh(v_reg + 2, old_value); in UpdateInitialVRegValue()
252 vreg_data_[v_reg + 1].value = old_value; in UpdateInitialVRegValue()
253 DCHECK(!vreg_high_words_.IsBitSet(v_reg + 1)); // Keep marked as low word. in UpdateInitialVRegValue()
258 inline uint16_t GvnDeadCodeElimination::VRegChains::LastChange(int v_reg) { in LastChange() argument
259 DCHECK_LT(static_cast<size_t>(v_reg), num_vregs_); in LastChange()
260 return vreg_data_[v_reg].change; in LastChange()
263 inline uint16_t GvnDeadCodeElimination::VRegChains::CurrentValue(int v_reg) { in CurrentValue() argument
264 DCHECK_LT(static_cast<size_t>(v_reg), num_vregs_); in CurrentValue()
265 return vreg_data_[v_reg].value; in CurrentValue()
268 uint16_t GvnDeadCodeElimination::VRegChains::FindKillHead(int v_reg, uint16_t cutoff) { in FindKillHead() argument
269 uint16_t current_value = this->CurrentValue(v_reg); in FindKillHead()
271 uint16_t change = LastChange(v_reg); in FindKillHead()
274 bool match_high_word = (mir_data_[change].vreg_def != v_reg); in FindKillHead()
277 DCHECK(data->vreg_def == v_reg || data->vreg_def + 1 == v_reg); in FindKillHead()
278 if (data->vreg_def == v_reg) { // Low word, use prev_value. in FindKillHead()
298 uint16_t GvnDeadCodeElimination::VRegChains::FindFirstChangeAfter(int v_reg, in FindFirstChangeAfter() argument
300 DCHECK_LT(static_cast<size_t>(v_reg), num_vregs_); in FindFirstChangeAfter()
303 uint16_t search_change = vreg_data_[v_reg].change; in FindFirstChangeAfter()
306 search_change = mir_data_[search_change].PrevChange(v_reg); in FindFirstChangeAfter()
315 for (int v_reg = old_data->vreg_def, end = old_data->vreg_def + count; v_reg != end; ++v_reg) { in ReplaceChange() local
316 uint16_t next_change = FindFirstChangeAfter(v_reg, old_change); in ReplaceChange()
318 DCHECK_EQ(vreg_data_[v_reg].change, old_change); in ReplaceChange()
319 vreg_data_[v_reg].change = new_change; in ReplaceChange()
320 DCHECK_EQ(vreg_high_words_.IsBitSet(v_reg), v_reg == old_data->vreg_def + 1); in ReplaceChange()
323 DCHECK_EQ(mir_data_[next_change].PrevChange(v_reg), old_change); in ReplaceChange()
324 mir_data_[next_change].SetPrevChange(v_reg, new_change); in ReplaceChange()
333 for (int v_reg = data->vreg_def, end = data->vreg_def + count; v_reg != end; ++v_reg) { in RemoveChange() local
334 uint16_t next_change = FindFirstChangeAfter(v_reg, change); in RemoveChange()
336 DCHECK_EQ(vreg_data_[v_reg].change, change); in RemoveChange()
337 vreg_data_[v_reg] = (data->vreg_def == v_reg) ? data->prev_value : data->prev_value_high; in RemoveChange()
338 DCHECK_EQ(vreg_high_words_.IsBitSet(v_reg), v_reg == data->vreg_def + 1); in RemoveChange()
339 if (data->vreg_def == v_reg && data->low_def_over_high_word) { in RemoveChange()
340 vreg_high_words_.SetBit(v_reg); in RemoveChange()
341 } else if (data->vreg_def != v_reg && data->high_def_over_low_word) { in RemoveChange()
342 vreg_high_words_.ClearBit(v_reg); in RemoveChange()
345 DCHECK_EQ(mir_data_[next_change].PrevChange(v_reg), change); in RemoveChange()
346 mir_data_[next_change].RemovePrevChange(v_reg, data); in RemoveChange()
376 int v_reg, MIRGraph* mir_graph) const { in IsVRegUsed() argument
382 if (mir_graph->SRegToVReg(ssa_rep->uses[i]) == v_reg) { in IsVRegUsed()
522 int v_reg = mir_graph_->SRegToVReg(s_reg); in CreatePhi() local
525 phi->dalvikInsn.vA = v_reg; in CreatePhi()
541 phi->ssa_rep->uses[idx] = pred_bb->data_flow_info->vreg_to_ssa_map_exit[v_reg]; in CreatePhi()
630 int v_reg = mir_graph_->SRegToVReg(data->mir->ssa_rep->uses[i]); in BackwardPassProcessLastMIR() local
631 unused_vregs_->ClearBit(v_reg); in BackwardPassProcessLastMIR()
988 for (int v_reg = data->vreg_def, end = data->vreg_def + count; v_reg != end; ++v_reg) { in BackwardPassTryToKillLastMIR() local
989 uint16_t kill_head = vreg_chains_.FindKillHead(v_reg, no_uses_all_since_); in BackwardPassTryToKillLastMIR()
993 kill_heads_[v_reg] = kill_head; in BackwardPassTryToKillLastMIR()
994 vregs_to_kill_->SetBit(v_reg); in BackwardPassTryToKillLastMIR()
1007 for (uint32_t v_reg : vregs_to_kill_->Indexes()) { in BackwardPassTryToKillLastMIR() local
1009 MIRData* data = vreg_chains_.GetMIRData(vreg_chains_.LastChange(v_reg)); in BackwardPassTryToKillLastMIR()
1011 if (data->vreg_def == v_reg) { in BackwardPassTryToKillLastMIR()
1012 MIRData* kill_head_data = vreg_chains_.GetMIRData(kill_heads_[v_reg]); in BackwardPassTryToKillLastMIR()
1013 RenameSRegDefOrCreatePhi(kill_head_data->PrevChange(v_reg), num_mirs, data->mir); in BackwardPassTryToKillLastMIR()
1015 DCHECK_EQ(data->vreg_def + 1u, v_reg); in BackwardPassTryToKillLastMIR()
1016 DCHECK_EQ(vreg_chains_.GetMIRData(kill_heads_[v_reg - 1u])->PrevChange(v_reg - 1u), in BackwardPassTryToKillLastMIR()
1017 vreg_chains_.GetMIRData(kill_heads_[v_reg])->PrevChange(v_reg)); in BackwardPassTryToKillLastMIR()
1055 int v_reg = mir_graph_->SRegToVReg(s_reg); in RecordMIR() local
1056 DCHECK_EQ(vreg_chains_.CurrentValue(v_reg), kNoValue); // No previous def for v_reg. in RecordMIR()
1058 DCHECK_EQ(vreg_chains_.CurrentValue(v_reg + 1), kNoValue); in RecordMIR()
1060 vreg_chains_.AddMIRWithDef(mir, v_reg, wide, new_value); in RecordMIR()
1444 int v_reg = mir_graph_->SRegToVReg(s_reg); in RecordMIR() local
1448 vreg_chains_.UpdateInitialVRegValue(v_reg, wide, lvn_); in RecordMIR()
1449 vreg_chains_.AddMIRWithDef(mir, v_reg, wide, new_value); in RecordMIR()