[AVR] PATCH COMMITTED: Stack pointer errors.

Anatoly Sokolov aesok@post.ru
Tue Mar 27 21:16:00 GMT 2007


Hi.

The 'lower-subreg' pass issued following problems for AVR target.
< http://gcc.gnu.org/ml/gcc-patches/2007-02/msg00002.html >

   * Result of work of this pass the insn in HImode: 
   (set (reg:HI r30) (reg:HI __SPH__ ))

   Can be replaced on two insns in QImode:
   (set (reg:QI r30) (reg:QI __SPH__ ))
   (set (reg:QI r31) (reg:QI __SPL__ ))

   For reading from stack pointer register in assembler code generated by 
   'movqi' insn for SP registers uses names '__SPH__' and '__SPL' __, 
   defined in REGISTER_NAMES macro, instead of '__SP_H__' and '__SP_L__'.
   That issued error in assembler code. 

   * Result of splitting the insn: 
   (set  ((reg:HI __SPH__ ) (reg:HI r30))

   in:
   (set (reg:QI __SPH__ ) (reg:QI r30))
   (set (reg:QI __SPL__ ) (reg:QI r31))

   Instead code:
	in  __tmp_reg__, __SREG__
	cli
	out __SP_H__, r30       
	out __SREG__, __tmp_reg__
	out __SP_L__, r31

   this code is generated:
	out __SP_H__, r30
	out __SP_L__, r31

   Therefore atomicity of writing in stack pointer register is lost.

This patch solves both problems. Commited.
	
2006-03-27  Anatoly Sokolov <aesok@post.ru>

	* config/avr/avr.c (avr_hard_regno_mode_ok): Disallow QImode in stack
	pointer regs.
	* config/avr/avr.h (REGISTER_NAMES): Rename "__SPL__" and "__SPH__"
	regs to "__SP_L__" and "__SP_H__".

Anatoly.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: avr_sp.txt
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20070327/11e830e9/attachment.txt>


More information about the Gcc-patches mailing list