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

[AVR, Committed] 'main' as normal function


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.

Attachment: main.diff
Description: Binary data


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