aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1995-07-28 08:47:44 -0400
committerRichard Kenner <kenner@gcc.gnu.org>1995-07-28 08:47:44 -0400
commit4c876b4f9f832e19e45997c812a325787842d177 (patch)
tree44945585e0ea43aa0b0a4c702721e04ee0191eb5 /gcc
parent1fdf73384d0ac48ba735153438ce53e6e8234822 (diff)
downloadgcc-4c876b4f9f832e19e45997c812a325787842d177.zip
gcc-4c876b4f9f832e19e45997c812a325787842d177.tar.gz
gcc-4c876b4f9f832e19e45997c812a325787842d177.tar.bz2
(i960_function_epilogue): Don't clear g14 for functions with an argument block.
(i960_output_reg_insn): Likewise. (i960_output_call_insn): Clear g14 for functions wtih an argument block. From-SVN: r10178
Diffstat (limited to 'gcc')
-rw-r--r--gcc/config/i960/i960.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/gcc/config/i960/i960.c b/gcc/config/i960/i960.c
index 35ce318..202d734 100644
--- a/gcc/config/i960/i960.c
+++ b/gcc/config/i960/i960.c
@@ -1311,10 +1311,10 @@ i960_function_epilogue (file, size)
if (epilogue_string[0] != '\0')
fprintf (file, "%s", epilogue_string);
- /* Must clear g14 on return. */
+ /* Must clear g14 on return if this function set it.
+ Only varargs/stdarg functions modify g14. */
- if (current_function_args_size != 0
- || VARARGS_STDARG_FUNCTION (current_function_decl))
+ if (VARARGS_STDARG_FUNCTION (current_function_decl))
fprintf (file, "\tmov 0,g14\n");
fprintf (file, "\tret\n");
@@ -1362,8 +1362,13 @@ i960_output_call_insn (target, argsize_rtx, arg_pointer, insn)
output_asm_insn ("callx %0", operands);
+ /* If the caller sets g14 to the address of the argblock, then the caller
+ must clear it after the return. */
+
if (current_function_args_size != 0 || varargs_stdarg_function)
output_asm_insn ("mov r3,g14", operands);
+ else if (argsize > 48)
+ output_asm_insn ("mov 0,g14", operands);
return "";
}
@@ -1385,8 +1390,10 @@ i960_output_ret_insn (insn)
return lbuf;
}
- if (current_function_args_size != 0
- || VARARGS_STDARG_FUNCTION (current_function_decl))
+ /* Must clear g14 on return if this function set it.
+ Only varargs/stdarg functions modify g14. */
+
+ if (VARARGS_STDARG_FUNCTION (current_function_decl))
output_asm_insn ("mov 0,g14", 0);
if (i960_leaf_ret_reg >= 0)