r300/vs: Reuse rc_match_bgnloop().

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14271>
This commit is contained in:
Emma Anholt 2021-12-20 11:28:36 -08:00 committed by Marge Bot
parent e41a53cd19
commit b48852436e

View file

@ -620,23 +620,8 @@ static void allocate_temporary_registers(struct radeon_compiler *c, void *user)
const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->U.I.Opcode);
/* Instructions inside of loops need to use the ENDLOOP
* instruction as their LastRead. */
if (!end_loop && inst->U.I.Opcode == RC_OPCODE_BGNLOOP) {
int endloops = 1;
struct rc_instruction * ptr;
for(ptr = inst->Next;
ptr != &compiler->Base.Program.Instructions;
ptr = ptr->Next){
if (ptr->U.I.Opcode == RC_OPCODE_BGNLOOP) {
endloops++;
} else if (ptr->U.I.Opcode == RC_OPCODE_ENDLOOP) {
endloops--;
if (endloops <= 0) {
end_loop = ptr;
break;
}
}
}
}
if (!end_loop && inst->U.I.Opcode == RC_OPCODE_BGNLOOP)
end_loop = rc_match_bgnloop(inst);
if (inst == end_loop) {
end_loop = NULL;