1 /* This file contains the list of the debug counter for GCC.
2 Copyright (C
) 2006, 2007 Free Software Foundation
, Inc.
4 This file is part of GCC.
6 GCC is free software
; you can redistribute it and
/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation
; either version
3, or (at your option
) any later
11 GCC is distributed in the hope that it will be useful
, but WITHOUT ANY
12 WARRANTY
; without even the implied warranty of MERCHANTABILITY or
13 FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 You should have received a copy of the GNU General Public License
17 along with GCC
; see the file COPYING3. If not see
18 <http
://www.gnu.org
/licenses
/>.
*/
21 /* A debug counter provides you a way to count an event
22 and return false after the counter has exceeded the threshold
23 specified by the option.
27 This is primarily used to speed up the search for the bad transformation
28 an optimization pass does. By doing a binary search on N
,
29 you can quickly narrow down to one transformation
30 which is bad
, or which triggers the bad behavior downstream
31 (usually in the form of the badly generated code
).
35 Every time
dbg_cnt(named
-counter
) is called
,
36 the counter is incremented for the named
-counter.
37 And the incremented value is compared against the
threshold (limit
)
38 specified by the option.
39 dbg_cnt () returns true if it is at or below threshold
, and false if above.
41 How to add a new one ?
43 To add a new counter
, simply add an entry below with some descriptive name
,
44 and add
call(s
) to
dbg_cnt(your
-counter
-name
) in appropriate places.
45 Usually
, you want to control at the finest granularity
46 any particular transformation can happen.
47 e.g. for each instruction in a dead code elimination
,
48 or for each copy instruction in register coalescing
,
49 or constant
-propagation for each insn
,
50 or a block straightening
, etc.
51 See dce.c for an example. With the
dbg_cnt () call in dce.c
,
52 now a developer can use
-fdbg
-cnt
=dce
:N
53 to stop doing the dead code elimination after N times.
57 By default
, all limits are UINT_MAX.
58 Since debug count is unsigned int
, <= UINT_MAX returns true always.
59 i.e.
dbg_cnt() returns true always regardless of the counter value
60 (although it still counts the event
).
61 Use
-fdbg
-cnt
=counter1
:N
,counter2
:M
,...
62 which sets the limit for counter1 to N
, and the limit for counter2 to M
, etc.
63 e.g. setting a limit to zero will make
dbg_cnt () return false
*always
*.
66 /* Debug counter definitions.
*/
67 DEBUG_COUNTER (auto_inc_dec
)
68 DEBUG_COUNTER (cse2_move2add
)
70 DEBUG_COUNTER (delete_trivial_dead
)
72 DEBUG_COUNTER (gcse2_delete
)
73 DEBUG_COUNTER (ia64_sched2
)
74 DEBUG_COUNTER (local_alloc_for_sched
)
75 DEBUG_COUNTER (postreload_cse
)
76 DEBUG_COUNTER (pre_insn
)
77 DEBUG_COUNTER (sched2_func
)
78 DEBUG_COUNTER (sched_block
)
79 DEBUG_COUNTER (sched_func
)
80 DEBUG_COUNTER (sched_insn
)
81 DEBUG_COUNTER (sched_region
)
82 DEBUG_COUNTER (split_for_sched2
)
83 DEBUG_COUNTER (tail_call
)
84 DEBUG_COUNTER (global_alloc_at_func
)
85 DEBUG_COUNTER (global_alloc_at_reg
)
86 DEBUG_COUNTER (sms_sched_loop
)