This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[tree-ssa/tree-profiling] Fix sefault in dump_flow_info
- From: Jan Hubicka <jh at suse dot cz>
- To: gcc-patches at gcc dot gnu dot org, rth at redhat dot com
- Date: Thu, 19 Feb 2004 23:17:04 +0100
- Subject: [tree-ssa/tree-profiling] Fix sefault in dump_flow_info
Hi,
as discussed earlier, this patch remove INSN_UID dumping from basic blocks and
pseudo regs so the function works with trees too. Hopefully for RTL the INSNs
are better available via print_rtl_with_blocks.
This patch fix segfault with -fprofile-arcs -fdump-tree-profile
Bootstrapped/regtested i686-pc-gnu-linux, OK?
Honza
2004-02-19 Jan Hubicka <jh@suse.cz>
* cfg.c (dump_flow_info): Work on trees too.
Index: cfg.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfg.c,v
retrieving revision 1.34.2.23
diff -c -3 -p -r1.34.2.23 cfg.c
*** cfg.c 30 Jan 2004 13:13:37 -0000 1.34.2.23
--- cfg.c 19 Feb 2004 22:12:54 -0000
*************** void
*** 439,492 ****
dump_flow_info (FILE *file)
{
int i;
- int max_regno = max_reg_num ();
basic_block bb;
static const char * const reg_class_names[] = REG_CLASS_NAMES;
- fprintf (file, "%d registers.\n", max_regno);
if (reg_n_info)
! for (i = FIRST_PSEUDO_REGISTER; i < max_regno; i++)
! if (REG_N_REFS (i))
! {
! enum reg_class class, altclass;
!
! fprintf (file, "\nRegister %d used %d times across %d insns",
! i, REG_N_REFS (i), REG_LIVE_LENGTH (i));
! if (REG_BASIC_BLOCK (i) >= 0)
! fprintf (file, " in block %d", REG_BASIC_BLOCK (i));
! if (REG_N_SETS (i))
! fprintf (file, "; set %d time%s", REG_N_SETS (i),
! (REG_N_SETS (i) == 1) ? "" : "s");
! if (regno_reg_rtx[i] != NULL && REG_USERVAR_P (regno_reg_rtx[i]))
! fprintf (file, "; user var");
! if (REG_N_DEATHS (i) != 1)
! fprintf (file, "; dies in %d places", REG_N_DEATHS (i));
! if (REG_N_CALLS_CROSSED (i) == 1)
! fprintf (file, "; crosses 1 call");
! else if (REG_N_CALLS_CROSSED (i))
! fprintf (file, "; crosses %d calls", REG_N_CALLS_CROSSED (i));
! if (regno_reg_rtx[i] != NULL
! && PSEUDO_REGNO_BYTES (i) != UNITS_PER_WORD)
! fprintf (file, "; %d bytes", PSEUDO_REGNO_BYTES (i));
!
! class = reg_preferred_class (i);
! altclass = reg_alternate_class (i);
! if (class != GENERAL_REGS || altclass != ALL_REGS)
! {
! if (altclass == ALL_REGS || class == ALL_REGS)
! fprintf (file, "; pref %s", reg_class_names[(int) class]);
! else if (altclass == NO_REGS)
! fprintf (file, "; %s or none", reg_class_names[(int) class]);
! else
! fprintf (file, "; pref %s, else %s",
! reg_class_names[(int) class],
! reg_class_names[(int) altclass]);
! }
!
! if (regno_reg_rtx[i] != NULL && REG_POINTER (regno_reg_rtx[i]))
! fprintf (file, "; pointer");
! fprintf (file, ".\n");
! }
fprintf (file, "\n%d basic blocks, %d edges.\n", n_basic_blocks, n_edges);
FOR_EACH_BB (bb)
--- 439,494 ----
dump_flow_info (FILE *file)
{
int i;
basic_block bb;
static const char * const reg_class_names[] = REG_CLASS_NAMES;
if (reg_n_info)
! {
! int max_regno = max_reg_num ();
! fprintf (file, "%d registers.\n", max_regno);
! for (i = FIRST_PSEUDO_REGISTER; i < max_regno; i++)
! if (REG_N_REFS (i))
! {
! enum reg_class class, altclass;
!
! fprintf (file, "\nRegister %d used %d times across %d insns",
! i, REG_N_REFS (i), REG_LIVE_LENGTH (i));
! if (REG_BASIC_BLOCK (i) >= 0)
! fprintf (file, " in block %d", REG_BASIC_BLOCK (i));
! if (REG_N_SETS (i))
! fprintf (file, "; set %d time%s", REG_N_SETS (i),
! (REG_N_SETS (i) == 1) ? "" : "s");
! if (regno_reg_rtx[i] != NULL && REG_USERVAR_P (regno_reg_rtx[i]))
! fprintf (file, "; user var");
! if (REG_N_DEATHS (i) != 1)
! fprintf (file, "; dies in %d places", REG_N_DEATHS (i));
! if (REG_N_CALLS_CROSSED (i) == 1)
! fprintf (file, "; crosses 1 call");
! else if (REG_N_CALLS_CROSSED (i))
! fprintf (file, "; crosses %d calls", REG_N_CALLS_CROSSED (i));
! if (regno_reg_rtx[i] != NULL
! && PSEUDO_REGNO_BYTES (i) != UNITS_PER_WORD)
! fprintf (file, "; %d bytes", PSEUDO_REGNO_BYTES (i));
!
! class = reg_preferred_class (i);
! altclass = reg_alternate_class (i);
! if (class != GENERAL_REGS || altclass != ALL_REGS)
! {
! if (altclass == ALL_REGS || class == ALL_REGS)
! fprintf (file, "; pref %s", reg_class_names[(int) class]);
! else if (altclass == NO_REGS)
! fprintf (file, "; %s or none", reg_class_names[(int) class]);
! else
! fprintf (file, "; pref %s, else %s",
! reg_class_names[(int) class],
! reg_class_names[(int) altclass]);
! }
!
! if (regno_reg_rtx[i] != NULL && REG_POINTER (regno_reg_rtx[i]))
! fprintf (file, "; pointer");
! fprintf (file, ".\n");
! }
! }
fprintf (file, "\n%d basic blocks, %d edges.\n", n_basic_blocks, n_edges);
FOR_EACH_BB (bb)
*************** dump_flow_info (FILE *file)
*** 495,502 ****
int sum;
gcov_type lsum;
! fprintf (file, "\nBasic block %d: first insn %d, last %d, ",
! bb->index, INSN_UID (BB_HEAD (bb)), INSN_UID (BB_END (bb)));
fprintf (file, "prev %d, next %d, ",
bb->prev_bb->index, bb->next_bb->index);
fprintf (file, "loop_depth %d, count ", bb->loop_depth);
--- 497,503 ----
int sum;
gcov_type lsum;
! fprintf (file, "\nBasic block %d ");
fprintf (file, "prev %d, next %d, ",
bb->prev_bb->index, bb->next_bb->index);
fprintf (file, "loop_depth %d, count ", bb->loop_depth);