Why reload make bad code?

Wang Xiaowu wkkii@163.com
Mon Dec 23 09:43:00 GMT 2002


Hello, 
 
I am writing gcc backend for a RISC arch, and I have some troubles.
The question will happend when compile with optimization and function have many local variables.
 
 below is insns before reload/global_alloc call
 ...
 (insn:HI 4 3 15 0 (nil) (set (reg/v/f:SI 39)
         (mem/f:SI (plus:SI (reg/f:SI 2 %ap)
                 (const_int 4 [0x4])) [2 S+0 S4 A32])) 2 {*zkrisc.md:141} (nil)
     (expr_list:REG_EQUIV (mem/f:SI (plus:SI (reg/f:SI 2 %ap)
                 (const_int 4 [0x4])) [2 S+0 S4 A32])
         (nil)))
 ...
 (insn:HI 16 15 17 0 0x4001d370 (set (reg/v:SI 40)
         (mem/s:SI (plus:SI (reg/v/f:SI 39)
                 (const_int 16 [0x10])) [4 <variable>._wds+0 S4 A32])) 2 {*zkrisc.md:141} (insn_list 4 (nil))
     (nil))
 ...
 
 BUT after reload/global_alloc, It generate bad code.
 
 ...
 (insn:HI 16 15 387 0 0x4001d370 (set (reg:SI 28 %r12)
         (mem/s:SI (plus:SI (mem/f:SI (plus:SI (reg/f:SI 7 %sp)
                         (const_int 76 [0x54])) [2 S+0 S4 A32])
                 (const_int 16 [0x10])) [4 <variable>._wds+0 S4 A32])) 2 {*zkrisc.md:141} (insn_list 4 (nil))
     (nil))
 ...
 
 below is some information:
  %ap is arg pointer register, it will be eliminated by %fp or %sp.
      In this function: (%ap + 4) == (%sp + 76)
  FIRST_PSEUDO_REGISTER is 32.
  all outgoing args store in stack
  (plus (REG) (CONST_INT)) is legitimate addres,
  (set (REG) (MEM (plus (REG) (CONST_INT)))) is legitimated also.
  gcc version is 3.3(2002/12/16)

I tried to find the reason, but I failed. I need your help, please tell me what's the matter? 
(Maybe the information is not enough, tell me if it is)

 --
Your's Sincerely,
 



More information about the Gcc mailing list