Lines Matching defs:cursor
199 DownwardsCursor cursor(current_idx, register_demand[current_idx]);
200 cursor.verify_invariants(register_demand);
201 return cursor;
208 MoveState::downwards_move(DownwardsCursor& cursor, bool add_to_clause)
210 aco_ptr<Instruction>& instr = block->instructions[cursor.source_idx];
236 const int dest_insert_idx = add_to_clause ? cursor.insert_idx_clause : cursor.insert_idx;
237 RegisterDemand register_pressure = cursor.total_demand;
239 register_pressure.update(cursor.clause_demand);
255 move_element(block->instructions.begin(), cursor.source_idx, dest_insert_idx);
258 move_element(register_demand, cursor.source_idx, dest_insert_idx);
259 for (int i = cursor.source_idx; i < dest_insert_idx - 1; i++)
262 cursor.insert_idx_clause--;
263 if (cursor.source_idx != cursor.insert_idx_clause) {
265 cursor.total_demand -= candidate_diff;
267 assert(cursor.total_demand == RegisterDemand{});
270 cursor.clause_demand.update(new_demand);
272 cursor.clause_demand -= candidate_diff;
273 cursor.insert_idx--;
276 cursor.source_idx--;
277 cursor.verify_invariants(register_demand);
282 MoveState::downwards_skip(DownwardsCursor& cursor)
284 aco_ptr<Instruction>& instr = block->instructions[cursor.source_idx];
295 cursor.total_demand.update(register_demand[cursor.source_idx]);
296 cursor.source_idx--;
297 cursor.verify_invariants(register_demand);
335 MoveState::upwards_check_deps(UpwardsCursor& cursor)
337 aco_ptr<Instruction>& instr = block->instructions[cursor.source_idx];
346 MoveState::upwards_update_insert_idx(UpwardsCursor& cursor)
348 cursor.insert_idx = cursor.source_idx;
349 cursor.total_demand = register_demand[cursor.insert_idx];
353 MoveState::upwards_move(UpwardsCursor& cursor)
355 assert(cursor.has_insert_idx());
357 aco_ptr<Instruction>& instr = block->instructions[cursor.source_idx];
373 if (RegisterDemand(cursor.total_demand + candidate_diff).exceeds(max_registers))
375 const RegisterDemand temp2 = get_temp_registers(block->instructions[cursor.insert_idx - 1]);
377 register_demand[cursor.insert_idx - 1] - temp2 + candidate_diff + temp;
382 move_element(block->instructions.begin(), cursor.source_idx, cursor.insert_idx);
385 move_element(register_demand, cursor.source_idx, cursor.insert_idx);
386 register_demand[cursor.insert_idx] = new_demand;
387 for (int i = cursor.insert_idx + 1; i <= cursor.source_idx; i++)
389 cursor.total_demand += candidate_diff;
391 cursor.total_demand.update(register_demand[cursor.source_idx]);
393 cursor.insert_idx++;
394 cursor.source_idx++;
396 cursor.verify_invariants(register_demand);
402 MoveState::upwards_skip(UpwardsCursor& cursor)
404 if (cursor.has_insert_idx()) {
405 aco_ptr<Instruction>& instr = block->instructions[cursor.source_idx];
414 cursor.total_demand.update(register_demand[cursor.source_idx]);
417 cursor.source_idx++;
419 cursor.verify_invariants(register_demand);
661 DownwardsCursor cursor = ctx.mv.downwards_init(idx, false, false);
666 assert(candidate_idx == cursor.source_idx);
681 (cursor.insert_idx - cursor.source_idx > (ctx.num_waves * 4) ||
703 ctx.mv.downwards_skip(cursor);
707 MoveResult res = ctx.mv.downwards_move(cursor, false);
710 ctx.mv.downwards_skip(cursor);
804 DownwardsCursor cursor = ctx.mv.downwards_init(idx, true, true);
808 assert(candidate_idx == cursor.source_idx);
825 int grab_dist = cursor.insert_idx_clause - candidate_idx;
840 int clause_size = cursor.insert_idx - cursor.insert_idx_clause;
865 ctx.mv.downwards_skip(cursor);
870 MoveResult res = ctx.mv.downwards_move(cursor, part_of_clause);
876 ctx.mv.downwards_skip(cursor);
884 ctx.mv.downwards_skip(cursor);
967 DownwardsCursor cursor = ctx.mv.downwards_init(idx, true, false);
989 ctx.mv.downwards_skip(cursor);
993 MoveResult res = ctx.mv.downwards_move(cursor, false);
996 ctx.mv.downwards_skip(cursor);