[m68k] register renaming not properly tracking used registers

C Jaiprakash, Noida cjaiprakash@hcltech.com
Mon Oct 18 19:36:00 GMT 2004


Hi,
  Isn't it because a0,and a1 are defined as CALL_USED_REGISTERS? This is the
documentation for CALL_USED_REGISTERS in gcc internals doc.

"If a register has 0 in CALL_USED_REGISTERS, the compiler automatically
saves it on function entry and restores it on function exit, if the register
is used within the function"

Thanks and best regards,
C Jaiprakash
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Contributing to the World by creating indispensable value !

System Software CoE @ HCLT-Noida
http://www.hcltechnologies.com
Ph. : +91-120-2510701/702 Ext : 3170
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



> -----Original Message-----
> From: gcc-owner@gcc.gnu.org [mailto:gcc-owner@gcc.gnu.org]On Behalf Of
> Peter Barada
> Sent: Monday, October 18, 2004 2:02 AM
> To: gcc@gcc.gnu.org
> Subject: [m68k] register renaming not properly tracking used registers
> 
> 
> 
> I'm trying to debug a problem in gcc-3.4.2 for --target=m68k-elf where
> I have an interrupt handler that when compiled fails to save all the
> registers that are modified by the function.  When compiled with -O3
> -m528x , the function produces:
> 
> QADC_Queue2CompleteIsrTest:
> 	link.w %a6,#-12
> 	movm.l #0x7,(%sp)
> 	move.w __IPSBAR+1638416,%d2
> 	tst.b u8FrontSensorIsHigh
> 	jbne .L9
> 	move.w __IPSBAR+1639060,%a0
> 
> Note that %a0 is modified, but not save in the movl instruction.
> 
> The problem seems to be in the register renaming pass which takes the
> following insns:
> 
> 
> (insn 15 102 16 1 (set (reg:HI 0 %d0 [34])
>         (mem/v:HI (const:SI (plus:SI (symbol_ref:SI 
> ("__IPSBAR") [flags 0x40] <var_decl 0x400d406c __IPSBAR>)
>                     (const_int 1639060 [0x190294]))) [2 S2 
> A16])) 29 {*m68k.md:790} (nil)
>     (nil))
> 
> (note 16 15 17 1 NOTE_INSN_DELETED)
> 
> (note 17 16 18 1 NOTE_INSN_DELETED)
> 
> (insn 18 17 19 1 (set (reg:SI 0 %d0 [36])
>         (zero_extend:SI (reg:HI 0 %d0 [34]))) 53 
> {*m68k.md:1335} (insn_list 15 (nil))
>     (nil))
> 
> and renames the register from %d0 to %a0:
> 
> Basic block 1:
> Closing chain %d0 at insn 18 (terminate_write)
> Closing chain %d1 at insn 21 (terminate_dead)
> Closing chain %d0 at insn 21 (terminate_dead)
> Register %d0 (1): 18 [DATA_REGS] 21 [GENERAL_REGS]
> Register %d1 (1): 20 [DATA_REGS] 21 [GENERAL_REGS]
> Register %d0 (1): 15 [GENERAL_REGS] 18 [GENERAL_REGS]
> Register %d0 in insn 21; no available better choice
> Register %d1 in insn 21; no available better choice
> Register %d0 in insn 18, renamed as %a0
> 
> 
> (insn 15 102 16 1 (set (reg:HI 8 %a0 [34])
>         (mem/v:HI (const:SI (plus:SI (symbol_ref:SI 
> ("__IPSBAR") [flags 0x40] <var_decl 0x400d406c __IPSBAR>)
>                     (const_int 1639060 [0x190294]))) [2 S2 
> A16])) 29 {*m68k.md:790} (nil)
>     (nil))
> 
> (note 16 15 17 1 NOTE_INSN_DELETED)
> 
> (note 17 16 18 1 NOTE_INSN_DELETED)
> 
> (insn 18 17 19 1 (set (reg:SI 0 %d0 [36])
>         (zero_extend:SI (reg:HI 8 %a0 [34]))) 53 
> {*m68k.md:1335} (insn_list 15 (nil))
>     (expr_list:REG_DEAD (reg:HI 8 %a0 [34])
>         (nil)))
> 
> 
> But appearently doesn't indicate via regs_ever_live or 
> call_used that the register
> is live, so the m68k_save_regs function fails to save it.  Where in
> the code should I look to track this problem down?
> 
> Any help is appreciated
> 
> -- 
> Peter Barada
> peter@the-baradas.com
> 



More information about the Gcc mailing list