]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/dbgcnt.def
Update libbid according to the latest Intel Decimal Floating-Point Math Library.
[thirdparty/gcc.git] / gcc / dbgcnt.def
CommitLineData
6fb5fa3c 1/* This file contains the list of the debug counter for GCC.
a945c346 2 Copyright (C) 2006-2024 Free Software Foundation, Inc.
6fb5fa3c
DB
3
4This file is part of GCC.
5
6GCC is free software; you can redistribute it and/or modify it under
7the terms of the GNU General Public License as published by the Free
9dcd6f09 8Software Foundation; either version 3, or (at your option) any later
6fb5fa3c
DB
9version.
10
11GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12WARRANTY; without even the implied warranty of MERCHANTABILITY or
13FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14for more details.
15
16You should have received a copy of the GNU General Public License
9dcd6f09
NC
17along with GCC; see the file COPYING3. If not see
18<http://www.gnu.org/licenses/>. */
6fb5fa3c
DB
19
20
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.
24
25 What is it used for ?
26
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).
32
33 How does it work ?
34
0d52bcc1 35 Every time dbg_cnt(named-counter) is called,
6fb5fa3c
DB
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.
40
41 How to add a new one ?
42
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.
e53b6e56 51 See dce.cc for an example. With the dbg_cnt () call in dce.cc,
6fb5fa3c
DB
52 now a developer can use -fdbg-cnt=dce:N
53 to stop doing the dead code elimination after N times.
54
55 How to use it ?
56
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*.
cc806ac1
RS
64
65 The following shell file can then be used to binary search for
66 exact transformation that causes the bug. A second shell script
67 should be written, say "tryTest", which exits with 1 if the
68 compiled program fails and exits with 0 if the program succeeds.
69 This shell script should take 1 parameter, the value to be passed
70 to set the counter of the compilation command in tryTest. Then,
71 assuming that the following script is called binarySearch,
72 the command:
73
b8698a0f 74 binarySearch tryTest
cc806ac1
RS
75
76 will automatically find the highest value of the counter for which
77 the program fails. If tryTest never fails, binarySearch will
78 produce unpredictable results as it will try to find an upper bound
79 that does not exist.
80
81 When dbgcnt does hits the limit, it writes a comment in the current
82 dump_file of the form:
83
84 ***dbgcnt: limit reached for %s.***
b8698a0f 85
cc806ac1
RS
86 Assuming that the dump file is logging the analysis/transformations
87 it is making, this pinpoints the exact position in the log file
88 where the problem transformation is being logged.
89
90=====================================
91#!/bin/bash
92
93while getopts "l:u:i:" opt
94do
95 case $opt in
96 l) lb="$OPTARG";;
97 u) ub="$OPTARG";;
98 i) init="$OPTARG";;
99 ?) usage; exit 3;;
100 esac
101done
102
103shift $(($OPTIND - 1))
104echo $@
105cmd=${1+"${@}"}
106
107lb=${lb:=0}
108init=${init:=100}
109
110$cmd $lb
111lb_val=$?
112if [ -z "$ub" ]; then
113 # find the upper bound
114 ub=$(($init + $lb))
115 true
116 while [ $? -eq $lb_val ]; do
117 ub=$(($ub * 10))
118 #ub=`expr $ub \* 10`
119 $cmd $ub
120 done
121fi
122
123echo command: $cmd
124
125true
126while [ `expr $ub - $lb` -gt 1 ]; do
127 try=$(($lb + ( $ub - $lb ) / 2))
128 $cmd $try
129 if [ $? -eq $lb_val ]; then
130 lb=$try
131 else
132 ub=$try
133 fi
134done
135
136echo lbound: $lb
137echo ubound: $ub
138
139=====================================
140
6fb5fa3c
DB
141*/
142
cf18754d
ML
143/* Debug counter definitions.
144 Please keep the list sorted in alphabetic order. */
fcd1b8df 145DEBUG_COUNTER (asan_use_after_scope)
6fb5fa3c 146DEBUG_COUNTER (auto_inc_dec)
bc5baac5
AH
147DEBUG_COUNTER (back_thread1)
148DEBUG_COUNTER (back_thread2)
149DEBUG_COUNTER (back_threadfull1)
150DEBUG_COUNTER (back_threadfull2)
74fe548b 151DEBUG_COUNTER (ccp)
7d817ebc 152DEBUG_COUNTER (cfg_cleanup)
5f39ad47 153DEBUG_COUNTER (cprop)
68d070ac 154DEBUG_COUNTER (cse2_move2add)
6fb5fa3c 155DEBUG_COUNTER (dce)
7d817ebc
DE
156DEBUG_COUNTER (dce_fast)
157DEBUG_COUNTER (dce_ud)
6fb5fa3c 158DEBUG_COUNTER (delete_trivial_dead)
2b5f0895 159DEBUG_COUNTER (devirt)
cc806ac1 160DEBUG_COUNTER (df_byte_scan)
cf18754d 161DEBUG_COUNTER (dom_unreachable_edges)
6fb5fa3c 162DEBUG_COUNTER (dse)
7d817ebc
DE
163DEBUG_COUNTER (dse1)
164DEBUG_COUNTER (dse2)
27e2e7c9 165DEBUG_COUNTER (form_fma)
6fb5fa3c 166DEBUG_COUNTER (gcse2_delete)
cf18754d 167DEBUG_COUNTER (gimple_unroll)
7d817ebc
DE
168DEBUG_COUNTER (global_alloc_at_func)
169DEBUG_COUNTER (global_alloc_at_reg)
6a7441f5 170DEBUG_COUNTER (graphite_scop)
5f39ad47 171DEBUG_COUNTER (hoist)
62a3f636 172DEBUG_COUNTER (hoist_insn)
6fb5fa3c 173DEBUG_COUNTER (ia64_sched2)
7d817ebc
DE
174DEBUG_COUNTER (if_after_combine)
175DEBUG_COUNTER (if_after_reload)
68d070ac
ML
176DEBUG_COUNTER (if_conversion)
177DEBUG_COUNTER (if_conversion_tree)
03eb0929 178DEBUG_COUNTER (if_to_switch)
6471396d 179DEBUG_COUNTER (ipa_attr)
6c2583c1 180DEBUG_COUNTER (ipa_cp_bits)
86deadf8
MJ
181DEBUG_COUNTER (ipa_cp_values)
182DEBUG_COUNTER (ipa_cp_vr)
e4ee51eb 183DEBUG_COUNTER (ipa_mod_ref)
6f1a3668 184DEBUG_COUNTER (ipa_mod_ref_pta)
ff6686d2
MJ
185DEBUG_COUNTER (ipa_sra_params)
186DEBUG_COUNTER (ipa_sra_retvalues)
68d070ac 187DEBUG_COUNTER (ira_move)
cf18754d 188DEBUG_COUNTER (ivopts_loop)
bb63ca63 189DEBUG_COUNTER (lim)
6fb5fa3c 190DEBUG_COUNTER (local_alloc_for_sched)
a1c9f779 191DEBUG_COUNTER (loop_unswitch)
cf18754d 192DEBUG_COUNTER (match)
68d070ac 193DEBUG_COUNTER (merged_ipa_icf)
51abfb6a 194DEBUG_COUNTER (phiopt_edge_range)
6fb5fa3c 195DEBUG_COUNTER (postreload_cse)
5f39ad47 196DEBUG_COUNTER (pre)
6fb5fa3c 197DEBUG_COUNTER (pre_insn)
1a70c8d5 198DEBUG_COUNTER (prefetch)
68d070ac 199DEBUG_COUNTER (registered_jump_thread)
6fb5fa3c 200DEBUG_COUNTER (sched2_func)
68d070ac 201DEBUG_COUNTER (sched_breakdep)
6fb5fa3c
DB
202DEBUG_COUNTER (sched_func)
203DEBUG_COUNTER (sched_insn)
204DEBUG_COUNTER (sched_region)
e855c69d 205DEBUG_COUNTER (sel_sched_cnt)
e855c69d 206DEBUG_COUNTER (sel_sched_insn_cnt)
68d070ac 207DEBUG_COUNTER (sel_sched_region_cnt)
7d817ebc 208DEBUG_COUNTER (sms_sched_loop)
6fb5fa3c 209DEBUG_COUNTER (split_for_sched2)
cf18754d 210DEBUG_COUNTER (store_merging)
68d070ac 211DEBUG_COUNTER (store_motion)
006ba504 212DEBUG_COUNTER (stv_conversion)
6fb5fa3c 213DEBUG_COUNTER (tail_call)
68d070ac 214DEBUG_COUNTER (tree_sra)
cf18754d 215DEBUG_COUNTER (treepre_insert)
68d070ac
ML
216DEBUG_COUNTER (vect_loop)
217DEBUG_COUNTER (vect_slp)