This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
pretty-print fp values in sched dumps
- From: Richard Henderson <rth at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 3 May 2002 17:52:00 -0700
- Subject: pretty-print fp values in sched dumps
* real.c (etoasc): Strip most trailing zeros for clarity.
* sched-vis.c: Include real.h.
(print_value): Use REAL_VALUE_TO_DECIMAL as needed.
* Makefile.in (sched-vis.o): Add real.h.
Index: real.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/real.c,v
retrieving revision 1.68
diff -c -p -d -r1.68 real.c
*** real.c 19 Apr 2002 17:50:40 -0000 1.68
--- real.c 4 May 2002 00:48:07 -0000
*************** etoasc (x, string, ndigs)
*** 5004,5015 ****
}
}
doexp:
! /*
! if (expon >= 0)
! sprintf (ss, "e+%d", expon);
! else
! sprintf (ss, "e%d", expon);
! */
sprintf (ss, "e%d", expon);
bxit:
rndprc = rndsav;
--- 5004,5012 ----
}
}
doexp:
! /* Strip trailing zeros, but leave at least one. */
! while (ss[-1] == '0' && ss[-2] != '.')
! --ss;
sprintf (ss, "e%d", expon);
bxit:
rndprc = rndsav;
Index: sched-vis.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/sched-vis.c,v
retrieving revision 1.19
diff -c -p -d -r1.19 sched-vis.c
*** sched-vis.c 3 May 2002 00:05:51 -0000 1.19
--- sched-vis.c 4 May 2002 00:48:07 -0000
*************** Software Foundation, 59 Temple Place - S
*** 30,35 ****
--- 30,36 ----
#include "hard-reg-set.h"
#include "basic-block.h"
#include "insn-attr.h"
+ #include "real.h"
#include "sched-int.h"
#include "target.h"
*************** print_value (buf, x, verbose)
*** 560,566 ****
cur = safe_concat (buf, cur, t);
break;
case CONST_DOUBLE:
! sprintf (t, "<0x%lx,0x%lx>", (long) XWINT (x, 2), (long) XWINT (x, 3));
cur = safe_concat (buf, cur, t);
break;
case CONST_STRING:
--- 561,575 ----
cur = safe_concat (buf, cur, t);
break;
case CONST_DOUBLE:
! if (FLOAT_MODE_P (GET_MODE (x)))
! {
! REAL_VALUE_TYPE r;
!
! REAL_VALUE_FROM_CONST_DOUBLE (r, x);
! REAL_VALUE_TO_DECIMAL(r, "%.6e", t);
! }
! else
! sprintf (t, "<0x%lx,0x%lx>", (long) XWINT (x, 2), (long) XWINT (x, 3));
cur = safe_concat (buf, cur, t);
break;
case CONST_STRING:
Index: Makefile.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Makefile.in,v
retrieving revision 1.863
diff -c -p -d -u -r1.863 Makefile.in
--- Makefile.in 29 Apr 2002 22:34:32 -0000 1.863
+++ Makefile.in 4 May 2002 00:49:44 -0000
@@ -1599,7 +1599,7 @@ sched-ebb.o : sched-ebb.c $(CONFIG_H) $(
$(INSN_ATTR_H) toplev.h $(RECOG_H) except.h $(TM_P_H)
sched-vis.o : sched-vis.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) sched-int.h \
hard-reg-set.h $(BASIC_BLOCK_H) $(INSN_ATTR_H) $(REGS_H) $(TM_P_H) \
- $(TARGET_H)
+ $(TARGET_H) real.h
final.o : final.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TREE_H) flags.h intl.h \
$(REGS_H) $(RECOG_H) conditions.h insn-config.h $(INSN_ATTR_H) function.h \
real.h output.h hard-reg-set.h except.h debug.h xcoffout.h \