aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Wilson <wilson@gcc.gnu.org>1993-01-25 12:24:03 -0800
committerJim Wilson <wilson@gcc.gnu.org>1993-01-25 12:24:03 -0800
commit3ea1fdd31863e664a1beffbec13556184a1848cf (patch)
treea9c7823deb1e83c63cd1e8de37c09764dd7a323e
parent8b1d5eb76b5f9f8aba560fa3b5d92c6f0d821565 (diff)
downloadgcc-3ea1fdd31863e664a1beffbec13556184a1848cf.zip
gcc-3ea1fdd31863e664a1beffbec13556184a1848cf.tar.gz
gcc-3ea1fdd31863e664a1beffbec13556184a1848cf.tar.bz2
(sparc_builtin_saveregs): New function.
From-SVN: r3337
-rw-r--r--gcc/config/sparc/sparc.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index da1c241..5b50196 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -2259,6 +2259,42 @@ output_function_epilogue (file, size, leaf_function)
target_flags |= old_target_epilogue;
}
}
+
+/* Do what is necessary for `va_start'. The argument is ignored;
+ We look at the current function to determine if stdarg or varargs
+ is used and return the address of the first unnamed parameter. */
+
+rtx
+sparc_builtin_saveregs (arglist)
+ tree arglist;
+{
+ tree fntype = TREE_TYPE (current_function_decl);
+ int stdarg = (TYPE_ARG_TYPES (fntype) != 0
+ && (TREE_VALUE (tree_last (TYPE_ARG_TYPES (fntype)))
+ != void_type_node));
+ int first_reg = current_function_args_info;
+ rtx address;
+ int regno;
+
+ if (! stdarg)
+ first_reg = 0;
+
+ for (regno = first_reg; regno < NPARM_REGS; regno++)
+ emit_move_insn (gen_rtx (MEM, word_mode,
+ gen_rtx (PLUS, Pmode,
+ frame_pointer_rtx,
+ GEN_INT (STACK_POINTER_OFFSET
+ + UNITS_PER_WORD * regno))),
+ gen_rtx (REG, word_mode, BASE_INCOMING_ARG_REG (word_mode)
+ + regno));
+
+ address = gen_rtx (PLUS, Pmode,
+ frame_pointer_rtx,
+ GEN_INT (STACK_POINTER_OFFSET
+ + UNITS_PER_WORD * first_reg));
+
+ return address;
+}
/* Return the string to output a conditional branch to LABEL, which is
the operand number of the label. OP is the conditional expression. The