This is the mail archive of the gcc@gcc.gnu.org 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]

[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


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