aboutsummaryrefslogtreecommitdiff
path: root/gcc/dbgcnt.def
diff options
context:
space:
mode:
authorRichard Sandiford <rsandifo@nildram.co.uk>2008-04-21 18:55:13 +0000
committerKenneth Zadeck <zadeck@gcc.gnu.org>2008-04-21 18:55:13 +0000
commitcc806ac109a1cc625e80d9a38d94a7a589a559ee (patch)
tree7a1b19b42f86a47fffcfe11926a453b8d560f7dd /gcc/dbgcnt.def
parentf7546fa716b5617bd46712f6b042b1f40c31fe68 (diff)
downloadgcc-cc806ac109a1cc625e80d9a38d94a7a589a559ee.zip
gcc-cc806ac109a1cc625e80d9a38d94a7a589a559ee.tar.gz
gcc-cc806ac109a1cc625e80d9a38d94a7a589a559ee.tar.bz2
dbgcnt.def (ra_byte_scan): Added.
2008-04-24 Richard Sandiford <rsandifo@nildram.co.uk> Kenneth Zadeck <zadeck@naturalbridge.com> * dbgcnt.def (ra_byte_scan): Added. * dbgcnt.c (dbg_cnt): Added code to print message to dump_file when the last hit happens for a counter. * timevar.def (TV_DF_BYTE_LR): New variable. * tree-pass.h (pass_fast_rtl_byte_dce): New pass. * passes.c (pass_fast_rtl_byte_dce): New pass. * fwprop.c (update_df): Added mode to call df_ref_create. Renamed DF_REF_WIDTH and DF_REF_OFFSET to DF_REF_EXTRACT_WIDTH and DF_REF_EXTRACT_OFFSET. * df.h (DF_BYTE_LR, DF_BYTE_LR_BB_INFO, DF_BYTE_LR_IN, DF_BYTE_LR_OUT, df_byte_lr): New macro. (df_mm): New enum. (df_ref_extract): Added mode field. (DF_REF_WIDTH, DF_REF_OFFSET) Renamed to DF_REF_EXTRACT_WIDTH and DF_REF_EXTRACT_OFFSET. (DF_REF_EXTRACT_MODE): New macro. (df_byte_lr_bb_info): New structure. (df_print_byte_regset, df_compute_accessed_bytes, df_byte_lr_add_problem, df_byte_lr_get_regno_start, df_byte_lr_get_regno_len, df_byte_lr_simulate_defs, df_byte_lr_simulate_uses, df_byte_lr_simulate_artificial_refs_at_top, df_byte_lr_simulate_artificial_refs_at_end, df_compute_accessed_bytes): New function. (df_ref_create): Add parameter. (df_byte_lr_get_bb_info): New inline function. * df-scan.c (df_ref_record, df_uses_record, df_ref_create_structure): Added mode parameter. (df_ref_create, df_notes_rescan, df_ref_record, df_def_record_1, df_defs_record, df_uses_record, df_get_conditional_uses, df_get_call_refs, df_insn_refs_collect, df_bb_refs_collect, df_entry_block_defs_collect, df_exit_block_uses_collect): Added mode parameter to calls to df_ref_record, df_uses_record, df_ref_create_structure. (df_ref_equal_p, df_ref_compare): Added test for modes. (df_ref_create_structure): Added code to set mode. Renamed DF_REF_WIDTH and DF_REF_OFFSET to DF_REF_EXTRACT_WIDTH and DF_REF_EXTRACT_OFFSET. * df-core.c (df_print_byte_regset): New function. * df-byte-scan.c: New file. * df-problems.c (df_rd_transfer_function): Removed unnecessary calls to BITMAP_FREE. (df_byte_lr_problem_data, df_problem problem_BYTE_LR): New structure. (df_byte_lr_get_regno_start, df_byte_lr_get_regno_len, df_byte_lr_set_bb_info, df_byte_lr_free_bb_info, df_byte_lr_check_regs, df_byte_lr_expand_bitmap, df_byte_lr_alloc, df_byte_lr_reset, df_byte_lr_bb_local_compute, df_byte_lr_local_compute, df_byte_lr_init, df_byte_lr_confluence_0, df_byte_lr_confluence_n, df_byte_lr_transfer_function, df_byte_lr_free, df_byte_lr_top_dump, df_byte_lr_bottom_dump, df_byte_lr_add_problem, df_byte_lr_simulate_defs, df_byte_lr_simulate_uses, df_byte_lr_simulate_artificial_refs_at_top, df_byte_lr_simulate_artificial_refs_at_end): New function. * dce.c (byte_dce_process_block): New function. (dce_process_block): au is now passed in rather than computed locally. Changed loops that look at artificial defs to not look for conditional or partial ones, because there never are any. (fast_dce): Now is able to drive byte_dce_process_block or dce_process_block depending on the kind of dce being done. (rest_of_handle_fast_dce): Add parameter to fast_dce. (rest_of_handle_fast_byte_dce): New function. (rtl_opt_pass pass_fast_rtl_byte_dce): New pass. * Makefile.in (df-byte-scan.o, debugcnt.o): Added dependencies. Co-Authored-By: Kenneth Zadeck <zadeck@naturalbridge.com> From-SVN: r134523
Diffstat (limited to 'gcc/dbgcnt.def')
-rw-r--r--gcc/dbgcnt.def78
1 files changed, 78 insertions, 0 deletions
diff --git a/gcc/dbgcnt.def b/gcc/dbgcnt.def
index b2382f1..7a59af3 100644
--- a/gcc/dbgcnt.def
+++ b/gcc/dbgcnt.def
@@ -61,6 +61,83 @@ along with GCC; see the file COPYING3. If not see
Use -fdbg-cnt=counter1:N,counter2:M,...
which sets the limit for counter1 to N, and the limit for counter2 to M, etc.
e.g. setting a limit to zero will make dbg_cnt () return false *always*.
+
+ The following shell file can then be used to binary search for
+ exact transformation that causes the bug. A second shell script
+ should be written, say "tryTest", which exits with 1 if the
+ compiled program fails and exits with 0 if the program succeeds.
+ This shell script should take 1 parameter, the value to be passed
+ to set the counter of the compilation command in tryTest. Then,
+ assuming that the following script is called binarySearch,
+ the command:
+
+ binarySearch tryTest
+
+ will automatically find the highest value of the counter for which
+ the program fails. If tryTest never fails, binarySearch will
+ produce unpredictable results as it will try to find an upper bound
+ that does not exist.
+
+ When dbgcnt does hits the limit, it writes a comment in the current
+ dump_file of the form:
+
+ ***dbgcnt: limit reached for %s.***
+
+ Assuming that the dump file is logging the analysis/transformations
+ it is making, this pinpoints the exact position in the log file
+ where the problem transformation is being logged.
+
+=====================================
+#!/bin/bash
+
+while getopts "l:u:i:" opt
+do
+ case $opt in
+ l) lb="$OPTARG";;
+ u) ub="$OPTARG";;
+ i) init="$OPTARG";;
+ ?) usage; exit 3;;
+ esac
+done
+
+shift $(($OPTIND - 1))
+echo $@
+cmd=${1+"${@}"}
+
+lb=${lb:=0}
+init=${init:=100}
+
+$cmd $lb
+lb_val=$?
+if [ -z "$ub" ]; then
+ # find the upper bound
+ ub=$(($init + $lb))
+ true
+ while [ $? -eq $lb_val ]; do
+ ub=$(($ub * 10))
+ #ub=`expr $ub \* 10`
+ $cmd $ub
+ done
+fi
+
+echo command: $cmd
+
+true
+while [ `expr $ub - $lb` -gt 1 ]; do
+ try=$(($lb + ( $ub - $lb ) / 2))
+ $cmd $try
+ if [ $? -eq $lb_val ]; then
+ lb=$try
+ else
+ ub=$try
+ fi
+done
+
+echo lbound: $lb
+echo ubound: $ub
+
+=====================================
+
*/
/* Debug counter definitions. */
@@ -73,6 +150,7 @@ DEBUG_COUNTER (dce)
DEBUG_COUNTER (dce_fast)
DEBUG_COUNTER (dce_ud)
DEBUG_COUNTER (delete_trivial_dead)
+DEBUG_COUNTER (df_byte_scan)
DEBUG_COUNTER (dse)
DEBUG_COUNTER (dse1)
DEBUG_COUNTER (dse2)