[RTL] move rtl diagnostics out of toplev.h

Manuel López-Ibáñez lopezibanez@gmail.com
Mon Jun 28 09:02:00 GMT 2010


What the subject says. Bootstrapped on x86_64-linux-gnu. I move the
fatal* declarations to rtl.h because they are used by targets, they
don't require anything from diagnostics-core.h and I didn't want to
add rtl-error.h to every target file. If moving them to rtl-error.h is
desirable for some reason, they could always be moved in a follow-up
patch.

toplev.h is now free of diagnostic and rtl stuff, so it should be
possible to not include it anymore in many places.

OK?

Manuel.

2010-06-28  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	* toplev.h (_fatal_insn_not_found, _fatal_insn): Move declarations
	to rtl.h.
	(error_for_asm,	warning_for_asm): Move declarations to rtl-error.h.
	* rtl.h (_fatal_insn_not_found, _fatal_insn): Move declarations
	here.
	* rtl-error.h: New.
	* regrename.c: Do not include toplev.h. Include rtl-error.h.
	* rtl-error.c: Likewise.
	* reload.c: Likewise.
	* recog.c:  Likewise.
	* sel-sched.c: Likewise.
	* function.c: Likewise.
	* reg-stack.c: Likewise.
	* cfgrtl.c: Likewise.
	* reload1.c: Likewise.
	* final.c: Include rtl-error.
-------------- next part --------------
Index: gcc/regrename.c
===================================================================
--- gcc/regrename.c	(revision 161471)
+++ gcc/regrename.c	(working copy)
@@ -20,11 +20,11 @@
 
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
 #include "tm.h"
-#include "rtl.h"
+#include "rtl-error.h"
 #include "tm_p.h"
 #include "insn-config.h"
 #include "regs.h"
 #include "addresses.h"
 #include "hard-reg-set.h"
@@ -32,11 +32,10 @@
 #include "reload.h"
 #include "output.h"
 #include "function.h"
 #include "recog.h"
 #include "flags.h"
-#include "toplev.h"
 #include "obstack.h"
 #include "timevar.h"
 #include "tree-pass.h"
 #include "df.h"
 
Index: gcc/rtl-error.c
===================================================================
--- gcc/rtl-error.c	(revision 161471)
+++ gcc/rtl-error.c	(working copy)
@@ -20,15 +20,14 @@ along with GCC; see the file COPYING3.  
 
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
 #include "tm.h"
-#include "rtl.h"
+#include "rtl-error.h"
 #include "insn-attr.h"
 #include "insn-config.h"
 #include "input.h"
-#include "toplev.h"
 #include "intl.h"
 #include "diagnostic.h"
 
 static location_t location_for_asm (const_rtx);
 static void diagnostic_for_asm (const_rtx, const char *, va_list *, diagnostic_t) ATTRIBUTE_GCC_DIAG(2,0);
