This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: NOPs inserting problem in GCC 4.1.x


The example of previous post was wrong.
I just corrected it in this post.
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 (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))

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

(insn 7984 3522 5167 (const_int 0 [0x0]) 147 {nop} (nil)

(insn 5167 7984 7683 (set (reg:SI 11 r11)
       (reg:SI 32 d0 [orig:143 D.4405 ] [143])) 19 {*movsi} (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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]