mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-03-06 16:30:42 +01:00
r300/compiler: In the peephole optimizer, ELSE should mark the end of a
block.
This commit is contained in:
parent
29a1d6aee7
commit
1732751242
1 changed files with 13 additions and 2 deletions
|
|
@ -75,6 +75,15 @@ struct peephole_state {
|
|||
int BranchDepth;
|
||||
};
|
||||
|
||||
/**
|
||||
* This is a callback function that is meant to be passed to
|
||||
* rc_for_all_reads_mask. This function will be called once for each source
|
||||
* register in inst.
|
||||
* @param inst The instruction that the source register belongs to.
|
||||
* @param file The register file of the source register.
|
||||
* @param index The index of the source register.
|
||||
* @param mask The components of the source register that are being read from.
|
||||
*/
|
||||
static void peephole_scan_read(void * data, struct rc_instruction * inst,
|
||||
rc_register_file file, unsigned int index, unsigned int mask)
|
||||
{
|
||||
|
|
@ -161,7 +170,8 @@ static void peephole(struct radeon_compiler * c, struct rc_instruction * inst_mo
|
|||
if (s.BranchDepth >= 0) {
|
||||
if (inst->U.I.Opcode == RC_OPCODE_IF) {
|
||||
s.BranchDepth++;
|
||||
} else if (inst->U.I.Opcode == RC_OPCODE_ENDIF) {
|
||||
} else if (inst->U.I.Opcode == RC_OPCODE_ENDIF
|
||||
|| inst->U.I.Opcode == RC_OPCODE_ELSE) {
|
||||
s.BranchDepth--;
|
||||
if (s.BranchDepth < 0) {
|
||||
s.DefinedMask &= ~s.MovMask;
|
||||
|
|
@ -208,7 +218,8 @@ static void peephole(struct radeon_compiler * c, struct rc_instruction * inst_mo
|
|||
if (s.BranchDepth >= 0) {
|
||||
if (inst->U.I.Opcode == RC_OPCODE_IF) {
|
||||
s.BranchDepth++;
|
||||
} else if (inst->U.I.Opcode == RC_OPCODE_ENDIF) {
|
||||
} else if (inst->U.I.Opcode == RC_OPCODE_ENDIF
|
||||
|| inst->U.I.Opcode == RC_OPCODE_ELSE) {
|
||||
s.BranchDepth--;
|
||||
if (s.BranchDepth < 0)
|
||||
break; /* no more readers after this point */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue