Fwd: [dataflow]: PATCH: add missing copyright notice in dbgcnt.*, other misc cleanup

Seongbae Park seongbae.park@gmail.com
Tue Nov 14 23:38:00 GMT 2006


Commited per Zadeck's approval.

Seongbae

---------- Forwarded message ----------
From: Seongbae Park <seongbae.park@gmail.com>
Date: Nov 14, 2006 3:03 PM
Subject: Re: [dataflow]: PATCH: add missing copyright notice in
dbgcnt.*, other misc cleanup
To: Kenneth Zadeck <zadeck@naturalbridge.com>


Revised per your comment.

Seongbae

On 11/14/06, Seongbae Park <seongbae.park@gmail.com> wrote:
> Hi,
>
> This patch adds the missing copyright notice,
> and seprates debug counter list into dbgcnt.def file.
> Also it adds the missing header file dependencies on dbgcnt.h.
>
> Seongbae
>
> 2006-11-14  Seongbae Park <seongbae.park@gmail.com>
>
>         * dbgcnt.c, dbgcnt.h: Added missing copyright notice. Now uses
>         dbgcnt.def for the list of counters.
>         * Makefile.in: Add missing dbgcnt.h header file dependencies.
>         * dbgcnt.def: New file.
>
>
>


--
#pragma ident "Seongbae Park, compiler, http://seongbae.blogspot.com"




-- 
#pragma ident "Seongbae Park, compiler, http://seongbae.blogspot.com"
-------------- next part --------------
Index: dbgcnt.c
===================================================================
--- dbgcnt.c	(revision 118822)
+++ dbgcnt.c	(working copy)
@@ -1,3 +1,23 @@
+/* Debug counter for debugging support
+   Copyright (C) 2006 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 2, 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 COPYING.  If not, write to the Free
+Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301, USA.  */
+
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
@@ -9,12 +29,11 @@ struct string2counter_map {
   enum debug_counter counter;
 };
 
-#define COUNTER(a) { #a , a }
+#define DEBUG_COUNTER(a) { #a , a },
 
 static struct string2counter_map map[debug_counter_number_of_counters] =
 {
-COUNTER (new_dce),
-COUNTER (tail_call)
+#include "dbgcnt.def"
 };
 
 static int count[debug_counter_number_of_counters];
Index: dbgcnt.def
===================================================================
--- dbgcnt.def	(revision 0)
+++ dbgcnt.def	(revision 0)
@@ -0,0 +1,67 @@
+/* This file contains the list of the debug counter for GCC.
+   Copyright (C) 2006 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 2, 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 COPYING.  If not, write to the Free
+Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301, USA.  */
+
+
+/* A debug counter provides you a way to count an event
+   and return false after the counter has exceeded the threshold
+   specified by the option.
+
+   What is it used for ?
+
+   This is primarily used to speed up the search for the bad transformation
+   an optimization pass does. By doing a binary search on N,
+   you can quickly narrow down to one transformation
+   which is bad, or which triggers the bad behavior downstream
+   (usually in the form of the badly generated code).
+
+   How does it work ?
+
+   Everytime dbg_cnt(named-counter) is called,
+   the counter is incremented for the named-counter.
+   And the incremented value is compared against the threshold (limit)
+   specified by the option.
+   dbg_cnt () returns true if it is below threshold, and false otherwise.
+
+   How to add a new one ?
+
+   To add a new counter, simply add an entry below with some descriptive name,
+   and add call(s) to dbg_cnt(your-counter-name) in appropriate places.
+   Usually, you want to control at the finest granularity
+   any particular transformation can happen.
+   e.g. for each instruction in a dead code elimination,
+   or for each copy instruction in register coalescing,
+   or constant-propagation for each insn,
+   or a block straightening, etc.
+   See dce.c for an example. With the dbg_cnt () call in dce.c,
+   now a developer can use -fdbg-cnt=new_dce:N
+   to stop doing the dead code elimination after N times.
+
+   How to use it ?
+
+   By default, all limits are 0, and if the limit is zero,
+   dbg_cnt() returns true always regardless of the counter value
+   (although it still counts the event).
+   Use -fdbg-cnt=counter1:N,counter2:M,...
+   which sets the limit for counter1 to N, and the limit for counter2 to M, etc.
+*/
+
+/* Debug counter definitions.  */
+DEBUG_COUNTER (new_dce)
+DEBUG_COUNTER (tail_call)
Index: dbgcnt.h
===================================================================
--- dbgcnt.h	(revision 118822)
+++ dbgcnt.h	(working copy)
@@ -1,8 +1,37 @@
+/* Debug counter for debugging support
+   Copyright (C) 1987, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+   2000, 2001, 2002, 2003, 2004, 2005, 2006 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 2, 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 COPYING.  If not, write to the Free
+Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301, USA.  */
+
+#ifndef GCC_DBGCNT_H
+#define GCC_DBGCNT_H
+
+#define DEBUG_COUNTER(a) a,
+
 enum debug_counter {
-   new_dce,
-   tail_call,
+#include "dbgcnt.def"
    debug_counter_number_of_counters
 };
 
