[AVR, Committed] 'main' as normal function

Anatoly Sokolov aesok@post.ru
Fri Oct 26 21:43:00 GMT 2007


Hello.

Currently, the AVR back-end handles the 'main' function differently from
other functions. 'main' has special versions of the prologue and epilogue
and it should be called by a 'jmp' instruction. This patch makes 'main' a
normal function.

Also, this patch adds an 'OS_task' attribute to the AVR port. Functions with
'OS_task' attribute do not save any "call-saved" registers, requiring less
stack space. Such functions should only be called from assembler routines.
This attribute is typically used for the 'main' function.

2007-10-27  Anatoly Sokolov <aesok@post.ru>

	* config/avr/avr.c (avr_OS_task_function_p): Add new function.
	(avr_regs_to_save): Handle functions with 'OS_task' attribute.
	(avr_simple_epilogue, expand_prologue, avr_asm_function_end_prologue,
	expand_epilogue, output_movhi): Don't handle 'main' function.
	(avr_attribute_table): Add 'OS_task' function attribute.
	* config/avr/avr.h (machine_function): Remove 'is_main' field, add
	'is_OS_task' field.
	* config/avr/avr.md (return_from_main_epilogue): Remove insn.
	(return_from_epilogue, return_from_interrupt_epilogue): Don't handle
	'main' function.
	* config/avr/avr.opt (minit-stack): Remove.

Anatoly.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.diff
Type: application/octet-stream
Size: 21270 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20071026/e393ff0f/attachment.obj>


More information about the Gcc-patches mailing list