issues with first scheduling pass on SH4

Sanjiv Kumar Gupta, Noida sanjivg@noida.hcltech.com
Tue Jul 8 09:41:00 GMT 2003


> 1. Added in schedule_block() a (conditional) call to a function
> that selectively moves insns from Q to R:
> 
> 1- if (condition1)
> 2-   early_queue_to_ready();
> 
> The above code can be inserted either (1) when R becomes empty,
> right before giving up on scheduling additional instructions
> in the current cycle (i.e. before line 4),
> or (2) whenever new instructions maybe added into R,
> before R is sorted (before lines 2 and 9).
> 
> The "condition1" can be, in your case, something like:
>   (!reload_completed && INSN_REG_WEIGHT > threshold)
> 
This very well matches to what I was thinking to do. In
my case, an insn which reduces the register pressure might still
be available in the R but may not be at the head of R (i.e. may
not be the highest priority as the priority is based on critical
path). In that case I will simply have to reorder R to
put that desired insn at the head of the R so that choose_ready
can pick it.

> 2. Implemented early_queue_to_ready():
> 
> 1- for (insn = scan the queue in-order; ... ; ...){
> 2   - cost <- state_transition(insn) (and other checks);
> 3   - if (cost < 0 && ok_for_early_schedule(insn)){
> 4     - remove insn from Q, and add it to the ready list.
> 5     - if (condition2)
> 6          break;
> 7     }
> 8   }
> 
> (line 2 should be identical to line 6 in schedule_block() above,
> to avoid creating an infinite R->Q->R... loop).
> The "ok_for_early_schedule(insn)" can check, in your case,
> if insn reduces high register pressure.
> The "condition2" can restrict the number of instructions removed
> from the queue to one at a time, or more if desired.
> [...]
> Maybe this general scheme could fit your purposes too?
> 
> dorit
> 
Yes, this should be fine for me too.

The only problem I am currently facing is 
how to separately estimate register pressure for
various reg_classes like GENERAL_REGs
and FP_REGs. INSN_REG_WEIGHT does
distinguish between reg_classes.
I think I will have to write macros like
INSN_GENERAL_REG_WEIGHT, INSN_FP_REG_WEIGHT.

Sanjiv



More information about the Gcc mailing list