I'm porting GCC 4.1.1 to a VLIW processor.
The processor couldn't solve any hazards itself so we should insert explicit 
NOPs after insn scheduling.
I have implemented this functionality in the hook 
`TARGET_MACHINE_DEPENDENT_REORG' (pass 52: mach).
Then I noticed that the pass 56 (split3) will eliminate some insns and generate 
new structural/data hazards.
For example, I have the following insns after performing pass 54 (barriers):
(insn 3489 3488 3515 (set (reg:SI 32 d0 [orig:143 D.4405 ] [143])
       (mem/s/j:SI (reg/f:SI 3 r3 [2801]) [0 M0 S4 A32])) 19 {*movsi} 
(insn_list:REG_DEP_TRUE 3488 (insn_list:REG_DEP_ANTI 3534 (n
   (nil))

(insn 3515 3489 3522 (set (reg:QI 5 r5 [2825])
       (reg:QI 5 r5 [2824])) 22 {movqi} (insn_list:REG_DEP_TRUE 3514 (nil))
   (nil))

(insn 3522 3515 5167 (set (reg:QI 8 r8 [2831])
       (reg:QI 4 r4 [2830])) 22 {movqi} (insn_list:REG_DEP_TRUE 3521 (nil))
   (nil))

(insn 5167 3522 3496 (set (reg:SI 11 r11)
       (reg:SI 32 d0 [orig:143 D.4405 ] [143])) 19 {*movsi} (nil)
   (nil))

The pipeline description for insn 3489 is (r0, nothing*4, cross_write).
The pipeline description for insn 5167 is (r0, cross_read, cross_write).
They have been scheduled to avoid reserving `cross_write' at the same time.
Unfortunately, the insn 3515 will be eliminated by a later pass (pass 56: split3) and they will reserve `cross_write' at the same time.

Because I need to use the feature of `length' attribute (i.e., use 
get_attr_length() in machine description),
I have to insert NOPs explicitly before performing the pass 58 (shorten) such that the shorten pass can calculate the length of insns exactly.
Can I direct move the reorg pass to the under of shorten pass by modifying the 
passes.c?

Thanks a lot.

Reply via email to