[m68k] Convert to peephole2, fixing -fomit-frame-pointer.

Paul Brook paul@codesourcery.com
Sun Dec 18 03:19:00 GMT 2005


The attached patch converts the define_peephole patterns in m68k.md into 
define_peephole2. This has the nice side-effect of fixing dwarf stack unwind 
information with -fomit-frame pointer. Under some circumstances we generate 
the following RTL (increment stack pointer followed by push).

(set (reg/f:SI 15 %sp)
     (plus:SI (reg/f:SI 15 %sp)
              (const_int 8 [0x8]))) 
(set (mem/f/i:SI (pre_dec:SI (reg/f:SI 15 %sp)) [0 S4 A16])
     (const_int 0 [0x0]))

Currently this matches a define_peephole, so dwarf2out.c sees:

(parallel [
  (const_int 8 [0x8])
  (mem/f/i:SI (pre_dec:SI (reg/f:SI 15 %sp)) [0 S4 A16])
  (const_int 0 [0x0])])

The predecrement addressing mode is still there, but not the stack adjustment.
Converting to peephole2 means the semantics remain explicit in the RTL, and 
everything is happy.

I've left the last peephole untouched. I don't really understand that it's 
doing, and it doesn't touch the stack.

The ugly bit of the patch is the new unspec.  This is needed because the 
constraints on the movsi pattern carefully prohibit
  move.l #small_const, (%sp)
forcing it to be split into moveq, move.l reg. By the time we run peephole's 
it's too late to generate the scratch register for this. I guess the other 
option is to add something to the instruction condition to only match these 
patterns when reload_completed, like other targets do for mem->mem moves. I 
couldn't convince myself this was safe and wouldn't effect existing code 
generation. I guess I could try harder if the unspec is considered too ugly.

Tested on m68k-elf.
Ok?

Paul

2005-12-18  Paul Brook  <paul@codesourcery.com>

	* config/m68k/m68k.md: Convert define_peephole to define_peephole2.
	(UNSPEC_MOVEQ_MEM): New constant.
	(movsi_smallconst): New pattern.
	* config/m68k/m68k.h (HARD_FP_REG_P): Define.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.m68k_peephole2
Type: text/x-diff
Size: 9817 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20051218/87096644/attachment.bin>


More information about the Gcc-patches mailing list