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] Adjust set_stack_check_libfunc, remove one include rtl.h in ada's trans.c


Hi,

The Ada front end interfaces with explow for its stack checking code.
This introduces a dependency on rtl.h. With the attached patch, I'm
trying to break that dependency.

I've moved the declaration of set_stack_check_libfunc to libfuncs.h
and I've adjusted the function so that it accepts the libfunc name as
a string instead of a SYMBOL_REF. It's still a bit of an uncomfortable
interface, but it's better in the sense that there's one less Ada
dependency on rtl headers (the last one remaining is the debug stuff I
just sent out an RFH for).

Boostrapped on x86_64-unknown-linux-gnu. Testing in progress but I am
not sure if testing covers this stack checking code or not.
Is this OK for trunk if testing shows no new regressions?

Ciao!
Steven


gcc/ChangeLog:
        * explow.c (set_stack_check_libfunc): Adjust to accept name as a
        string instead of SYMBOL_REF rtx.
        * rtl.h (set_stack_check_libfunc): Move prototype from here...
        * libfuncs.h: ...to here.  Adjust for explow.c change.

ada/ChangeLog:
        * gcc-interface/trans.c: Do not include rtl.h, insclude libfuncs.h.
        (gigi): Adjust call to set_stack_check_libfunc.

Index: explow.c
===================================================================
--- explow.c    (revision 159861)
+++ explow.c    (working copy)
@@ -33,6 +33,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "function.h"
 #include "expr.h"
 #include "optabs.h"
+#include "libfuncs.h"
 #include "hard-reg-set.h"
 #include "insn-config.h"
 #include "ggc.h"
@@ -1346,9 +1347,10 @@ allocate_dynamic_stack_space (rtx size, rtx target
 static GTY(()) rtx stack_check_libfunc;

 void
-set_stack_check_libfunc (rtx libfunc)
+set_stack_check_libfunc (const char *libfunc_name)
 {
-  stack_check_libfunc = libfunc;
+  gcc_assert (stack_check_libfunc == NULL_RTX);
+  stack_check_libfunc = gen_rtx_SYMBOL_REF (Pmode, libfunc_name);
 }

 /* Emit one stack probe at ADDRESS, an address within the stack.  */
Index: rtl.h
===================================================================
--- rtl.h       (revision 159861)
+++ rtl.h       (working copy)
@@ -1548,7 +1548,6 @@ extern int currently_expanding_to_rtl;
 extern int ceil_log2 (unsigned HOST_WIDE_INT);

 /* In explow.c */
-extern void set_stack_check_libfunc (rtx);
 extern HOST_WIDE_INT trunc_int_for_mode        (HOST_WIDE_INT, enum
machine_mode);
 extern rtx plus_constant (rtx, HOST_WIDE_INT);

Index: libfuncs.h
===================================================================
--- libfuncs.h  (revision 159861)
+++ libfuncs.h  (working copy)
@@ -71,4 +71,7 @@ extern GTY(()) rtx libfunc_table[LTI_MAX];

 #define gcov_flush_libfunc     (libfunc_table[LTI_gcov_flush])

+/* In explow.c */
+extern void set_stack_check_libfunc (const char *);
+
 #endif /* GCC_LIBFUNCS_H */
Index: ada/gcc-interface/trans.c
===================================================================
--- ada/gcc-interface/trans.c   (revision 159861)
+++ ada/gcc-interface/trans.c   (working copy)
@@ -29,11 +29,9 @@
 #include "tm.h"
 #include "tree.h"
 #include "flags.h"
-#include "rtl.h"       /* FIXME: For set_stack_check_libfunc and
-                          gen_rtx_SYMBOL_REF -- here is a front end
-                          still trying to generate RTL!  */
 #include "ggc.h"
 #include "output.h"
+#include "libfuncs.h"  /* For set_stack_check_libfunc.  */
 #include "tree-iterator.h"
 #include "gimple.h"

@@ -313,7 +311,7 @@ gigi (Node_Id gnat_root, int max_gnat_node, int nu

   /* Enable GNAT stack checking method if needed */
   if (!Stack_Check_Probes_On_Target)
-    set_stack_check_libfunc (gen_rtx_SYMBOL_REF (Pmode, "_gnat_stack_check"));
+    set_stack_check_libfunc ("_gnat_stack_check");

   /* Retrieve alignment settings.  */
   double_float_alignment = get_target_double_float_alignment ();


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