Index: gcc/rtl-error.h
===================================================================
--- gcc/rtl-error.h	(revision 0)
+++ gcc/rtl-error.h	(revision 0)
@@ -0,0 +1,24 @@
+/* RTL specific diagnostic subroutines for GCC
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3.  If not see
+<http://www.gnu.org/licenses/>.  */
+
+#include "rtl.h"
+#include "diagnostic-core.h"
+
+extern void error_for_asm (const_rtx, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
+extern void warning_for_asm (const_rtx, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
Index: gcc/reload.c
===================================================================
--- gcc/reload.c	(revision 161471)
+++ gcc/reload.c	(working copy)
@@ -92,11 +92,11 @@ a register with any other reload.  */
 
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
 #include "tm.h"
-#include "rtl.h"
+#include "rtl-error.h"
 #include "tm_p.h"
 #include "insn-config.h"
 #include "expr.h"
 #include "optabs.h"
 #include "recog.h"
@@ -106,11 +106,10 @@ a register with any other reload.  */
 #include "addresses.h"
 #include "hard-reg-set.h"
 #include "flags.h"
 #include "output.h"
 #include "function.h"
-#include "toplev.h"
 #include "params.h"
 #include "target.h"
 #include "ira.h"
 
 /* True if X is a constant that can be forced into the constant pool.  */
Index: gcc/final.c
===================================================================
--- gcc/final.c	(revision 161471)
+++ gcc/final.c	(working copy)
@@ -60,11 +60,12 @@ along with GCC; see the file COPYING3.  
 #include "flags.h"
 #include "hard-reg-set.h"
 #include "output.h"
 #include "except.h"
 #include "function.h"
-#include "toplev.h"
+#include "rtl-error.h"
+#include "toplev.h" /* exact_log2, floor_log2 */
 #include "reload.h"
 #include "intl.h"
 #include "basic-block.h"
 #include "target.h"
 #include "debug.h"
Index: gcc/toplev.h
===================================================================
--- gcc/toplev.h	(revision 161471)
+++ gcc/toplev.h	(working copy)
@@ -30,31 +30,19 @@ along with GCC; see the file COPYING3.  
 #define skip_leading_substring(whole,  part) \
    (strncmp (whole, part, strlen (part)) ? NULL : whole + strlen (part))
 
 extern int toplev_main (int, char **);
 extern void strip_off_ending (char *, int);
-extern void _fatal_insn_not_found (const_rtx, const char *, int, const char *)
-     ATTRIBUTE_NORETURN;
-extern void _fatal_insn (const char *, const_rtx, const char *, int, const char *)
-     ATTRIBUTE_NORETURN;
-
-#define fatal_insn(msgid, insn) \
-	_fatal_insn (msgid, insn, __FILE__, __LINE__, __FUNCTION__)
-#define fatal_insn_not_found(insn) \
-	_fatal_insn_not_found (insn, __FILE__, __LINE__, __FUNCTION__)
-
 extern void rest_of_decl_compilation (tree, int, int);
 extern void rest_of_type_compilation (tree, int);
 extern void tree_rest_of_compilation (tree);
 extern void init_optimization_passes (void);
 extern void finish_optimization_passes (void);
 extern bool enable_rtl_dump_file (void);
 
 extern void announce_function (tree);
 
-extern void error_for_asm (const_rtx, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
-extern void warning_for_asm (const_rtx, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
 extern void warn_deprecated_use (tree, tree);
 extern bool parse_optimize_options (tree, bool);
 
 #ifdef BUFSIZ
 extern void output_quoted_string	(FILE *, const char *);
Index: gcc/sel-sched.c
===================================================================
--- gcc/sel-sched.c	(revision 161471)
+++ gcc/sel-sched.c	(working copy)
@@ -19,21 +19,19 @@ along with GCC; see the file COPYING3.  
 
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
 #include "tm.h"
-#include "toplev.h"
-#include "rtl.h"
+#include "rtl-error.h"
 #include "tm_p.h"
 #include "hard-reg-set.h"
 #include "regs.h"
 #include "function.h"
 #include "flags.h"
 #include "insn-config.h"
 #include "insn-attr.h"
 #include "except.h"
-#include "toplev.h"
 #include "recog.h"
 #include "params.h"
 #include "target.h"
 #include "output.h"
 #include "timevar.h"
Index: gcc/recog.c
===================================================================
--- gcc/recog.c	(revision 161471)
+++ gcc/recog.c	(working copy)
@@ -22,22 +22,21 @@ along with GCC; see the file COPYING3.  
 
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
 #include "tm.h"
-#include "rtl.h"
+#include "rtl-error.h"
 #include "tm_p.h"
 #include "insn-config.h"
 #include "insn-attr.h"
 #include "hard-reg-set.h"
 #include "recog.h"
 #include "regs.h"
 #include "addresses.h"
 #include "expr.h"
 #include "function.h"
 #include "flags.h"
-#include "toplev.h"
 #include "basic-block.h"
 #include "output.h"
 #include "reload.h"
 #include "target.h"
 #include "timevar.h"
Index: gcc/function.c
===================================================================
--- gcc/function.c	(revision 161471)
+++ gcc/function.c	(working copy)
@@ -35,11 +35,11 @@ along with GCC; see the file COPYING3.  
 
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
 #include "tm.h"
-#include "rtl.h"
+#include "rtl-error.h"
 #include "tree.h"
 #include "flags.h"
 #include "except.h"
 #include "function.h"
 #include "expr.h"
@@ -49,11 +49,10 @@ along with GCC; see the file COPYING3.  
 #include "hard-reg-set.h"
 #include "insn-config.h"
 #include "recog.h"
 #include "output.h"
 #include "basic-block.h"
-#include "toplev.h"
 #include "hashtab.h"
 #include "ggc.h"
 #include "tm_p.h"
 #include "integrate.h"
 #include "langhooks.h"
Index: gcc/rtl.h
===================================================================
--- gcc/rtl.h	(revision 161471)
+++ gcc/rtl.h	(working copy)
@@ -2438,6 +2438,19 @@ extern void set_curr_insn_block (tree);
 extern tree get_curr_insn_block (void);
 extern int curr_insn_locator (void);
 extern bool optimize_insn_for_size_p (void);
 extern bool optimize_insn_for_speed_p (void);
 
+/* rtl-error.c */
+extern void _fatal_insn_not_found (const_rtx, const char *, int, const char *)
+     ATTRIBUTE_NORETURN;
+extern void _fatal_insn (const char *, const_rtx, const char *, int, const char *)
+     ATTRIBUTE_NORETURN;
+
+#define fatal_insn(msgid, insn) \
+	_fatal_insn (msgid, insn, __FILE__, __LINE__, __FUNCTION__)
+#define fatal_insn_not_found(insn) \
+	_fatal_insn_not_found (insn, __FILE__, __LINE__, __FUNCTION__)
+
+
+
 #endif /* ! GCC_RTL_H */
Index: gcc/reg-stack.c
===================================================================
--- gcc/reg-stack.c	(revision 161471)
+++ gcc/reg-stack.c	(working copy)
@@ -154,18 +154,17 @@
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
 #include "tm.h"
 #include "tree.h"
-#include "rtl.h"
+#include "rtl-error.h"
 #include "tm_p.h"
 #include "function.h"
 #include "insn-config.h"
 #include "regs.h"
 #include "hard-reg-set.h"
 #include "flags.h"
-#include "toplev.h"
 #include "recog.h"
 #include "output.h"
 #include "basic-block.h"
 #include "cfglayout.h"
 #include "reload.h"
Index: gcc/cfgrtl.c
===================================================================
--- gcc/cfgrtl.c	(revision 161471)
+++ gcc/cfgrtl.c	(working copy)
@@ -40,19 +40,18 @@ along with GCC; see the file COPYING3.  
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
 #include "tm.h"
 #include "tree.h"
-#include "rtl.h"
 #include "hard-reg-set.h"
 #include "basic-block.h"
 #include "regs.h"
 #include "flags.h"
 #include "output.h"
 #include "function.h"
 #include "except.h"
-#include "toplev.h"
+#include "rtl-error.h"
 #include "tm_p.h"
 #include "obstack.h"
 #include "insn-attr.h"
 #include "insn-config.h"
 #include "cfglayout.h"
Index: gcc/reload1.c
===================================================================
--- gcc/reload1.c	(revision 161471)
+++ gcc/reload1.c	(working copy)
@@ -24,11 +24,11 @@ along with GCC; see the file COPYING3.  
 #include "coretypes.h"
 #include "tm.h"
 
 #include "machmode.h"
 #include "hard-reg-set.h"
-#include "rtl.h"
+#include "rtl-error.h"
 #include "tm_p.h"
 #include "obstack.h"
 #include "insn-config.h"
 #include "flags.h"
 #include "function.h"
@@ -39,11 +39,10 @@ along with GCC; see the file COPYING3.  
 #include "basic-block.h"
 #include "df.h"
 #include "reload.h"
 #include "recog.h"
 #include "output.h"
-#include "toplev.h"
 #include "except.h"
 #include "tree.h"
 #include "ira.h"
 #include "target.h"
 #include "emit-rtl.h"


More information about the Gcc-patches mailing list