ARM frame creation tweaks.

Paul Brook paul@codesourcery.com
Wed Mar 12 18:59:00 GMT 2008


The attached patch reduces the size of ARM function prologue/epilogue 
sequences when an explicit stack adjustment can be avoided by adding more 
registers to existing load/store multiple instructions.

A single extra register will be pushed/popped to achieve a stack adjustment of 
4 bytes.  Typically this will be to maintain correct stack alignment.  On 
most cores pushing an extra word is no more expensive than the separate sub 
instruction, and on some cores it's effectively free, so we enable this all 
the time.

Additional call clobbered registers are pushed/popped in order to create a 
larger stack frame.  This can introduce a significant number of extra memory 
accesses, so is only enabled at -Os.

Tested on arm-none-eabi
Applied to svn trunk.

Paul

2008-03-12  Paul Brook  <paul@codesourcery.com>

	gcc/
	* config/arm/arm.c (use_return_insn): Use offsets->saved_regs_mask
	instead of {arm,thumb}_compute_save_reg_mask.
	(output_return_instruction): Ditto.
	(thumb_unexpanded_epilogue): Ditto.
	(thumb1_expand_prologue): Ditto.
	(thumb1_output_function_prologue): Ditto.
	(arm_set_return_address): Ditto.
	(thumb_set_return_address): Ditto.
	(arm_get_frame_offsets): Set offsets->saved_regs_mask.  Push extra
	regs to achieve stack alignment.
	(thumb1_compute_save_reg_mask): Fix compiler warning.
	(arm_output_epilogue): Use offsets->saved_regs_mask.
	Adjust stack pointer by poping call clobered registers.
	(arm_expand_prologue): Use offsets->saved_regs_mask.
	Adjust stack pointer by pushing extra registers.
	* gcc/config/arm.h (arm_stack_offsets): Add saved_regs_mask.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch
Type: text/x-diff
Size: 11117 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20080312/21b0842d/attachment.bin>


More information about the Gcc-patches mailing list