This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH][04/10] -fuse-caller-save - Add TARGET_FN_OTHER_HARD_REG_USAGE hook


Vladimir,



This patch adds a TARGET_FN_OTHER_HARD_REG_USAGE hook.  The hook is used to

list hard registers that are set or clobbered by a call to a function, but are

not listed as such in the function body, such as f.i. registers clobbered by

veneers inserted by the linker.



Thanks,

  -Tom



2013-03-29  Radovan Obradovic  <robradovic@mips.com>

            Tom de Vries  <tom@codesourcery.com>



	* hooks.c (hook_void_hard_reg_set_containerp): New function.

	* hooks.h (hook_void_hard_reg_set_containerp): 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 cbbc82d..3bf7abe 100644

--- a/gcc/doc/tm.texi

+++ b/gcc/doc/tm.texi

@@ -3074,6 +3074,7 @@ This describes the stack layout and calling conventions.

 * Profiling::

 * Tail Calls::

 * Stack Smashing Protection::

+* Miscellaneous Register Hooks::

 @end menu

 

 @node Frame Layout

@@ -4999,6 +5000,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} void 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 be defined to provide registers that cannot be found by examination of the final RTL representation of a function.

+@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 dfba947..4dfd8aa 100644

--- a/gcc/doc/tm.texi.in

+++ b/gcc/doc/tm.texi.in

@@ -3042,6 +3042,7 @@ This describes the stack layout and calling conventions.

 * Profiling::

 * Tail Calls::

 * Stack Smashing Protection::

+* Miscellaneous Register Hooks::

 @end menu

 

 @node Frame Layout

@@ -4922,6 +4923,12 @@ normally defined in @file{libgcc2.c}.

 

 @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 3b54dfa..e038a95 100644

--- a/gcc/hooks.c

+++ b/gcc/hooks.c

@@ -446,3 +446,11 @@ void

 hook_void_gcc_optionsp (struct gcc_options *opts ATTRIBUTE_UNUSED)

 {

 }

+

+/* Generic hook that takes a struct hard_reg_set_container * and returns

+   void.  */

+

+void

+hook_void_hard_reg_set_containerp (struct hard_reg_set_container *regs ATTRIBUTE_UNUSED)

+{

+}

diff --git a/gcc/hooks.h b/gcc/hooks.h

index 50bcc6a..44decdf 100644

--- a/gcc/hooks.h

+++ b/gcc/hooks.h

@@ -69,6 +69,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 void hook_void_hard_reg_set_containerp (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 831cad8..e8f7c4a 100644

--- a/gcc/target.def

+++ b/gcc/target.def

@@ -2850,6 +2850,17 @@ DEFHOOK

  void, (bitmap regs),

  hook_void_bitmap)

 

+/* For targets that need to mark extra registers as clobbered on entry to

+   the function, they should define this target hook and set their

+   bits in the struct hard_reg_set_container passed in.  */

+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 be defined to provide registers that\

+ cannot be found by examination of the final RTL representation of a function.",

+ void, (struct hard_reg_set_container *regs),

+ hook_void_hard_reg_set_containerp)

+

 /* Fill in additional registers set up by prologue into a regset.  */

 DEFHOOK

 (set_up_by_prologue,

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]