aboutsummaryrefslogtreecommitdiff
path: root/gcc/calls.c
diff options
context:
space:
mode:
authorRadovan Obradovic <robradovic@mips.com>2014-04-24 09:34:15 +0000
committerTom de Vries <vries@gcc.gnu.org>2014-04-24 09:34:15 +0000
commit4f660b159f4a050bc631930d20643d5533541d46 (patch)
tree12104592791a836124a5fa50178055b2071db3fd /gcc/calls.c
parentd996e61aaabdcd98f1a24adf5d7c19d3e76f48e0 (diff)
downloadgcc-4f660b159f4a050bc631930d20643d5533541d46.zip
gcc-4f660b159f4a050bc631930d20643d5533541d46.tar.gz
gcc-4f660b159f4a050bc631930d20643d5533541d46.tar.bz2
-fuse-caller-save - Add new reg-note REG_CALL_DECL
2014-04-24 Radovan Obradovic <robradovic@mips.com> Tom de Vries <tom@codesourcery.com> * reg-notes.def (REG_NOTE (CALL_DECL)): New reg-note REG_CALL_DECL. * calls.c (expand_call, emit_library_call_value_1): Add REG_CALL_DECL reg-note. * combine.c (distribute_notes): Handle REG_CALL_DECL reg-note. * emit-rtl.c (try_split): Same. Co-Authored-By: Tom de Vries <tom@codesourcery.com> From-SVN: r209744
Diffstat (limited to 'gcc/calls.c')
-rw-r--r--gcc/calls.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc/calls.c b/gcc/calls.c
index f0c92dd..e798c7a 100644
--- a/gcc/calls.c
+++ b/gcc/calls.c
@@ -3178,6 +3178,19 @@ expand_call (tree exp, rtx target, int ignore)
next_arg_reg, valreg, old_inhibit_defer_pop, call_fusage,
flags, args_so_far);
+ if (flag_use_caller_save)
+ {
+ rtx last, datum = NULL_RTX;
+ if (fndecl != NULL_TREE)
+ {
+ datum = XEXP (DECL_RTL (fndecl), 0);
+ gcc_assert (datum != NULL_RTX
+ && GET_CODE (datum) == SYMBOL_REF);
+ }
+ last = last_call_insn ();
+ add_reg_note (last, REG_CALL_DECL, datum);
+ }
+
/* If the call setup or the call itself overlaps with anything
of the argument setup we probably clobbered our call address.
In that case we can't do sibcalls. */
@@ -4205,6 +4218,14 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value,
valreg,
old_inhibit_defer_pop + 1, call_fusage, flags, args_so_far);
+ if (flag_use_caller_save)
+ {
+ rtx last, datum = orgfun;
+ gcc_assert (GET_CODE (datum) == SYMBOL_REF);
+ last = last_call_insn ();
+ add_reg_note (last, REG_CALL_DECL, datum);
+ }
+
/* Right-shift returned value if necessary. */
if (!pcc_struct_value
&& TYPE_MODE (tfom) != BLKmode