Commit 6f90e075 by Jim Wilson

*** empty log message ***

From-SVN: r905
parent f6eed26d
...@@ -432,6 +432,9 @@ expand_call (exp, target, ignore) ...@@ -432,6 +432,9 @@ expand_call (exp, target, ignore)
#endif #endif
#endif #endif
/* Size of the stack reserved for paramter registers. */
int reg_parm_stack_space = 0;
/* 1 if scanning parms front to back, -1 if scanning back to front. */ /* 1 if scanning parms front to back, -1 if scanning back to front. */
int inc; int inc;
/* Address of space preallocated for stack parms /* Address of space preallocated for stack parms
...@@ -513,6 +516,14 @@ expand_call (exp, target, ignore) ...@@ -513,6 +516,14 @@ expand_call (exp, target, ignore)
is_volatile = TYPE_VOLATILE (TREE_TYPE (TREE_TYPE (p))); is_volatile = TYPE_VOLATILE (TREE_TYPE (TREE_TYPE (p)));
#ifdef REG_PARM_STACK_SPACE
#ifdef MAYBE_REG_PARM_STACK_SPACE
reg_parm_stack_space = MAYBE_REG_PARM_STACK_SPACE;
#else
reg_parm_stack_space = REG_PARM_STACK_SPACE (fndecl);
#endif
#endif
/* Warn if this value is an aggregate type, /* Warn if this value is an aggregate type,
regardless of which calling convention we are using for it. */ regardless of which calling convention we are using for it. */
if (warn_aggregate_return if (warn_aggregate_return
...@@ -844,7 +855,7 @@ expand_call (exp, target, ignore) ...@@ -844,7 +855,7 @@ expand_call (exp, target, ignore)
/* Compute the stack-size of this argument. */ /* Compute the stack-size of this argument. */
if (args[i].reg == 0 || args[i].partial != 0 if (args[i].reg == 0 || args[i].partial != 0
#ifdef REG_PARM_STACK_SPACE #ifdef REG_PARM_STACK_SPACE
|| REG_PARM_STACK_SPACE (fndecl) > 0 || reg_parm_stack_space > 0
#endif #endif
|| args[i].pass_on_stack) || args[i].pass_on_stack)
locate_and_pad_parm (TYPE_MODE (type), type, locate_and_pad_parm (TYPE_MODE (type), type,
...@@ -896,6 +907,11 @@ expand_call (exp, target, ignore) ...@@ -896,6 +907,11 @@ expand_call (exp, target, ignore)
argpos < n_named_args); argpos < n_named_args);
} }
#ifdef FINAL_REG_PARM_STACK_SPACE
reg_parm_stack_space = FINAL_REG_PARM_STACK_SPACE (args_size.constant,
args_size.var);
#endif
/* Compute the actual size of the argument block required. The variable /* Compute the actual size of the argument block required. The variable
and constant sizes must be combined, the size may have to be rounded, and constant sizes must be combined, the size may have to be rounded,
and there may be a minimum required size. */ and there may be a minimum required size. */
...@@ -920,7 +936,7 @@ expand_call (exp, target, ignore) ...@@ -920,7 +936,7 @@ expand_call (exp, target, ignore)
#endif #endif
#ifdef REG_PARM_STACK_SPACE #ifdef REG_PARM_STACK_SPACE
if (REG_PARM_STACK_SPACE (fndecl) > 0) if (reg_parm_stack_space > 0)
{ {
args_size.var args_size.var
= size_binop (MAX_EXPR, args_size.var, = size_binop (MAX_EXPR, args_size.var,
...@@ -931,7 +947,7 @@ expand_call (exp, target, ignore) ...@@ -931,7 +947,7 @@ expand_call (exp, target, ignore)
the size of the block we need. So make the adjustment. */ the size of the block we need. So make the adjustment. */
args_size.var args_size.var
= size_binop (MINUS_EXPR, args_size.var, = size_binop (MINUS_EXPR, args_size.var,
size_int (REG_PARM_STACK_SPACE (fndecl))); size_int (reg_parm_stack_space));
#endif #endif
} }
#endif #endif
...@@ -945,9 +961,9 @@ expand_call (exp, target, ignore) ...@@ -945,9 +961,9 @@ expand_call (exp, target, ignore)
#ifdef REG_PARM_STACK_SPACE #ifdef REG_PARM_STACK_SPACE
args_size.constant = MAX (args_size.constant, args_size.constant = MAX (args_size.constant,
REG_PARM_STACK_SPACE (fndecl)); reg_parm_stack_space);
#ifndef OUTGOING_REG_PARM_STACK_SPACE #ifndef OUTGOING_REG_PARM_STACK_SPACE
args_size.constant -= REG_PARM_STACK_SPACE (fndecl); args_size.constant -= reg_parm_stack_space;
#endif #endif
#endif #endif
} }
...@@ -1082,7 +1098,7 @@ expand_call (exp, target, ignore) ...@@ -1082,7 +1098,7 @@ expand_call (exp, target, ignore)
/* Since we will be writing into the entire argument area, the /* Since we will be writing into the entire argument area, the
map must be allocated for its entire size, not just the part that map must be allocated for its entire size, not just the part that
is the responsibility of the caller. */ is the responsibility of the caller. */
needed += REG_PARM_STACK_SPACE (fndecl); needed += reg_parm_stack_space;
#endif #endif
#ifdef ARGS_GROW_DOWNWARD #ifdef ARGS_GROW_DOWNWARD
...@@ -1246,7 +1262,7 @@ expand_call (exp, target, ignore) ...@@ -1246,7 +1262,7 @@ expand_call (exp, target, ignore)
Here we compute the boundary of the that needs to be saved, if any. */ Here we compute the boundary of the that needs to be saved, if any. */
for (i = 0; i < REG_PARM_STACK_SPACE (fndecl); i++) for (i = 0; i < reg_parm_stack_space; i++)
{ {
if (i >= highest_outgoing_arg_in_use if (i >= highest_outgoing_arg_in_use
|| stack_usage_map[i] == 0) || stack_usage_map[i] == 0)
...@@ -1299,7 +1315,7 @@ expand_call (exp, target, ignore) ...@@ -1299,7 +1315,7 @@ expand_call (exp, target, ignore)
for (i = 0; i < num_actuals; i++) for (i = 0; i < num_actuals; i++)
if (args[i].reg == 0 || args[i].pass_on_stack) if (args[i].reg == 0 || args[i].pass_on_stack)
store_one_arg (&args[i], argblock, may_be_alloca, store_one_arg (&args[i], argblock, may_be_alloca,
args_size.var != 0, fndecl); args_size.var != 0, fndecl, reg_parm_stack_space);
/* Now store any partially-in-registers parm. /* Now store any partially-in-registers parm.
This is the last place a block-move can happen. */ This is the last place a block-move can happen. */
...@@ -1307,7 +1323,7 @@ expand_call (exp, target, ignore) ...@@ -1307,7 +1323,7 @@ expand_call (exp, target, ignore)
for (i = 0; i < num_actuals; i++) for (i = 0; i < num_actuals; i++)
if (args[i].partial != 0 && ! args[i].pass_on_stack) if (args[i].partial != 0 && ! args[i].pass_on_stack)
store_one_arg (&args[i], argblock, may_be_alloca, store_one_arg (&args[i], argblock, may_be_alloca,
args_size.var != 0, fndecl); args_size.var != 0, fndecl, reg_parm_stack_space);
#ifndef PUSH_ARGS_REVERSED #ifndef PUSH_ARGS_REVERSED
#ifdef STACK_BOUNDARY #ifdef STACK_BOUNDARY
...@@ -1618,12 +1634,14 @@ target_for_arg (type, size, args_addr, offset) ...@@ -1618,12 +1634,14 @@ target_for_arg (type, size, args_addr, offset)
FNDECL is the declaration of the function we are calling. */ FNDECL is the declaration of the function we are calling. */
static void static void
store_one_arg (arg, argblock, may_be_alloca, variable_size, fndecl) store_one_arg (arg, argblock, may_be_alloca, variable_size, fndecl,
reg_parm_stack_space)
struct arg_data *arg; struct arg_data *arg;
rtx argblock; rtx argblock;
int may_be_alloca; int may_be_alloca;
int variable_size; int variable_size;
tree fndecl; tree fndecl;
int reg_parm_stack_space;
{ {
register tree pval = arg->tree_value; register tree pval = arg->tree_value;
rtx reg = 0; rtx reg = 0;
...@@ -1662,7 +1680,7 @@ store_one_arg (arg, argblock, may_be_alloca, variable_size, fndecl) ...@@ -1662,7 +1680,7 @@ store_one_arg (arg, argblock, may_be_alloca, variable_size, fndecl)
#ifdef REG_PARM_STACK_SPACE #ifdef REG_PARM_STACK_SPACE
/* Don't store things in the fixed argument area at this point; /* Don't store things in the fixed argument area at this point;
it has already been saved. */ it has already been saved. */
&& i > REG_PARM_STACK_SPACE (fndecl) && i > reg_parm_stack_space
#endif #endif
) )
break; break;
......
...@@ -524,10 +524,21 @@ struct write_data ...@@ -524,10 +524,21 @@ struct write_data
|| XEXP (X, 0) == virtual_stack_vars_rtx \ || XEXP (X, 0) == virtual_stack_vars_rtx \
|| XEXP (X, 0) == virtual_incoming_args_rtx))) || XEXP (X, 0) == virtual_incoming_args_rtx)))
/* Similar, but also allows reference to the stack pointer. */ /* Similar, but also allows reference to the stack pointer.
This used to include FIXED_BASE_PLUS_P, however, we can't assume that
arg_pointer_rtx by itself is nonzero, because on at least one machine,
the i960, the arg pointer is zero when it is unused. */
#define NONZERO_BASE_PLUS_P(X) \ #define NONZERO_BASE_PLUS_P(X) \
(FIXED_BASE_PLUS_P (X) \ ((X) == frame_pointer_rtx \
|| (X) == virtual_stack_vars_rtx \
|| (X) == virtual_incoming_args_rtx \
|| (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 1)) == CONST_INT \
&& (XEXP (X, 0) == frame_pointer_rtx \
|| XEXP (X, 0) == arg_pointer_rtx \
|| XEXP (X, 0) == virtual_stack_vars_rtx \
|| XEXP (X, 0) == virtual_incoming_args_rtx)) \
|| (X) == stack_pointer_rtx \ || (X) == stack_pointer_rtx \
|| (X) == virtual_stack_dynamic_rtx \ || (X) == virtual_stack_dynamic_rtx \
|| (X) == virtual_outgoing_args_rtx \ || (X) == virtual_outgoing_args_rtx \
......
...@@ -3681,6 +3681,9 @@ expand_expr (exp, target, tmode, modifier) ...@@ -3681,6 +3681,9 @@ expand_expr (exp, target, tmode, modifier)
temp = simplify_binary_operation (PLUS, mode, XEXP (op1, 0), op0); temp = simplify_binary_operation (PLUS, mode, XEXP (op1, 0), op0);
if (temp != 0) if (temp != 0)
op0 = temp; op0 = temp;
/* Ensure that MULT comes first if there is one. */
else if (GET_CODE (op0) == MULT)
op0 = gen_rtx (PLUS, mode, op0, XEXP (op1, 0));
else else
op0 = gen_rtx (PLUS, mode, XEXP (op1, 0), op0); op0 = gen_rtx (PLUS, mode, XEXP (op1, 0), op0);
......
...@@ -2916,9 +2916,11 @@ assign_parms (fndecl, second_time) ...@@ -2916,9 +2916,11 @@ assign_parms (fndecl, second_time)
minimum length. */ minimum length. */
#ifdef REG_PARM_STACK_SPACE #ifdef REG_PARM_STACK_SPACE
#ifndef MAYBE_REG_PARM_STACK_SPACE
current_function_args_size = MAX (current_function_args_size, current_function_args_size = MAX (current_function_args_size,
REG_PARM_STACK_SPACE (fndecl)); REG_PARM_STACK_SPACE (fndecl));
#endif #endif
#endif
#ifdef STACK_BOUNDARY #ifdef STACK_BOUNDARY
#define STACK_BYTES (STACK_BOUNDARY / BITS_PER_UNIT) #define STACK_BYTES (STACK_BOUNDARY / BITS_PER_UNIT)
......
...@@ -25,6 +25,9 @@ ...@@ -25,6 +25,9 @@
#ifdef __sparc__ #ifdef __sparc__
#include "va-sparc.h" #include "va-sparc.h"
#else #else
#ifdef __i960__
#include "va-i960.h"
#else
#ifdef _HIDDEN_VA_LIST /* On OSF1, this means varargs.h is "half-loaded". */ #ifdef _HIDDEN_VA_LIST /* On OSF1, this means varargs.h is "half-loaded". */
#undef _VA_LIST #undef _VA_LIST
...@@ -56,6 +59,7 @@ void va_end (va_list); /* Defined in libgcc.a */ ...@@ -56,6 +59,7 @@ void va_end (va_list); /* Defined in libgcc.a */
(AP += __va_rounded_size (TYPE), \ (AP += __va_rounded_size (TYPE), \
*((TYPE *) (AP - __va_rounded_size (TYPE)))) *((TYPE *) (AP - __va_rounded_size (TYPE))))
#endif /* not i960 */
#endif /* not sparc */ #endif /* not sparc */
#endif /* not mips */ #endif /* not mips */
#endif /* not hp9000s800 */ #endif /* not hp9000s800 */
......
...@@ -28,6 +28,9 @@ ...@@ -28,6 +28,9 @@
#ifdef __hp9000s800__ #ifdef __hp9000s800__
#include "va-hp800.h" #include "va-hp800.h"
#else #else
#ifdef __i960__
#include "va-i960.h"
#else
#ifdef __NeXT__ #ifdef __NeXT__
...@@ -95,6 +98,7 @@ typedef char * __va___list; ...@@ -95,6 +98,7 @@ typedef char * __va___list;
(AP += __va_rounded_size (TYPE), \ (AP += __va_rounded_size (TYPE), \
*((TYPE *) (AP - __va_rounded_size (TYPE)))) *((TYPE *) (AP - __va_rounded_size (TYPE))))
#endif /* not i960 */
#endif /* not hp800 */ #endif /* not hp800 */
#endif /* not m88k */ #endif /* not m88k */
#endif /* not pyr */ #endif /* not pyr */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment