[patch] Move decl_default_tls_model prototype to output.h, make more #include rtl.h's redundant

Steven Bosscher stevenb.gcc@gmail.com
Tue May 25 23:33:00 GMT 2010


Hi,

One step closer to an RTL-free set of front ends.
decl_default_tls_model is used by almost all front ends, but it was
declared in rtl.h.

I've moved it to output.h for now, because there are other varasm.c
functions there that influence how a decl is treated by the middle end
(see e.g. declare_weak).  I think there should be a varasm.h or
something like that, to make an interface between the front ends and
the middle end for how to deal with decls. But that is for later.
Prio-1 for me is to avoid including rtl.h and related files in the
front ends, and this patch is good enough for that purpose.

Bootstrapped and tested on x86_64-unknown-linux-gnu.  OK for trunk?


There are only a few rtl.h references left in target independent code:
via expr.h in c-common.c, c-typeck.c, java/builtins.c,
fortran/f95-lang.c, ada/gcc-interface/decl.c, and lto/lto-lang.c (?!)
and directly in java/builtins.c and ada/gcc-interface/trans.c. Those
are up next. Is it OK if I consider approval of the middle-end bits
required but removal of rtl.h and/or expr.h from these front-end files
as obvious?

Ciao!
Steven


gcc/ChangeLog:
	* rtl.h (decl_default_tls_model): Move prototype from here...
	* output.h: ...to here.
	* c-decl.c: Do not include rtl.h.
	* c-pragma.c: Likewise.
	* c-parser.c: Likewise.
	* c-gimplify.c: Likewise.  And also not hard-reg-set.
	* c-common.c: Do not include rtl.h.  Include tm_p.h and add a
	FIXME note for it.  Add a FIXME note for expr.h.
	* config/i386/i386-protos.h (ix86_enum_va_list, ix86_fn_abi_va_list,
	ix86_canonical_va_list_type): Make visible even if RTX_CODE is not
	defined.

cp/ChangeLog:
	* decl.c: Do not include rtl.h
	* semantics.c: Likewise.

ada/ChangeLog:
	* gcc-interface/utils.c: Do not include rtl.h.

fortran/ChangeLog:
	* trans-common.c: Do not include rtl.h, include output.h instead.
	* trans-decl.c: Likewise.



