R.
fuse-caller-save-hook.patch
2013-04-29 Radovan Obradovic <robrado...@mips.com>
Tom de Vries <t...@codesourcery.com>
* hooks.c (hook_bool_hard_reg_set_containerp_false): New function.
* hooks.h (hook_bool_hard_reg_set_containerp_false): Declare.
* target.def (fn_other_hard_reg_usage): New DEFHOOK.
* doc/tm.texi.in (@node Stack and Calling): Add Miscellaneous Register
Hooks to @menu.
(@node Miscellaneous Register Hooks): New node.
(@hook TARGET_FN_OTHER_HARD_REG_USAGE): New hook.
* doc/tm.texi: Regenerate.
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index f204936..1bae6bb 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -3091,6 +3091,7 @@ This describes the stack layout and calling conventions.
* Profiling::
* Tail Calls::
* Stack Smashing Protection::
+* Miscellaneous Register Hooks::
@end menu
@node Frame Layout
@@ -5016,6 +5017,14 @@ normally defined in @file{libgcc2.c}.
Whether this target supports splitting the stack when the options described
in @var{opts} have been passed. This is called after options have been parsed,
so the target may reject splitting the stack in some configurations. The
default version of this hook returns false. If @var{report} is true, this
function may issue a warning or error; if @var{report} is false, it must simply
return a value
@end deftypefn
+@node Miscellaneous Register Hooks
+@subsection Miscellaneous register hooks
+@cindex miscellaneous register hooks
+
+@deftypefn {Target Hook} bool TARGET_FN_OTHER_HARD_REG_USAGE (struct
hard_reg_set_container *@var{regs})
+Add any hard registers to @var{regs} that are set or clobbered by a call to
the function. This hook only needs to add registers that cannot be found by
examination of the final RTL representation of a function. This hook returns
true if it managed to determine which registers need to be added. The default
version of this hook returns false.
+@end deftypefn
+
@node Varargs
@section Implementing the Varargs Macros
@cindex varargs implementation
diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in
index 50f412c..bf75446 100644
--- a/gcc/doc/tm.texi.in
+++ b/gcc/doc/tm.texi.in
@@ -2720,6 +2720,7 @@ This describes the stack layout and calling conventions.
* Profiling::
* Tail Calls::
* Stack Smashing Protection::
+* Miscellaneous Register Hooks::
@end menu
@node Frame Layout
@@ -3985,6 +3986,12 @@ the function prologue. Normally, the profiling code
comes after.
@hook TARGET_SUPPORTS_SPLIT_STACK
+@node Miscellaneous Register Hooks
+@subsection Miscellaneous register hooks
+@cindex miscellaneous register hooks
+
+@hook TARGET_FN_OTHER_HARD_REG_USAGE
+
@node Varargs
@section Implementing the Varargs Macros
@cindex varargs implementation
diff --git a/gcc/hooks.c b/gcc/hooks.c
index 1c67bdf..44f1d06 100644
--- a/gcc/hooks.c
+++ b/gcc/hooks.c
@@ -467,3 +467,12 @@ void
hook_void_gcc_optionsp (struct gcc_options *opts ATTRIBUTE_UNUSED)
{
}
+
+/* Generic hook that takes a struct hard_reg_set_container * and returns
+ false. */
+
+bool
+hook_bool_hard_reg_set_containerp_false (struct hard_reg_set_container *regs
ATTRIBUTE_UNUSED)
+{
+ return false;
+}
diff --git a/gcc/hooks.h b/gcc/hooks.h
index 896b41d..f0afdbd 100644
--- a/gcc/hooks.h
+++ b/gcc/hooks.h
@@ -73,6 +73,7 @@ extern void hook_void_tree (tree);
extern void hook_void_tree_treeptr (tree, tree *);
extern void hook_void_int_int (int, int);
extern void hook_void_gcc_optionsp (struct gcc_options *);
+extern bool hook_bool_hard_reg_set_containerp_false (struct
hard_reg_set_container *);
extern int hook_int_uint_mode_1 (unsigned int, enum machine_mode);
extern int hook_int_const_tree_0 (const_tree);
diff --git a/gcc/target.def b/gcc/target.def
index 3a64cd1..8bee4c3 100644
--- a/gcc/target.def
+++ b/gcc/target.def
@@ -5130,6 +5130,19 @@ FRAME_POINTER_REGNUM, ARG_POINTER_REGNUM, and the
PIC_OFFSET_TABLE_REGNUM.",
void, (bitmap regs),
hook_void_bitmap)
+/* Targets should define this target hook to mark which registers are clobbered
+ on entry to the function. They should should set their bits in the struct
+ hard_reg_set_container passed in, and return true. */
+DEFHOOK
+(fn_other_hard_reg_usage,
+ "Add any hard registers to @var{regs} that are set or clobbered by a call to\
+ the function. This hook only needs to add registers that cannot be found by\
+ examination of the final RTL representation of a function. This hook returns\
+ true if it managed to determine which registers need to be added. The\
+ default version of this hook returns false.",
+ bool, (struct hard_reg_set_container *regs),
+ hook_bool_hard_reg_set_containerp_false)
+
/* Fill in additional registers set up by prologue into a regset. */
DEFHOOK
(set_up_by_prologue,