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]

Minor infrastructural change for trampolines


I'm checking this in, pre-approved by Richard Henderson.  No
functional changes in this patch.  Still builds on i686-pc-linux-gnu.

Index: gcc/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* function.c (adjust_trampoline_addr): New function.
	(trampoline_address): Call it instead of round_trampoline_addr().
	* tm.texi (TRAMPOLINE_ADJUST_ADDRESS): Document it.

Index: gcc/function.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/function.c,v
retrieving revision 1.234
diff -u -p -r1.234 function.c
--- gcc/function.c 2000/12/13 21:24:03 1.234
+++ gcc/function.c 2000/12/15 09:05:28
@@ -279,6 +279,7 @@ static void pad_below		PARAMS ((struct a
 					 tree));
 #endif
 static rtx round_trampoline_addr PARAMS ((rtx));
+static rtx adjust_trampoline_addr PARAMS ((rtx));
 static tree *identify_blocks_1	PARAMS ((rtx, tree *, tree *, tree *));
 static void reorder_blocks_1	PARAMS ((rtx, tree, varray_type *));
 static tree blocks_nreverse	PARAMS ((tree));
@@ -5553,7 +5554,7 @@ trampoline_address (function)
   for (link = trampoline_list; link; link = TREE_CHAIN (link))
     if (TREE_PURPOSE (link) == function)
       return
-	round_trampoline_addr (XEXP (RTL_EXPR_RTL (TREE_VALUE (link)), 0));
+	adjust_trampoline_addr (XEXP (RTL_EXPR_RTL (TREE_VALUE (link)), 0));
 
   for (fp = outer_function_chain; fp; fp = fp->next)
     for (link = fp->x_trampoline_list; link; link = TREE_CHAIN (link))
@@ -5561,7 +5562,7 @@ trampoline_address (function)
 	{
 	  tramp = fix_lexical_addr (XEXP (RTL_EXPR_RTL (TREE_VALUE (link)), 0),
 				    function);
-	  return round_trampoline_addr (tramp);
+	  return adjust_trampoline_addr (tramp);
 	}
 
   /* None exists; we must make one.  */
@@ -5612,7 +5613,7 @@ trampoline_address (function)
     }
 
   tramp = fix_lexical_addr (XEXP (tramp, 0), function);
-  return round_trampoline_addr (tramp);
+  return adjust_trampoline_addr (tramp);
 }
 
 /* Given a trampoline address,
@@ -5631,6 +5632,21 @@ round_trampoline_addr (tramp)
   tramp = expand_binop (Pmode, and_optab, temp,
 			GEN_INT (-TRAMPOLINE_ALIGNMENT / BITS_PER_UNIT),
 			temp, 0, OPTAB_LIB_WIDEN);
+#endif
+  return tramp;
+}
+
+/* Given a trampoline address, round it then apply any
+   platform-specific adjustments so that the result can be used for a
+   function call . */
+
+static rtx
+adjust_trampoline_addr (tramp)
+     rtx tramp;
+{
+  tramp = round_trampoline_addr (tramp);
+#ifdef TRAMPOLINE_ADJUST_ADDRESS
+  TRAMPOLINE_ADJUST_ADDRESS (tramp);
 #endif
   return tramp;
 }
Index: gcc/tm.texi
===================================================================
RCS file: /cvs/gcc/egcs/gcc/tm.texi,v
retrieving revision 1.154
diff -u -p -r1.154 tm.texi
--- gcc/tm.texi 2000/11/27 04:25:32 1.154
+++ gcc/tm.texi 2000/12/15 09:05:30
@@ -4034,6 +4034,16 @@ an RTX for the address of the nested fun
 RTX for the static chain value that should be passed to the function
 when it is called.
 
+@findex TRAMPOLINE_ADJUST_ADDRESS
+@item TRAMPOLINE_ADJUST_ADDRESS (@var{addr})
+A C statement that should perform any machine-specific adjustment in
+the address of the trampoline.  Its argument contains the address that
+was passed to @code{INITIALIZE_TRAMPOLINE}.  In case the address to be
+used for a function call should be different from the address in which
+the template was stored, the different address should be assigned to
+@var{addr}.  If this macro is not defined, @var{addr} will be used for
+function calls.
+
 @findex ALLOCATE_TRAMPOLINE
 @item ALLOCATE_TRAMPOLINE (@var{fp})
 A C expression to allocate run-time space for a trampoline.  The

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me

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