Bug 50887 - [avr] Support ACCUMULATE_OUTGOING_ARGS
Summary: [avr] Support ACCUMULATE_OUTGOING_ARGS
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.7.0
: P4 enhancement
Target Milestone: 4.7.0
Assignee: Georg-Johann Lay
URL:
Keywords: missed-optimization
Depends on:
Blocks:
 
Reported: 2011-10-27 17:57 UTC by Georg-Johann Lay
Modified: 2012-01-20 12:33 UTC (History)
1 user (show)

See Also:
Host:
Target: avr
Build:
Known to work:
Known to fail:
Last reconfirmed: 2011-10-27 00:00:00


Attachments
aoa.c (264 bytes, text/plain)
2011-10-27 18:01 UTC, Georg-Johann Lay
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Georg-Johann Lay 2011-10-27 17:57:55 UTC
Supporting accumulate outgoing arguments can reduce code size in functions that call functions which get their arguments on the stack more than once (statically).
Comment 1 Georg-Johann Lay 2011-10-27 18:01:17 UTC
Created attachment 25636 [details]
aoa.c

C source file that has several call to printf-ish function.

With the current implementation, after each call the code must get rid of the pushed arguments which is expensive as SP cannot be modified directly.

Compile with, e.g., 

$ avr-gcc aoa.c -S -Os -mmcu=avr4
Comment 2 Georg-Johann Lay 2011-10-29 14:36:05 UTC
Author: gjl
Date: Sat Oct 29 14:35:59 2011
New Revision: 180654

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=180654
Log:
	PR target/50887
	* config/avr/avr.opt (-maccumulate-args): New option.
	* config/avr/avr.h (STARTING_FRAME_OFFSET): Redefine to
	avr_starting_frame_offset.
	(ACCUMULATE_OUTGOING_ARGS): Define to avr_accumulate_outgoing_args.
	* config/avr/avr.md (UNSPECV_WRITE_SP_IRQ_ON): Remove.
	(UNSPECV_WRITE_SP_IRQ_OFF): Remove.
	(UNSPECV_WRITE_SP): New constant.
	(*addhi3_sp_R): Rewrite to...
	(*addhi3_sp): ...this new insn.
	(movhi_sp_r_irq_off, movhi_sp_r_irq_on): Combine to...
	(movhi_sp_r): ...this new insn.
	* config/avr/avr-protos.h (avr_accumulate_outgoing_args): New.
	(avr_starting_frame_offset): New.
	* config/avr/avr.c (avr_accumulate_outgoing_args): New function.
	(avr_starting_frame_offset): New function.
	(avr_outgoing_args_size): New static function.
	(avr_initial_elimination_offset): Use it.
	(avr_simple_epilogue): Use it.
	(avr_asm_function_end_prologue): Use it.
	(expand_epilogue): Use it.
	(expand_prologue): Use it.  Break out code to...
	(avr_prologue_setup_frame): ...this new static function.
	(avr_can_eliminate): Allow eliminating to frame pointer if there
	is one.
	(avr_frame_pointer_required_p): Use frame pointer if target has a
	nonlocal label.
	* config/avr/constraints.md (R): Remove.
	(Csp): New constraint.
	* config/avr/predicates.md (avr_sp_immediate_operand): Use it.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/avr/avr-protos.h
    trunk/gcc/config/avr/avr.c
    trunk/gcc/config/avr/avr.h
    trunk/gcc/config/avr/avr.md
    trunk/gcc/config/avr/avr.opt
    trunk/gcc/config/avr/constraints.md
    trunk/gcc/config/avr/predicates.md
Comment 3 Georg-Johann Lay 2012-01-20 12:31:59 UTC
Author: gjl
Date: Fri Jan 20 12:31:46 2012
New Revision: 183336

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=183336
Log:
	PR target/49868
	PR target/50887
	* doc/extend.texi (Named Address Spaces): Split into subsections.
	(AVR Named Address Spaces): New subsection.
	(M32C Named Address Spaces): New subsection.
	(RL78 Named Address Spaces): New subsection.
	(SPU Named Address Spaces): New subsection.
	(Variable Attributes): New anchor "AVR Variable Attributes".
	(AVR Variable Attributes): Rewrite and avoid wording
	"address space" in this context.
	* doc/invoke.texi (AVR Options): Rewrite and add documentation
	for -maccumulate-args, -mbranch-cost=, -mrelax, -mshort-calls.
	(AVR Built-in Macros): New subsubsection therein.
	* doc/md.texi (AVR constraints): Remove "C04", "R".


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/doc/extend.texi
    trunk/gcc/doc/invoke.texi
    trunk/gcc/doc/md.texi
Comment 4 Georg-Johann Lay 2012-01-20 12:33:45 UTC
Closed with its documentation