Convert ACCUMULATE_OUTGOING_ARGS to an expression.
* calls.c (PUSH_ARGS_REVERSED) Change to expression. (ACCUMULATE_OUTGOING_ARGS, PUSH_ARGS): Provide default value. (struct arg_data): Remove #ifdef ACCUMULATE_OUTGOING_ARGS. (save_fixed_argument_area, restore_fixed_argument_area): conditionize by #ifdef REG_PARM_STACK_SPACE only. (emit_call): Change #ifdefs on ACCUMULATE_OUTGOING_ARGS to conditions, handle RETURN_POPS_ARGS on ACCUMULATE_OUTGOING_ARGS. (precompute_register_parameters): Avoid #ifdefs on ACCUMULATE_OUTGOING_ARGS and PUSH_ARGS_REVERSED. (stire_one_args): Likewise. (expand_call): Likewise; conditionize PUSH_ROUNDING code by PUSH_ARGS. (emit_library_call_value_1): Likewise. (compute_argument_block_size): Align to STACK_BOUNDARY only for ACCUMULATE_OUTGOING_ARGS. * combine.c (ACCUMULATE_OUTGOING_ARGS, PUSH_ARGS): Provide default value. (nonzero_bits): Conditionize PUSH_ROUNDING code by USE_PUSH. (use_crosses_set_p): Likewise. * all targets (ACCUMULATE_OUTGOING_ARGS define): Change to #define ACCUMULATE_OUTGOING_ARGS 1. * i386.c (ix86_compute_frame_size): Handle ACCUMULATE_OUTGOING_ARGS frames. * i386.h (MASK_NO_PUSH_ARGS, MASK_ACCUMULATE_OUTGOING_ARGS): New constants. (TARGET_PUSH_ARGS, TARGET_ACCUMULATE_OUTGOING_ARGS): New macros. (TARGET_SWITCHES): Add push-args, no-push-args, accumulate-outgoing-args and no-accumulate-outgoing-args. (ACCUMULATE_OUTGOING_ARGS, PUSH_ARGS): New macro. * expr.c (ACCUMULATE_OUTGONG_ARGS, PUSH_ARGS): Provide default. (push_block): Avoid ifdefs on ACCUMULATE_OUTGONG_ARGS and PUSH_ROUNDING. (emit_push_insn): Likewise. * final.c (ACCUMULATE_OUTGOING_ARGS): Provide default. (final_scan_insn): Avoid ifdefs on ACCUMULATE_OUTGOING_ARGS. * function.c (ACCUMULATE_OUTGOING_ARGS): Provide default. (STACK_DYNAMIC_OFFSET): Define correctly for both ACCUMULATE_OUTGOING_ARGS and normal mode. * invoke.texi (-mpush_args, -maccumulate-outgoing-args): Document. * tm.texi (PUSH_ARGS): Document. (ACCUMULATE_OUTGOING_ARGS, PUSH_ROUNDING): Update documentation. From-SVN: r32803
This commit is contained in:
parent
db8cb48e64
commit
f73ad30e01
|
@ -1,3 +1,47 @@
|
|||
Wed Mar 29 15:08:01 MET DST 2000 Jan Hubicka <jh@suse.cz>
|
||||
|
||||
Convert ACCUMULATE_OUTGOING_ARGS to an expression.
|
||||
* calls.c (PUSH_ARGS_REVERSED) Change to expression.
|
||||
(ACCUMULATE_OUTGOING_ARGS, PUSH_ARGS): Provide default value.
|
||||
(struct arg_data): Remove #ifdef ACCUMULATE_OUTGOING_ARGS.
|
||||
(save_fixed_argument_area, restore_fixed_argument_area):
|
||||
conditionize by #ifdef REG_PARM_STACK_SPACE only.
|
||||
(emit_call): Change #ifdefs on ACCUMULATE_OUTGOING_ARGS
|
||||
to conditions, handle RETURN_POPS_ARGS on ACCUMULATE_OUTGOING_ARGS.
|
||||
(precompute_register_parameters): Avoid #ifdefs on
|
||||
ACCUMULATE_OUTGOING_ARGS and PUSH_ARGS_REVERSED.
|
||||
(stire_one_args): Likewise.
|
||||
(expand_call): Likewise; conditionize PUSH_ROUNDING code by PUSH_ARGS.
|
||||
(emit_library_call_value_1): Likewise.
|
||||
(compute_argument_block_size): Align to STACK_BOUNDARY only for
|
||||
ACCUMULATE_OUTGOING_ARGS.
|
||||
* combine.c (ACCUMULATE_OUTGOING_ARGS, PUSH_ARGS): Provide default
|
||||
value.
|
||||
(nonzero_bits): Conditionize PUSH_ROUNDING code by USE_PUSH.
|
||||
(use_crosses_set_p): Likewise.
|
||||
* all targets (ACCUMULATE_OUTGOING_ARGS define): Change to
|
||||
#define ACCUMULATE_OUTGOING_ARGS 1.
|
||||
* i386.c (ix86_compute_frame_size): Handle ACCUMULATE_OUTGOING_ARGS
|
||||
frames.
|
||||
* i386.h (MASK_NO_PUSH_ARGS, MASK_ACCUMULATE_OUTGOING_ARGS): New
|
||||
constants.
|
||||
(TARGET_PUSH_ARGS, TARGET_ACCUMULATE_OUTGOING_ARGS): New macros.
|
||||
(TARGET_SWITCHES): Add push-args, no-push-args,
|
||||
accumulate-outgoing-args and no-accumulate-outgoing-args.
|
||||
(ACCUMULATE_OUTGOING_ARGS, PUSH_ARGS): New macro.
|
||||
* expr.c (ACCUMULATE_OUTGONG_ARGS, PUSH_ARGS): Provide default.
|
||||
(push_block): Avoid ifdefs on ACCUMULATE_OUTGONG_ARGS
|
||||
and PUSH_ROUNDING.
|
||||
(emit_push_insn): Likewise.
|
||||
* final.c (ACCUMULATE_OUTGOING_ARGS): Provide default.
|
||||
(final_scan_insn): Avoid ifdefs on ACCUMULATE_OUTGOING_ARGS.
|
||||
* function.c (ACCUMULATE_OUTGOING_ARGS): Provide default.
|
||||
(STACK_DYNAMIC_OFFSET): Define correctly for both
|
||||
ACCUMULATE_OUTGOING_ARGS and normal mode.
|
||||
* invoke.texi (-mpush_args, -maccumulate-outgoing-args): Document.
|
||||
* tm.texi (PUSH_ARGS): Document.
|
||||
(ACCUMULATE_OUTGOING_ARGS, PUSH_ROUNDING): Update documentation.
|
||||
|
||||
Wed Mar 29 11:51:13 MET DST 2000 Jan Hubicka <jh@suse.cz>
|
||||
|
||||
* flags.h (flag_optimize_sibling_calls): Declare.
|
||||
|
|
960
gcc/calls.c
960
gcc/calls.c
File diff suppressed because it is too large
Load Diff
|
@ -93,6 +93,20 @@ Boston, MA 02111-1307, USA. */
|
|||
#include "recog.h"
|
||||
#include "real.h"
|
||||
#include "toplev.h"
|
||||
#include "defaults.h"
|
||||
|
||||
#ifndef ACCUMULATE_OUTGOING_ARGS
|
||||
#define ACCUMULATE_OUTGOING_ARGS 0
|
||||
#endif
|
||||
|
||||
/* Supply a default definition for PUSH_ARGS. */
|
||||
#ifndef PUSH_ARGS
|
||||
#ifdef PUSH_ROUNDING
|
||||
#define PUSH_ARGS !ACCUMULATE_OUTGOING_ARGS
|
||||
#else
|
||||
#define PUSH_ARGS 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* It is not safe to use ordinary gen_lowpart in combine.
|
||||
Use gen_lowpart_for_combine instead. See comments there. */
|
||||
|
@ -7883,7 +7897,7 @@ nonzero_bits (x, mode)
|
|||
int sp_alignment = STACK_BOUNDARY / BITS_PER_UNIT;
|
||||
|
||||
#ifdef PUSH_ROUNDING
|
||||
if (REGNO (x) == STACK_POINTER_REGNUM)
|
||||
if (REGNO (x) == STACK_POINTER_REGNUM && PUSH_ARGS)
|
||||
sp_alignment = MIN (PUSH_ROUNDING (1), sp_alignment);
|
||||
#endif
|
||||
|
||||
|
@ -11422,7 +11436,7 @@ use_crosses_set_p (x, from_cuid)
|
|||
#ifdef PUSH_ROUNDING
|
||||
/* Don't allow uses of the stack pointer to be moved,
|
||||
because we don't know whether the move crosses a push insn. */
|
||||
if (regno == STACK_POINTER_REGNUM)
|
||||
if (regno == STACK_POINTER_REGNUM && PUSH_ARGS)
|
||||
return 1;
|
||||
#endif
|
||||
for (; regno < endreg; regno++)
|
||||
|
|
|
@ -716,7 +716,7 @@ enum reg_class { NO_REGS, LR0_REGS, GENERAL_REGS, BP_REGS, FC_REGS, CR_REGS,
|
|||
/* Define this if the maximum size of all the outgoing args is to be
|
||||
accumulated and pushed during the prologue. The amount can be
|
||||
found in the variable current_function_outgoing_args_size. */
|
||||
#define ACCUMULATE_OUTGOING_ARGS
|
||||
#define ACCUMULATE_OUTGOING_ARGS 1
|
||||
|
||||
/* Offset of first parameter from the argument pointer register value. */
|
||||
|
||||
|
|
|
@ -919,7 +919,7 @@ extern int alpha_memory_latency;
|
|||
/* Define this if the maximum size of all the outgoing args is to be
|
||||
accumulated and pushed during the prologue. The amount can be
|
||||
found in the variable current_function_outgoing_args_size. */
|
||||
#define ACCUMULATE_OUTGOING_ARGS
|
||||
#define ACCUMULATE_OUTGOING_ARGS 1
|
||||
|
||||
/* Offset of first parameter from the argument pointer register value. */
|
||||
|
||||
|
|
|
@ -643,7 +643,7 @@ extern enum reg_class arc_regno_reg_class[];
|
|||
`current_function_outgoing_args_size'. No space will be pushed
|
||||
onto the stack for each call; instead, the function prologue should
|
||||
increase the stack frame size by this amount. */
|
||||
#define ACCUMULATE_OUTGOING_ARGS
|
||||
#define ACCUMULATE_OUTGOING_ARGS 1
|
||||
|
||||
/* Value is the number of bytes of arguments automatically
|
||||
popped when returning from a subroutine call.
|
||||
|
|
|
@ -368,7 +368,7 @@ enum reg_class { NO_REGS, GENERAL_REGS, FLOAT_REGS, ALL_REGS, LIM_REG_CLASSES};
|
|||
/* we can't set this for clipper as library calls may have 3 args and we pass
|
||||
only 2 args in regs. */
|
||||
|
||||
/* #define ACCUMULATE_OUTGOING_ARGS */
|
||||
/* #define ACCUMULATE_OUTGOING_ARGS 1*/
|
||||
|
||||
|
||||
/* Offset of first parameter from the argument pointer register value.
|
||||
|
|
|
@ -1071,7 +1071,7 @@ extern struct dsp16xx_frame_info current_frame_info;
|
|||
|
||||
It is not proper to define both 'PUSH_ROUNDING' and
|
||||
'ACCUMULATE_OUTGOING_ARGS'. */
|
||||
#define ACCUMULATE_OUTGOING_ARGS
|
||||
#define ACCUMULATE_OUTGOING_ARGS 1
|
||||
|
||||
/* Offset of first parameter from the argument pointer
|
||||
register value. */
|
||||
|
|
|
@ -837,7 +837,7 @@ enum reg_class
|
|||
|
||||
Defining both `PUSH_ROUNDING' and `ACCUMULATE_OUTGOING_ARGS' is not
|
||||
proper. */
|
||||
#define ACCUMULATE_OUTGOING_ARGS
|
||||
#define ACCUMULATE_OUTGOING_ARGS 1
|
||||
|
||||
/* A C expression that should indicate the number of bytes of its own arguments
|
||||
that a function pops on returning, or 0 if the function pops no arguments
|
||||
|
|
|
@ -520,7 +520,7 @@ enum reg_class
|
|||
/* Accumulate the outgoing argument count so we can request the right
|
||||
DSA size and determine stack offset. */
|
||||
|
||||
#define ACCUMULATE_OUTGOING_ARGS
|
||||
#define ACCUMULATE_OUTGOING_ARGS 1
|
||||
|
||||
/* Define offset from stack pointer, to location where a parm can be
|
||||
pushed. */
|
||||
|
|
|
@ -1797,6 +1797,9 @@ ix86_compute_frame_size (size, nregs_on_stack, rpadding1, rpadding2)
|
|||
|
||||
offset += nregs * UNITS_PER_WORD;
|
||||
|
||||
if (ACCUMULATE_OUTGOING_ARGS)
|
||||
total_size += current_function_outgoing_args_size;
|
||||
|
||||
total_size += offset;
|
||||
|
||||
/* Align start of frame for local function. */
|
||||
|
@ -1808,6 +1811,9 @@ ix86_compute_frame_size (size, nregs_on_stack, rpadding1, rpadding2)
|
|||
padding2 = ((total_size + preferred_alignment - 1)
|
||||
& -preferred_alignment) - total_size;
|
||||
|
||||
if (ACCUMULATE_OUTGOING_ARGS)
|
||||
padding2 += current_function_outgoing_args_size;
|
||||
|
||||
if (nregs_on_stack)
|
||||
*nregs_on_stack = nregs;
|
||||
if (rpadding1)
|
||||
|
|
|
@ -100,6 +100,8 @@ extern int target_flags;
|
|||
#define MASK_STACK_PROBE 0x00000100 /* Enable stack probing */
|
||||
#define MASK_NO_ALIGN_STROPS 0x00001000 /* Enable aligning of string ops. */
|
||||
#define MASK_INLINE_ALL_STROPS 0x00002000 /* Inline stringops in all cases */
|
||||
#define MASK_NO_PUSH_ARGS 0x00004000 /* Use push instructions */
|
||||
#define MASK_ACCUMULATE_OUTGOING_ARGS 0x00008000/* Accumulate outgoing args */
|
||||
|
||||
/* Temporary codegen switches */
|
||||
#define MASK_INTEL_SYNTAX 0x00000200
|
||||
|
@ -119,6 +121,13 @@ extern int target_flags;
|
|||
faster code on the pentium. */
|
||||
#define TARGET_ALIGN_DOUBLE (target_flags & MASK_ALIGN_DOUBLE)
|
||||
|
||||
/* Use push instructions to save outgoing args. */
|
||||
#define TARGET_PUSH_ARGS (!(target_flags & MASK_NO_PUSH_ARGS))
|
||||
|
||||
/* Accumulate stack adjustments to prologue/epilogue. */
|
||||
#define TARGET_ACCUMULATE_OUTGOING_ARGS \
|
||||
(target_flags & MASK_ACCUMULATE_OUTGOING_ARGS)
|
||||
|
||||
/* Put uninitialized locals into bss, not data.
|
||||
Meaningful only on svr3. */
|
||||
#define TARGET_SVR3_SHLIB (target_flags & MASK_SVR3_SHLIB)
|
||||
|
@ -254,6 +263,14 @@ extern const int x86_promote_hi_regs;
|
|||
"Inline all known string operations" }, \
|
||||
{ "no-inline-all-stringops", -MASK_INLINE_ALL_STROPS, \
|
||||
"Do not inline all known string operations" }, \
|
||||
{ "push-args", -MASK_NO_PUSH_ARGS, \
|
||||
"Use push instructions to save outgoing arguments" }, \
|
||||
{ "no-push-args", MASK_NO_PUSH_ARGS, "" \
|
||||
"UDo not use push instructions to save outgoing arguments" }, \
|
||||
{ "accumulate-outgoing-args", MASK_ACCUMULATE_OUTGOING_ARGS, \
|
||||
"Use push instructions to save outgoing arguments" }, \
|
||||
{ "no-accumulate-outgoing-args",-MASK_ACCUMULATE_OUTGOING_ARGS, "" \
|
||||
"Do not use push instructions to save outgoing arguments" }, \
|
||||
SUBTARGET_SWITCHES \
|
||||
{ "", TARGET_DEFAULT, 0 }}
|
||||
|
||||
|
@ -1136,6 +1153,19 @@ enum reg_class
|
|||
|
||||
#define PUSH_ROUNDING(BYTES) (((BYTES) + 1) & (-2))
|
||||
|
||||
/* If defined, the maximum amount of space required for outgoing arguments will
|
||||
be computed and placed into the variable
|
||||
`current_function_outgoing_args_size'. No space will be pushed onto the
|
||||
stack for each call; instead, the function prologue should increase the stack
|
||||
frame size by this amount. */
|
||||
|
||||
#define ACCUMULATE_OUTGOING_ARGS TARGET_ACCUMULATE_OUTGOING_ARGS
|
||||
|
||||
/* If defined, a C expression whose value is nonzero when we want to use PUSH
|
||||
instructions to pass outgoing arguments. */
|
||||
|
||||
#define PUSH_ARGS (TARGET_PUSH_ARGS && !ACCUMULATE_OUTGOING_ARGS)
|
||||
|
||||
/* Offset of first parameter from the argument pointer register value. */
|
||||
#define FIRST_PARM_OFFSET(FNDECL) 0
|
||||
|
||||
|
|
|
@ -833,7 +833,7 @@ enum reg_class { NO_REGS, GLOBAL_REGS, LOCAL_REGS, LOCAL_OR_GLOBAL_REGS,
|
|||
#define OUTGOING_REG_PARM_STACK_SPACE
|
||||
|
||||
/* Keep the stack pointer constant throughout the function. */
|
||||
#define ACCUMULATE_OUTGOING_ARGS
|
||||
#define ACCUMULATE_OUTGOING_ARGS 1
|
||||
|
||||
/* Value is 1 if returning from a function call automatically
|
||||
pops the arguments described by the number-of-args field in the call.
|
||||
|
|
|
@ -1270,7 +1270,7 @@ extern int ia64_local_regs;
|
|||
be computed and placed into the variable
|
||||
`current_function_outgoing_args_size'. */
|
||||
|
||||
#define ACCUMULATE_OUTGOING_ARGS
|
||||
#define ACCUMULATE_OUTGOING_ARGS 1
|
||||
|
||||
/* A C expression that should indicate the number of bytes of its own arguments
|
||||
that a function pops on returning, or 0 if the function pops no arguments
|
||||
|
|
|
@ -983,7 +983,7 @@ M32R_STACK_ALIGN (current_function_outgoing_args_size)
|
|||
`current_function_outgoing_args_size'. No space will be pushed
|
||||
onto the stack for each call; instead, the function prologue should
|
||||
increase the stack frame size by this amount. */
|
||||
#define ACCUMULATE_OUTGOING_ARGS
|
||||
#define ACCUMULATE_OUTGOING_ARGS 1
|
||||
|
||||
/* Define this macro if functions should assume that stack space has
|
||||
been allocated for arguments even when their values are passed in
|
||||
|
|
|
@ -872,7 +872,7 @@ enum reg_class { NO_REGS, AP_REG, XRF_REGS, GENERAL_REGS, AGRF_REGS,
|
|||
`current_function_outgoing_args_size'. No space will be pushed
|
||||
onto the stack for each call; instead, the function prologue should
|
||||
increase the stack frame size by this amount. */
|
||||
#define ACCUMULATE_OUTGOING_ARGS
|
||||
#define ACCUMULATE_OUTGOING_ARGS 1
|
||||
|
||||
/* Offset from the stack pointer register to the first location at which
|
||||
outgoing arguments are placed. Use the default value zero. */
|
||||
|
|
|
@ -673,7 +673,7 @@ extern enum reg_class reg_class_from_letter[];
|
|||
`current_function_outgoing_args_size'. No space will be pushed
|
||||
onto the stack for each call; instead, the function prologue should
|
||||
increase the stack frame size by this amount. */
|
||||
#define ACCUMULATE_OUTGOING_ARGS
|
||||
#define ACCUMULATE_OUTGOING_ARGS 1
|
||||
|
||||
/* Offset of first parameter from the argument pointer register value. */
|
||||
#define FIRST_PARM_OFFSET(FNDECL) 0
|
||||
|
|
|
@ -2260,7 +2260,7 @@ extern struct mips_frame_info current_frame_info;
|
|||
|
||||
It is not proper to define both `PUSH_ROUNDING' and
|
||||
`ACCUMULATE_OUTGOING_ARGS'. */
|
||||
#define ACCUMULATE_OUTGOING_ARGS
|
||||
#define ACCUMULATE_OUTGOING_ARGS 1
|
||||
|
||||
/* Offset from the argument pointer register to the first argument's
|
||||
address. On some machines it may depend on the data type of the
|
||||
|
|
|
@ -401,7 +401,7 @@ enum reg_class {
|
|||
|
||||
We allow frame pointers to be eliminated when not having one will
|
||||
not interfere with debugging. */
|
||||
#define ACCUMULATE_OUTGOING_ARGS
|
||||
#define ACCUMULATE_OUTGOING_ARGS 1
|
||||
#define FRAME_POINTER_REQUIRED 0
|
||||
#define CAN_DEBUG_WITHOUT_FP
|
||||
|
||||
|
|
|
@ -447,7 +447,7 @@ enum reg_class {
|
|||
for a register flushback area. */
|
||||
#define REG_PARM_STACK_SPACE(DECL) 8
|
||||
#define OUTGOING_REG_PARM_STACK_SPACE
|
||||
#define ACCUMULATE_OUTGOING_ARGS
|
||||
#define ACCUMULATE_OUTGOING_ARGS 1
|
||||
|
||||
/* So we can allocate space for return pointers once for the function
|
||||
instead of around every call. */
|
||||
|
|
|
@ -556,7 +556,7 @@ extern int target_flags;
|
|||
This is both an optimization and a necessity: longjmp
|
||||
doesn't behave itself when the stack pointer moves within
|
||||
the function! */
|
||||
#define ACCUMULATE_OUTGOING_ARGS
|
||||
#define ACCUMULATE_OUTGOING_ARGS 1
|
||||
|
||||
/* The weird HPPA calling conventions require a minimum of 48 bytes on
|
||||
the stack: 16 bytes for register saves, and 32 bytes for magic.
|
||||
|
|
|
@ -499,7 +499,7 @@ enum reg_class { NO_REGS, R0_REGS, R15_REGS, BASE_REGS, GENERAL_REGS,
|
|||
/* Define this if the maximum size of all the outgoing args is to be
|
||||
accumulated and pushed during the prologue. The amount can be
|
||||
found in the variable current_function_outgoing_args_size. */
|
||||
#define ACCUMULATE_OUTGOING_ARGS
|
||||
#define ACCUMULATE_OUTGOING_ARGS 1
|
||||
|
||||
/* Value is the number of bytes of arguments automatically
|
||||
popped when returning from a subroutine call.
|
||||
|
|
|
@ -1283,7 +1283,7 @@ extern int rs6000_sysv_varargs_p;
|
|||
/* Define this if the maximum size of all the outgoing args is to be
|
||||
accumulated and pushed during the prologue. The amount can be
|
||||
found in the variable current_function_outgoing_args_size. */
|
||||
#define ACCUMULATE_OUTGOING_ARGS
|
||||
#define ACCUMULATE_OUTGOING_ARGS 1
|
||||
|
||||
/* Value is the number of bytes of arguments automatically
|
||||
popped when returning from a subroutine call.
|
||||
|
|
|
@ -1606,7 +1606,7 @@ extern char leaf_reg_remap[];
|
|||
This is both an optimization and a necessity: longjmp
|
||||
doesn't behave itself when the stack pointer moves within
|
||||
the function! */
|
||||
#define ACCUMULATE_OUTGOING_ARGS
|
||||
#define ACCUMULATE_OUTGOING_ARGS 1
|
||||
|
||||
/* Value is the number of bytes of arguments automatically
|
||||
popped when returning from a subroutine call.
|
||||
|
|
|
@ -667,7 +667,7 @@ enum reg_class
|
|||
#define PROMOTE_PROTOTYPES 1
|
||||
|
||||
/* Keep the stack pointer constant throughout the function. */
|
||||
#define ACCUMULATE_OUTGOING_ARGS
|
||||
#define ACCUMULATE_OUTGOING_ARGS 1
|
||||
|
||||
/* Value is the number of bytes of arguments automatically
|
||||
popped when returning from a subroutine call.
|
||||
|
|
80
gcc/expr.c
80
gcc/expr.c
|
@ -45,6 +45,19 @@ Boston, MA 02111-1307, USA. */
|
|||
#include "intl.h"
|
||||
#include "tm_p.h"
|
||||
|
||||
#ifndef ACCUMULATE_OUTGOING_ARGS
|
||||
#define ACCUMULATE_OUTGOING_ARGS 0
|
||||
#endif
|
||||
|
||||
/* Supply a default definition for PUSH_ARGS. */
|
||||
#ifndef PUSH_ARGS
|
||||
#ifdef PUSH_ROUNDING
|
||||
#define PUSH_ARGS !ACCUMULATE_OUTGOING_ARGS
|
||||
#else
|
||||
#define PUSH_ARGS 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Decide whether a function's arguments should be processed
|
||||
from first to last or from last to first.
|
||||
|
||||
|
@ -2820,27 +2833,36 @@ push_block (size, extra, below)
|
|||
anti_adjust_stack (temp);
|
||||
}
|
||||
|
||||
#if defined (STACK_GROWS_DOWNWARD) \
|
||||
|| (defined (ARGS_GROW_DOWNWARD) \
|
||||
&& !defined (ACCUMULATE_OUTGOING_ARGS))
|
||||
|
||||
/* Return the lowest stack address when STACK or ARGS grow downward and
|
||||
we are not aaccumulating outgoing arguments (the c4x port uses such
|
||||
conventions). */
|
||||
temp = virtual_outgoing_args_rtx;
|
||||
if (extra != 0 && below)
|
||||
temp = plus_constant (temp, extra);
|
||||
#ifndef STACK_GROWS_DOWNWARD
|
||||
#ifdef ARGS_GROW_DOWNWARD
|
||||
if (!ACCUMULATE_OUTGOING_ARGS)
|
||||
#else
|
||||
if (GET_CODE (size) == CONST_INT)
|
||||
temp = plus_constant (virtual_outgoing_args_rtx,
|
||||
- INTVAL (size) - (below ? 0 : extra));
|
||||
else if (extra != 0 && !below)
|
||||
temp = gen_rtx_PLUS (Pmode, virtual_outgoing_args_rtx,
|
||||
negate_rtx (Pmode, plus_constant (size, extra)));
|
||||
else
|
||||
temp = gen_rtx_PLUS (Pmode, virtual_outgoing_args_rtx,
|
||||
negate_rtx (Pmode, size));
|
||||
if (0)
|
||||
#endif
|
||||
#else
|
||||
if (1)
|
||||
#endif
|
||||
{
|
||||
|
||||
/* Return the lowest stack address when STACK or ARGS grow downward and
|
||||
we are not aaccumulating outgoing arguments (the c4x port uses such
|
||||
conventions). */
|
||||
temp = virtual_outgoing_args_rtx;
|
||||
if (extra != 0 && below)
|
||||
temp = plus_constant (temp, extra);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GET_CODE (size) == CONST_INT)
|
||||
temp = plus_constant (virtual_outgoing_args_rtx,
|
||||
- INTVAL (size) - (below ? 0 : extra));
|
||||
else if (extra != 0 && !below)
|
||||
temp = gen_rtx_PLUS (Pmode, virtual_outgoing_args_rtx,
|
||||
negate_rtx (Pmode, plus_constant (size, extra)));
|
||||
else
|
||||
temp = gen_rtx_PLUS (Pmode, virtual_outgoing_args_rtx,
|
||||
negate_rtx (Pmode, size));
|
||||
}
|
||||
|
||||
return memory_address (GET_CLASS_NARROWEST_MODE (MODE_INT), temp);
|
||||
}
|
||||
|
@ -2971,6 +2993,7 @@ emit_push_insn (x, mode, type, size, align, partial, reg, extra,
|
|||
and if there is no difficulty with push insns that skip bytes
|
||||
on the stack for alignment purposes. */
|
||||
if (args_addr == 0
|
||||
&& PUSH_ARGS
|
||||
&& GET_CODE (size) == CONST_INT
|
||||
&& skip == 0
|
||||
&& (MOVE_BY_PIECES_P ((unsigned) INTVAL (size) - used, align))
|
||||
|
@ -3123,15 +3146,16 @@ emit_push_insn (x, mode, type, size, align, partial, reg, extra,
|
|||
}
|
||||
}
|
||||
|
||||
#ifndef ACCUMULATE_OUTGOING_ARGS
|
||||
/* If the source is referenced relative to the stack pointer,
|
||||
copy it to another register to stabilize it. We do not need
|
||||
to do this if we know that we won't be changing sp. */
|
||||
if (!ACCUMULATE_OUTGOING_ARGS)
|
||||
{
|
||||
/* If the source is referenced relative to the stack pointer,
|
||||
copy it to another register to stabilize it. We do not need
|
||||
to do this if we know that we won't be changing sp. */
|
||||
|
||||
if (reg_mentioned_p (virtual_stack_dynamic_rtx, temp)
|
||||
|| reg_mentioned_p (virtual_outgoing_args_rtx, temp))
|
||||
temp = copy_to_reg (temp);
|
||||
#endif
|
||||
if (reg_mentioned_p (virtual_stack_dynamic_rtx, temp)
|
||||
|| reg_mentioned_p (virtual_outgoing_args_rtx, temp))
|
||||
temp = copy_to_reg (temp);
|
||||
}
|
||||
|
||||
/* Make inhibit_defer_pop nonzero around the library call
|
||||
to force it to pop the bcopy-arguments right away. */
|
||||
|
@ -3227,7 +3251,7 @@ emit_push_insn (x, mode, type, size, align, partial, reg, extra,
|
|||
anti_adjust_stack (GEN_INT (extra));
|
||||
|
||||
#ifdef PUSH_ROUNDING
|
||||
if (args_addr == 0)
|
||||
if (args_addr == 0 && PUSH_ARGS)
|
||||
addr = gen_push_operand ();
|
||||
else
|
||||
#endif
|
||||
|
|
34
gcc/final.c
34
gcc/final.c
|
@ -80,6 +80,10 @@ Boston, MA 02111-1307, USA. */
|
|||
|
||||
#endif /* DBX_DEBUGGING_INFO || XCOFF_DEBUGGING_INFO */
|
||||
|
||||
#ifndef ACCUMULATE_OUTGOING_ARGS
|
||||
#define ACCUMULATE_OUTGOING_ARGS 0
|
||||
#endif
|
||||
|
||||
#ifdef XCOFF_DEBUGGING_INFO
|
||||
#include "xcoffout.h"
|
||||
#endif
|
||||
|
@ -2279,10 +2283,10 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes)
|
|||
break;
|
||||
|
||||
case BARRIER:
|
||||
#if defined (DWARF2_UNWIND_INFO) && !defined (ACCUMULATE_OUTGOING_ARGS)
|
||||
#if defined (DWARF2_UNWIND_INFO)
|
||||
/* If we push arguments, we need to check all insns for stack
|
||||
adjustments. */
|
||||
if (dwarf2out_do_frame ())
|
||||
if (!ACCUMULATE_OUTGOING_ARGS && dwarf2out_do_frame ())
|
||||
dwarf2out_frame_debug (insn);
|
||||
#endif
|
||||
break;
|
||||
|
@ -2885,9 +2889,10 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes)
|
|||
|
||||
debug_insn = insn;
|
||||
|
||||
#if defined (DWARF2_UNWIND_INFO) && !defined (ACCUMULATE_OUTGOING_ARGS)
|
||||
#if defined (DWARF2_UNWIND_INFO)
|
||||
/* If we push arguments, we want to know where the calls are. */
|
||||
if (GET_CODE (insn) == CALL_INSN && dwarf2out_do_frame ())
|
||||
if (!ACCUMULATE_OUTGOING_ARGS && GET_CODE (insn) == CALL_INSN
|
||||
&& dwarf2out_do_frame ())
|
||||
dwarf2out_frame_debug (insn);
|
||||
#endif
|
||||
|
||||
|
@ -2934,19 +2939,22 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes)
|
|||
output_asm_insn (template, recog_data.operand);
|
||||
|
||||
#if defined (DWARF2_UNWIND_INFO)
|
||||
#if !defined (ACCUMULATE_OUTGOING_ARGS)
|
||||
/* If we push arguments, we need to check all insns for stack
|
||||
adjustments. */
|
||||
if (GET_CODE (insn) == INSN && dwarf2out_do_frame ())
|
||||
dwarf2out_frame_debug (insn);
|
||||
#else
|
||||
if (!ACCUMULATE_OUTGOING_ARGS)
|
||||
{
|
||||
if (GET_CODE (insn) == INSN && dwarf2out_do_frame ())
|
||||
dwarf2out_frame_debug (insn);
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined (HAVE_prologue)
|
||||
/* If this insn is part of the prologue, emit DWARF v2
|
||||
call frame info. */
|
||||
if (RTX_FRAME_RELATED_P (insn) && dwarf2out_do_frame ())
|
||||
dwarf2out_frame_debug (insn);
|
||||
#endif
|
||||
/* If this insn is part of the prologue, emit DWARF v2
|
||||
call frame info. */
|
||||
if (RTX_FRAME_RELATED_P (insn) && dwarf2out_do_frame ())
|
||||
dwarf2out_frame_debug (insn);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
|
|
|
@ -61,6 +61,10 @@ Boston, MA 02111-1307, USA. */
|
|||
#include "ggc.h"
|
||||
#include "tm_p.h"
|
||||
|
||||
#ifndef ACCUMULATE_OUTGOING_ARGS
|
||||
#define ACCUMULATE_OUTGOING_ARGS 0
|
||||
#endif
|
||||
|
||||
#ifndef TRAMPOLINE_ALIGNMENT
|
||||
#define TRAMPOLINE_ALIGNMENT FUNCTION_BOUNDARY
|
||||
#endif
|
||||
|
@ -2738,7 +2742,6 @@ static int cfa_offset;
|
|||
|
||||
#ifndef STACK_DYNAMIC_OFFSET
|
||||
|
||||
#ifdef ACCUMULATE_OUTGOING_ARGS
|
||||
/* The bottom of the stack points to the actual arguments. If
|
||||
REG_PARM_STACK_SPACE is defined, this includes the space for the register
|
||||
parameters. However, if OUTGOING_REG_PARM_STACK space is not defined,
|
||||
|
@ -2749,16 +2752,14 @@ static int cfa_offset;
|
|||
|
||||
#if defined(REG_PARM_STACK_SPACE) && ! defined(OUTGOING_REG_PARM_STACK_SPACE)
|
||||
#define STACK_DYNAMIC_OFFSET(FNDECL) \
|
||||
(current_function_outgoing_args_size \
|
||||
+ REG_PARM_STACK_SPACE (FNDECL) + (STACK_POINTER_OFFSET))
|
||||
((ACCUMULATE_OUTGOING_ARGS \
|
||||
? (current_function_outgoing_args_size + REG_PARM_STACK_SPACE (FNDECL)) : 0)\
|
||||
+ (STACK_POINTER_OFFSET)) \
|
||||
|
||||
#else
|
||||
#define STACK_DYNAMIC_OFFSET(FNDECL) \
|
||||
(current_function_outgoing_args_size + (STACK_POINTER_OFFSET))
|
||||
#endif
|
||||
|
||||
#else
|
||||
#define STACK_DYNAMIC_OFFSET(FNDECL) STACK_POINTER_OFFSET
|
||||
((ACCUMULATE_OUTGOING_ARGS ? current_function_outgoing_args_size : 0) \
|
||||
+ (STACK_POINTER_OFFSET))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
|
@ -362,6 +362,7 @@ in the following sections.
|
|||
-malign-jumps=@var{num} -malign-loops=@var{num}
|
||||
-malign-functions=@var{num} -mpreferred-stack-boundary=@var{num}
|
||||
-mthreads -mno-align-stringops -minline-all-stringops
|
||||
-mpush-args -maccumulate-outgoing-args
|
||||
|
||||
@emph{HPPA Options}
|
||||
-march=@var{architecture type}
|
||||
|
@ -6024,6 +6025,21 @@ to stack space usage, such as embedded systems and operating system kernels,
|
|||
may want to reduce the preferred alignment to
|
||||
@samp{-mpreferred-stack-boundary=2}.
|
||||
|
||||
@item -mpush-args
|
||||
@kindex -mpush-args
|
||||
Use PUSH operations to store outgoing parameters. This method is shorter
|
||||
and usually equally fast as method using SUB/MOV operations and is enabled
|
||||
by default. In some cases disabling it may improve performance because of
|
||||
improved scheduling and reduced dependencies.
|
||||
|
||||
@item -maccumulate-outgoing-args
|
||||
@kindex -maccumulate-outgoing-args
|
||||
If enabled, the maximum amount of space required for outgoing arguments will be
|
||||
computed in the function prologue. This in faster on most modern CPUs
|
||||
because of reduced dependecies, improved scheduling and reduced stack usage
|
||||
when preferred stack boundary is not equal to 2. The drawback is a notable
|
||||
increase in code size. This switch implies -mno-push-args.
|
||||
|
||||
@item -mthreads
|
||||
@kindex -mthreads
|
||||
Support thread-safe exception handling on @samp{Mingw32}. Code that relies
|
||||
|
|
23
gcc/tm.texi
23
gcc/tm.texi
|
@ -2630,15 +2630,24 @@ errors in certain cases of mismatch, it also makes for better
|
|||
code on certain machines. If the macro is not defined in target
|
||||
header files, it defaults to 0.
|
||||
|
||||
@findex PUSH_ARGS
|
||||
@item PUSH_ARGS
|
||||
A C expression. If nonzero, push insns will be used to pass
|
||||
outgoing arguments.
|
||||
If the target machine does not have a push instruction, set it to zero.
|
||||
That directs GCC to use an alternate strategy: to
|
||||
allocate the entire argument block and then store the arguments into
|
||||
it. When PUSH_ARGS is nonzero, PUSH_ROUNDING must be defined too.
|
||||
On some machines, the definition
|
||||
|
||||
@findex PUSH_ROUNDING
|
||||
@item PUSH_ROUNDING (@var{npushed})
|
||||
A C expression that is the number of bytes actually pushed onto the
|
||||
stack when an instruction attempts to push @var{npushed} bytes.
|
||||
@findex PUSH_ROUNDING
|
||||
@item PUSH_ROUNDING (@var{npushed})
|
||||
A C expression that is the number of bytes actually pushed onto the
|
||||
stack when an instruction attempts to push @var{npushed} bytes.
|
||||
|
||||
If the target machine does not have a push instruction, do not define
|
||||
this macro. That directs GCC to use an alternate strategy: to
|
||||
allocate the entire argument block and then store the arguments into
|
||||
it.
|
||||
|
||||
On some machines, the definition
|
||||
|
||||
|
@ -2658,13 +2667,13 @@ alignment. Then the definition should be
|
|||
@findex ACCUMULATE_OUTGOING_ARGS
|
||||
@findex current_function_outgoing_args_size
|
||||
@item ACCUMULATE_OUTGOING_ARGS
|
||||
If defined, the maximum amount of space required for outgoing arguments
|
||||
A C expression. If nonzero, the maximum amount of space required for outgoing arguments
|
||||
will be computed and placed into the variable
|
||||
@code{current_function_outgoing_args_size}. No space will be pushed
|
||||
onto the stack for each call; instead, the function prologue should
|
||||
increase the stack frame size by this amount.
|
||||
|
||||
Defining both @code{PUSH_ROUNDING} and @code{ACCUMULATE_OUTGOING_ARGS}
|
||||
Setting both @code{PUSH_ARGS} and @code{ACCUMULATE_OUTGOING_ARGS}
|
||||
is not proper.
|
||||
|
||||
@findex REG_PARM_STACK_SPACE
|
||||
|
|
13
gcc/toplev.c
13
gcc/toplev.c
|
@ -61,6 +61,10 @@ Boston, MA 02111-1307, USA. */
|
|||
#include "loop.h"
|
||||
#include "regs.h"
|
||||
|
||||
#ifndef ACCUMULATE_OUTGOING_ARGS
|
||||
#define ACCUMULATE_OUTGOING_ARGS 0
|
||||
#endif
|
||||
|
||||
#ifdef DWARF_DEBUGGING_INFO
|
||||
#include "dwarfout.h"
|
||||
#endif
|
||||
|
@ -3568,9 +3572,14 @@ rest_of_compilation (decl)
|
|||
life_analysis (insns, max_reg_num (), rtl_dump_file, 1);
|
||||
});
|
||||
|
||||
#ifndef ACCUMULATE_OUTGOING_ARGS
|
||||
TIMEVAR (flow2_time, { combine_stack_adjustments (); });
|
||||
/* This is kind of heruistics. We need to run combine_stack_adjustments
|
||||
even for machines with possibly nonzero RETURN_POPS_ARGS
|
||||
and ACCUMULATE_OUTGOING_ARGS. We expect that only ports having
|
||||
push instructions will have popping returns. */
|
||||
#ifndef PUSH_ROUNDING
|
||||
if (!ACCUMULATE_OUTGOING_ARGS)
|
||||
#endif
|
||||
TIMEVAR (flow2_time, { combine_stack_adjustments (); });
|
||||
|
||||
if (ggc_p)
|
||||
ggc_collect ();
|
||||
|
|
Loading…
Reference in New Issue