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]

Re: Annotate GCC sanity checking by cold attribute


> On June 8, 2017 5:27:24 PM GMT+02:00, Jan Hubicka <hubicka@ucw.cz> wrote:
> >Hi,
> >this patch adds cold attributes to (some of) our internal checking. 
> >This makes
> >it possible to to propagate zero counts on these and produce bit better
> >code
> >(especially for checking enabled compiler).
> >
> >Bootstrapped/regtested x86_64-linux, comited.
> 
> I wonder if we shouldn't annotate exit() with non-cold instead :)

I think this has still chance for false positives i.e. for embedded stuff
that does everything from infinite loop.
It kind of sucks, yes ;)

Honza
> 
> >Honza
> >
> >	* system.h (fancy_abort): Annotate by ATTRIBUTE_COLD.
> >	* rtl.h (rtl_check_failed_bounds, rtl_check_failed_type1,
> >	rtl_check_failed_type2, rtl_check_failed_code1,
> >	rtl_check_failed_code2, rtl_check_failed_code_mode,
> >	rtl_check_failed_block_symbol, cwi_check_failed_bounds,
> >	rtvec_check_failed_bounds, rtl_check_failed_flag,
> >	_fatal_insn_not_found, _fatal_insn): Likewise.
> >	* tree.h (tree_contains_struct_check_failed,
> >	tree_check_failed, tree_not_check_failed,
> >	tree_class_check_failed, tree_range_check_failed,
> >	tree_not_class_check_failed, tree_int_cst_elt_check_failed,
> >	tree_vec_elt_check_failed, phi_node_elt_check_failed,
> >	tree_operand_check_failed, omp_clause_check_failed,
> >	omp_clause_operand_check_failed, omp_clause_range_check_failed):
> >	Likewise.
> >	* cp/cp-tree.h (lang_check_failed): Annotate by ATTRIBUTE_COLD.
> >
> >Index: system.h
> >===================================================================
> >--- system.h	(revision 249013)
> >+++ system.h	(working copy)
> >@@ -722,7 +722,8 @@ extern int vsnprintf (char *, size_t, co
> > 
> > /* Redefine abort to report an internal error w/o coredump, and
> >    reporting the location of the error in the source file.  */
> >-extern void fancy_abort (const char *, int, const char *)
> >ATTRIBUTE_NORETURN;
> >+extern void fancy_abort (const char *, int, const char *)
> >+					 ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
> > #define abort() fancy_abort (__FILE__, __LINE__, __FUNCTION__)
> > 
> > /* Use gcc_assert(EXPR) to test invariants.  */
> >Index: rtl.h
> >===================================================================
> >--- rtl.h	(revision 249013)
> >+++ rtl.h	(working copy)
> >@@ -1148,30 +1148,30 @@ is_a_helper <rtx_note *>::test (rtx_insn
> > 
> >extern void rtl_check_failed_bounds (const_rtx, int, const char *, int,
> > 				     const char *)
> >-    ATTRIBUTE_NORETURN;
> >+    ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
> >extern void rtl_check_failed_type1 (const_rtx, int, int, const char *,
> >int,
> > 				    const char *)
> >-    ATTRIBUTE_NORETURN;
> >+    ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
> >extern void rtl_check_failed_type2 (const_rtx, int, int, int, const
> >char *,
> > 				    int, const char *)
> >-    ATTRIBUTE_NORETURN;
> >+    ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
> >extern void rtl_check_failed_code1 (const_rtx, enum rtx_code, const
> >char *,
> > 				    int, const char *)
> >-    ATTRIBUTE_NORETURN;
> >+    ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
> >extern void rtl_check_failed_code2 (const_rtx, enum rtx_code, enum
> >rtx_code,
> > 				    const char *, int, const char *)
> >-    ATTRIBUTE_NORETURN;
> >+    ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
> >extern void rtl_check_failed_code_mode (const_rtx, enum rtx_code,
> >machine_mode,
> > 					bool, const char *, int, const char *)
> >-    ATTRIBUTE_NORETURN;
> >+    ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
> >extern void rtl_check_failed_block_symbol (const char *, int, const
> >char *)
> >-    ATTRIBUTE_NORETURN;
> >+    ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
> >extern void cwi_check_failed_bounds (const_rtx, int, const char *, int,
> > 				     const char *)
> >-    ATTRIBUTE_NORETURN;
> >+    ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
> >extern void rtvec_check_failed_bounds (const_rtvec, int, const char *,
> >int,
> > 				       const char *)
> >-    ATTRIBUTE_NORETURN;
> >+    ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
> > 
> > #else   /* not ENABLE_RTL_CHECKING */
> > 
> >@@ -1269,7 +1269,7 @@ extern void rtvec_check_failed_bounds (c
> > 
> >extern void rtl_check_failed_flag (const char *, const_rtx, const char
> >*,
> > 				   int, const char *)
> >-    ATTRIBUTE_NORETURN
> >+    ATTRIBUTE_NORETURN ATTRIBUTE_COLD
> >     ;
> > 
> > #else	/* not ENABLE_RTL_FLAG_CHECKING */
> >@@ -3793,9 +3793,9 @@ extern location_t curr_insn_location (vo
> > 
> > /* rtl-error.c */
> >extern void _fatal_insn_not_found (const_rtx, const char *, int, const
> >char *)
> >-     ATTRIBUTE_NORETURN;
> >+     ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
> >extern void _fatal_insn (const char *, const_rtx, const char *, int,
> >const char *)
> >-     ATTRIBUTE_NORETURN;
> >+     ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
> > 
> > #define fatal_insn(msgid, insn) \
> > 	_fatal_insn (msgid, insn, __FILE__, __LINE__, __FUNCTION__)
> >Index: tree.h
> >===================================================================
> >--- tree.h	(revision 249013)
> >+++ tree.h	(working copy)
> >@@ -358,45 +358,45 @@ as_internal_fn (combined_fn code)
> > extern void tree_contains_struct_check_failed (const_tree,
> > 					       const enum tree_node_structure_enum,
> > 					       const char *, int, const char *)
> >-  ATTRIBUTE_NORETURN;
> >+  ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
> > 
> >extern void tree_check_failed (const_tree, const char *, int, const
> >char *,
> >-			       ...) ATTRIBUTE_NORETURN;
> >+			       ...) ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
> >extern void tree_not_check_failed (const_tree, const char *, int, const
> >char *,
> >-				   ...) ATTRIBUTE_NORETURN;
> >+				   ...) ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
> >extern void tree_class_check_failed (const_tree, const enum
> >tree_code_class,
> > 				     const char *, int, const char *)
> >-    ATTRIBUTE_NORETURN;
> >+    ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
> > extern void tree_range_check_failed (const_tree, const char *, int,
> > 				     const char *, enum tree_code,
> > 				     enum tree_code)
> >-    ATTRIBUTE_NORETURN;
> >+    ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
> > extern void tree_not_class_check_failed (const_tree,
> > 					 const enum tree_code_class,
> > 					 const char *, int, const char *)
> >-    ATTRIBUTE_NORETURN;
> >+    ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
> > extern void tree_int_cst_elt_check_failed (int, int, const char *,
> > 					   int, const char *)
> >-    ATTRIBUTE_NORETURN;
> >+    ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
> > extern void tree_vec_elt_check_failed (int, int, const char *,
> > 				       int, const char *)
> >-    ATTRIBUTE_NORETURN;
> >+    ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
> > extern void phi_node_elt_check_failed (int, int, const char *,
> > 				       int, const char *)
> >-    ATTRIBUTE_NORETURN;
> >+    ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
> > extern void tree_operand_check_failed (int, const_tree,
> > 				       const char *, int, const char *)
> >-    ATTRIBUTE_NORETURN;
> >+    ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
> > extern void omp_clause_check_failed (const_tree, const char *, int,
> > 				     const char *, enum omp_clause_code)
> >-    ATTRIBUTE_NORETURN;
> >+    ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
> >extern void omp_clause_operand_check_failed (int, const_tree, const
> >char *,
> > 				             int, const char *)
> >-    ATTRIBUTE_NORETURN;
> >+    ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
> >extern void omp_clause_range_check_failed (const_tree, const char *,
> >int,
> > 			       const char *, enum omp_clause_code,
> > 			       enum omp_clause_code)
> >-    ATTRIBUTE_NORETURN;
> >+    ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
> > 
> > #else /* not ENABLE_TREE_CHECKING, or not gcc */
> > 
> >Index: cp/cp-tree.h
> >===================================================================
> >--- cp/cp-tree.h	(revision 249013)
> >+++ cp/cp-tree.h	(working copy)
> >@@ -6819,7 +6819,8 @@ extern void cp_free_lang_data 			(tree t
> > extern tree force_target_expr			(tree, tree, tsubst_flags_t);
> > extern tree build_target_expr_with_type		(tree, tree, tsubst_flags_t);
> > extern void lang_check_failed			(const char *, int,
> >-						 const char *) ATTRIBUTE_NORETURN;
> >+						 const char *) ATTRIBUTE_NORETURN
> >+						 ATTRIBUTE_COLD;
> > extern tree stabilize_expr			(tree, tree *);
> > extern void stabilize_call			(tree, tree *);
> > extern bool stabilize_init			(tree, tree *);


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