summaryrefslogtreecommitdiff
path: root/gcc/reg-stack.c
diff options
context:
space:
mode:
authoruros <uros@138bc75d-0d04-0410-961f-82ee72b054a4>2006-11-15 16:21:58 +0000
committeruros <uros@138bc75d-0d04-0410-961f-82ee72b054a4>2006-11-15 16:21:58 +0000
commite92554cbba705408a4415262204fa9fb55a47a55 (patch)
tree764fb41a529e8c99e2fdcd06f12aed4fa7003f09 /gcc/reg-stack.c
parentc826214a9c0653b3fec5c9728b190061e9a02e18 (diff)
downloadgcc-e92554cbba705408a4415262204fa9fb55a47a55.tar.gz
* config/i386/i386.opt: New target option -mx87regparm.
* config/i386/i386.h (struct ix86_args): Add x87_nregs, x87_regno, float_in_x87: Add new variables. mmx_words, sse_words: Remove. (X87_REGPARM_MAX): Define. * config/i386/i386.c (override_options): Error out for -mx87regparm but no 80387 support. (ix86_attribute_table): Add x87regparm. (ix86_handle_cconv_attribute): Update comments for x87regparm. (ix86_comp_type_attributes): Check for mismatched x87regparm types. (ix86_function_x87regparm): New function. (ix86_function_arg_regno_p): Add X87_REGPARM_MAX 80387 floating point registers. (init_cumulative_args): Initialize x87_nregs and float_in_x87 variables. (function_arg_advance): Process x87_nregs and x87_regno when floating point argument is to be passed in 80387 register. (function_arg): Pass XFmode arguments in 80387 registers for local functions. Pass SFmode and DFmode arguments to local functions in 80387 registers when flag_unsafe_math_optimizations is set. * reg-stack.c (convert_regs_entry): Disable NaN load for stack registers that are used for argument passing. * doc/extend.texi: Document x87regparm function attribute. * doc/invoke.texi: Document -mx87regparm. testsuite/ChangeLog: * gcc.target/i386/x87regparm-1.c: New test. * gcc.target/i386/x87regparm-2.c: New test. * gcc.target/i386/x87regparm-3.c: New test. * gcc.target/i386/x87regparm-4.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@118859 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/reg-stack.c')
-rw-r--r--gcc/reg-stack.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/gcc/reg-stack.c b/gcc/reg-stack.c
index 0b8b1565e0c..a96b6ef57fc 100644
--- a/gcc/reg-stack.c
+++ b/gcc/reg-stack.c
@@ -2553,11 +2553,28 @@ print_stack (FILE *file, stack s)
static int
convert_regs_entry (void)
{
+ tree params = DECL_ARGUMENTS (current_function_decl);
+ tree p;
+ HARD_REG_SET incoming_regs;
+ rtx inc_rtx;
+
int inserted = 0;
edge e;
edge_iterator ei;
- /* Load something into each stack register live at function entry.
+ /* Find out which registers were used as argument passing registers. */
+
+ CLEAR_HARD_REG_SET (incoming_regs);
+ for (p = params; p; p = TREE_CHAIN (p))
+ {
+ inc_rtx = DECL_INCOMING_RTL (p);
+
+ if (REG_P (inc_rtx)
+ && IN_RANGE (REGNO (inc_rtx), FIRST_STACK_REG, LAST_STACK_REG))
+ SET_HARD_REG_BIT (incoming_regs, REGNO (inc_rtx));
+ }
+
+ /* Load something into remaining stack register live at function entry.
Such live registers can be caused by uninitialized variables or
functions not returning values on all paths. In order to keep
the push/pop code happy, and to not scrog the register stack, we
@@ -2579,6 +2596,10 @@ convert_regs_entry (void)
bi->stack_in.reg[++top] = reg;
+ /* Skip argument passing registers. */
+ if (TEST_HARD_REG_BIT (incoming_regs, reg))
+ continue;
+
init = gen_rtx_SET (VOIDmode,
FP_MODE_REG (FIRST_STACK_REG, SFmode),
not_a_num);