Index: rtl.h
===================================================================
--- rtl.h	(revision 159844)
+++ rtl.h	(working copy)
@@ -2373,7 +2373,6 @@ extern rtx emit_library_call_value (rtx, rtx, enum

 /* In varasm.c */
 extern void init_varasm_once (void);
-extern enum tls_model decl_default_tls_model (const_tree);

 extern rtx make_debug_expr_from_rtl (const_rtx);

Index: output.h
===================================================================
--- output.h	(revision 159844)
+++ output.h	(working copy)
@@ -164,6 +164,9 @@ extern void weak_finish (void);
 /* Emit any pending emutls declarations and initializations.  */
 extern void emutls_finish (void);

+/* Return the default TLS model for a given variable.  */
+extern enum tls_model decl_default_tls_model (const_tree);
+
 /* Decode an `asm' spec for a declaration as a register name.
    Return the register number, or -1 if nothing specified,
    or -2 if the ASMSPEC is not `cc' or `memory' and is not recognized,
Index: c-decl.c
===================================================================
--- c-decl.c	(revision 159844)
+++ c-decl.c	(working copy)
@@ -34,7 +34,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "intl.h"
 #include "tree.h"
 #include "tree-inline.h"
-#include "rtl.h"
 #include "flags.h"
 #include "function.h"
 #include "output.h"
Index: c-pragma.c
===================================================================
--- c-pragma.c	(revision 159844)
+++ c-pragma.c	(working copy)
@@ -22,7 +22,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "system.h"
 #include "coretypes.h"
 #include "tm.h"
-#include "rtl.h"
 #include "tree.h"
 #include "function.h"		/* For cfun.  FIXME: Does the parser know
 				   when it is inside a function, so that
Index: c-parser.c
===================================================================
--- c-parser.c	(revision 159844)
+++ c-parser.c	(working copy)
@@ -42,7 +42,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "coretypes.h"
 #include "tm.h"			/* For rtl.h: needs enum reg_class.  */
 #include "tree.h"
-#include "rtl.h"		/* For decl_default_tls_model.  */
 #include "langhooks.h"
 #include "input.h"
 #include "cpplib.h"
Index: c-gimplify.c
===================================================================
--- c-gimplify.c	(revision 159844)
+++ c-gimplify.c	(working copy)
@@ -32,7 +32,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "c-tree.h"
 #include "c-common.h"
 #include "gimple.h"
-#include "hard-reg-set.h"
 #include "basic-block.h"
 #include "tree-flow.h"
 #include "tree-inline.h"
@@ -40,7 +39,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "langhooks.h"
 #include "langhooks-def.h"
 #include "flags.h"
-#include "rtl.h"
 #include "toplev.h"
 #include "tree-dump.h"
 #include "c-pretty-print.h"
Index: c-common.c
===================================================================
--- c-common.c	(revision 159844)
+++ c-common.c	(working copy)
@@ -28,9 +28,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "flags.h"
 #include "output.h"
 #include "c-pragma.h"
-#include "rtl.h"
 #include "ggc.h"
-#include "expr.h" /* For vector_mode_valid_p */
 #include "c-common.h"
 #include "tm_p.h"
 #include "obstack.h"
@@ -49,6 +47,14 @@ along with GCC; see the file COPYING3.  If not see
 #include "target-def.h"
 #include "libfuncs.h"

+/* FIXME: Still need to include rtl.h here (via expr.h) in a front-end file.
+   Pretend this is a back-end file.  */
+#define IN_GCC_BACKEND
+#include "expr.h" /* For vector_mode_valid_p */
+
+/* FIXME: Needed for TARGET_ENUM_VA_LIST, which should be a target hook.  */
+#include "tm_p.h"
+
 cpp_reader *parse_in;		/* Declared in c-pragma.h.  */

 /* The following symbols are subsumed in the c_global_trees array, and
Index: cp/decl.c
===================================================================
--- cp/decl.c	(revision 159844)
+++ cp/decl.c	(working copy)
@@ -56,8 +56,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "splay-tree.h"
 #include "plugin.h"

-#include "rtl.h"          /* For decl_default_tls_model.  */
-
 static tree grokparms (tree parmlist, tree *);
 static const char *redeclaration_error_message (tree, tree);

Index: cp/semantics.c
===================================================================
--- cp/semantics.c	(revision 159844)
+++ cp/semantics.c	(working copy)
@@ -46,8 +46,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "gimple.h"
 #include "bitmap.h"

-#include "rtl.h"          /* For decl_default_tls_model.  */
-
 /* There routines provide a modular interface to perform many parsing
    operations.  They may therefore be used during actual parsing, or
    during template instantiation, which may be regarded as a
Index: ada/gcc-interface/utils.c
===================================================================
--- ada/gcc-interface/utils.c	(revision 159844)
+++ ada/gcc-interface/utils.c	(working copy)
@@ -40,7 +40,6 @@
 #include "tree-dump.h"
 #include "tree-inline.h"
 #include "tree-iterator.h"
-#include "rtl.h"		/* For decl_default_tls_model.  */

 #include "ada.h"
 #include "types.h"
Index: fortran/trans-common.c
===================================================================
--- fortran/trans-common.c	(revision 159844)
+++ fortran/trans-common.c	(working copy)
@@ -96,10 +96,10 @@ along with GCC; see the file COPYING3.  If not see
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
+#include "tm.h"
 #include "tree.h"
 #include "toplev.h"	/* For exact_log2.  */
-#include "tm.h"		/* For rtl.h.  */
-#include "rtl.h"	/* For decl_default_tls_model.  */
+#include "output.h"	/* For decl_default_tls_model.  */
 #include "gfortran.h"
 #include "trans.h"
 #include "trans-types.h"
Index: fortran/trans-decl.c
===================================================================
--- fortran/trans-decl.c	(revision 159844)
+++ fortran/trans-decl.c	(working copy)
@@ -24,13 +24,13 @@ along with GCC; see the file COPYING3.  If not see
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
+#include "tm.h"
 #include "tree.h"
 #include "tree-dump.h"
 #include "gimple.h"	/* For create_tmp_var_raw.  */
 #include "ggc.h"
 #include "toplev.h"	/* For announce_function/internal_error.  */
-#include "tm.h"		/* For rtl.h.  */
-#include "rtl.h"	/* For decl_default_tls_model.  */
+#include "output.h"	/* For decl_default_tls_model.  */
 #include "target.h"
 #include "function.h"
 #include "flags.h"
Index: config/i386/i386-protos.h
===================================================================
--- config/i386/i386-protos.h	(revision 159844)
+++ config/i386/i386-protos.h	(working copy)
@@ -144,9 +144,6 @@ extern void ix86_free_from_memory (enum machine_mo
 extern enum calling_abi ix86_cfun_abi (void);
 extern enum calling_abi ix86_function_type_abi (const_tree);
 extern void ix86_call_abi_override (const_tree);
-extern tree ix86_fn_abi_va_list (tree);
-extern tree ix86_canonical_va_list_type (tree);
-extern int ix86_enum_va_list (int, const char **, tree *);
 extern int ix86_reg_parm_stack_space (const_tree);

 extern void ix86_split_fp_branch (enum rtx_code code, rtx, rtx,
@@ -190,11 +187,15 @@ extern void init_cumulative_args (CUMULATIVE_ARGS
 extern rtx function_arg (CUMULATIVE_ARGS *, enum machine_mode, tree, int);
 extern void function_arg_advance (CUMULATIVE_ARGS *, enum machine_mode,
 				  tree, int);
-#endif
+#endif	/* TREE_CODE  */

-#endif
+#endif	/* RTX_CODE  */

 #ifdef TREE_CODE
+extern int ix86_enum_va_list (int, const char **, tree *);
+extern tree ix86_fn_abi_va_list (tree);
+extern tree ix86_canonical_va_list_type (tree);
+
 extern int ix86_return_pops_args (tree, tree, int);

 extern int ix86_data_alignment (tree, int);



More information about the Gcc-patches mailing list