+#undef DEBUG_COUNTER
+
 extern bool dbg_cnt (enum debug_counter index);
 extern void dbg_cnt_process_opt (const char *arg);
+
+#endif /* GCC_DBGCNT_H */
Index: Makefile.in
===================================================================
--- Makefile.in	(revision 118822)
+++ Makefile.in	(working copy)
@@ -815,6 +815,7 @@ TREE_DATA_REF_H = tree-data-ref.h $(LAMB
 VARRAY_H = varray.h $(MACHMODE_H) $(SYSTEM_H) coretypes.h $(TM_H)
 TREE_INLINE_H = tree-inline.h $(VARRAY_H) $(SPLAY_TREE_H)
 REAL_H = real.h $(MACHMODE_H)
+DBGCNT_H = dbgcnt.h dbgcnt.def
 
 #

 # Now figure out from those variables how to compile and link.
@@ -2139,7 +2140,7 @@ diagnostic.o : diagnostic.c $(CONFIG_H) 
 opts.o : opts.c opts.h options.h toplev.h $(CONFIG_H) $(SYSTEM_H) \
    coretypes.h $(TREE_H) $(TM_H) langhooks.h $(GGC_H) $(RTL_H) \
    output.h $(DIAGNOSTIC_H) $(TM_P_H) $(INSN_ATTR_H) intl.h $(TARGET_H) \
-   $(FLAGS_H) $(PARAMS_H) tree-pass.h
+   $(FLAGS_H) $(PARAMS_H) tree-pass.h $(DBGCNT_H)
 opts-common.o : opts-common.c opts.h $(CONFIG_H) $(SYSTEM_H) \
    coretypes.h intl.h
 targhooks.o : targhooks.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TREE_H) \
@@ -2230,7 +2231,7 @@ builtins.o : builtins.c $(CONFIG_H) $(SY
 calls.o : calls.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
    $(TREE_H) $(FLAGS_H) $(EXPR_H) $(OPTABS_H) langhooks.h $(TARGET_H) \
    libfuncs.h $(REGS_H) toplev.h output.h $(FUNCTION_H) $(TIMEVAR_H) $(TM_P_H) \
-   $(CGRAPH_H) except.h sbitmap.h
+   $(CGRAPH_H) except.h sbitmap.h $(DBGCNT_H)
 expmed.o : expmed.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TREE_H) \
    $(FLAGS_H) insn-config.h $(EXPR_H) $(OPTABS_H) $(RECOG_H) $(REAL_H) \
    toplev.h $(TM_P_H) langhooks.h
@@ -2343,7 +2344,7 @@ cse.o : cse.c $(CONFIG_H) $(SYSTEM_H) co
    except.h $(TARGET_H) $(PARAMS_H) rtlhooks-def.h tree-pass.h $(REAL_H)
 dce.o : dce.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
    $(TREE_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) $(DF_H) cselib.h \
-   dce.h timevar.h tree-pass.h
+   $(DBGCNT_H) dce.h timevar.h tree-pass.h
 web.o : web.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
    hard-reg-set.h $(FLAGS_H) $(BASIC_BLOCK_H) $(FUNCTION_H) output.h toplev.h \
    $(DF_H) $(OBSTACK_H) $(TIMEVAR_H) tree-pass.h
@@ -2655,7 +2656,7 @@ hooks.o: hooks.c $(CONFIG_H) $(SYSTEM_H)
 pretty-print.o: $(CONFIG_H) $(SYSTEM_H) coretypes.h intl.h $(PRETTY_PRINT_H) \
    $(TREE_H)
 errors.o : errors.c $(CONFIG_H) $(SYSTEM_H) errors.h $(BCONFIG_H)
-dbgcnt.o: $(CONFIG_H) $(SYSTEM_H) coretypes.h dbgcnt.h
+dbgcnt.o: $(CONFIG_H) $(SYSTEM_H) coretypes.h $(DBGCNT_H)
 
 $(out_object_file): $(out_file) $(CONFIG_H) coretypes.h $(TM_H) $(TREE_H) \
    $(RTL_H) $(REGS_H) hard-reg-set.h insn-config.h conditions.h \


More information about the Gcc-patches mailing list