Commit 735a0e33 by Ulrich Drepper Committed by Richard Henderson

Ulrich Drepper <drepper@cygnus.com>

Ulrich Drepper  <drepper@cygnus.com>
        * Makefile.in (OBJS): Add graph.o
        (graph.o): New dependency list.
        * flags.h: Declare dump_for_graph and define graph_dump_types type.
        * print-rtl.c (dump_for_graph): Define new variable.
        (print_rtx): Rewrite to allow use in graph dumping functions.
        * toplev.c: Declare print_rtl_graph_with_bb, clean_graph_dump_file,
        finish_graph_dump_file.
        Define graph_dump_format.
        (compile_file): If graph dumping is enabled also clear these files.
        Finish graph dump files.
        (rest_of_compilation): Also dump graph information if enabled.
        (main): Recognize -dv to enabled VCG based graph dumping.
        * graph.c: New file.  Graph dumping functions.

From-SVN: r23813
parent a05e22b8
Mon Nov 23 16:40:00 1998 Ulrich Drepper <drepper@cygnus.com>
* Makefile.in (OBJS): Add graph.o
(graph.o): New dependency list.
* flags.h: Declare dump_for_graph and define graph_dump_types type.
* print-rtl.c (dump_for_graph): Define new variable.
(print_rtx): Rewrite to allow use in graph dumping functions.
* toplev.c: Declare print_rtl_graph_with_bb, clean_graph_dump_file,
finish_graph_dump_file.
Define graph_dump_format.
(compile_file): If graph dumping is enabled also clear these files.
Finish graph dump files.
(rest_of_compilation): Also dump graph information if enabled.
(main): Recognize -dv to enabled VCG based graph dumping.
* graph.c: New file. Graph dumping functions.
Mon Nov 23 16:39:04 1998 Richard Henderson <rth@cygnus.com> Mon Nov 23 16:39:04 1998 Richard Henderson <rth@cygnus.com>
* configure.in: Look for <sys/stat.h>. * configure.in: Look for <sys/stat.h>.
......
...@@ -647,7 +647,7 @@ OBJS = toplev.o version.o tree.o print-tree.o stor-layout.o fold-const.o \ ...@@ -647,7 +647,7 @@ OBJS = toplev.o version.o tree.o print-tree.o stor-layout.o fold-const.o \
insn-peep.o reorg.o $(SCHED_PREFIX)sched.o final.o recog.o reg-stack.o \ insn-peep.o reorg.o $(SCHED_PREFIX)sched.o final.o recog.o reg-stack.o \
insn-opinit.o insn-recog.o insn-extract.o insn-output.o insn-emit.o \ insn-opinit.o insn-recog.o insn-extract.o insn-output.o insn-emit.o \
profile.o insn-attrtab.o $(out_object_file) getpwd.o $(EXTRA_OBJS) convert.o \ profile.o insn-attrtab.o $(out_object_file) getpwd.o $(EXTRA_OBJS) convert.o \
mbchar.o dyn-string.o splay-tree.o mbchar.o dyn-string.o splay-tree.o graph.o
# GEN files are listed separately, so they can be built before doing parallel # GEN files are listed separately, so they can be built before doing parallel
# makes for cc1 or cc1plus. Otherwise sequent parallel make attempts to load # makes for cc1 or cc1plus. Otherwise sequent parallel make attempts to load
...@@ -1289,6 +1289,8 @@ c-pragma.o: c-pragma.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) except.h \ ...@@ -1289,6 +1289,8 @@ c-pragma.o: c-pragma.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) except.h \
c-iterate.o: c-iterate.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) c-tree.h \ c-iterate.o: c-iterate.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) c-tree.h \
flags.h toplev.h $(EXPR_H) flags.h toplev.h $(EXPR_H)
mbchar.o: mbchar.c $(CONFIG_H) system.h mbchar.h mbchar.o: mbchar.c $(CONFIG_H) system.h mbchar.h
graph.o: graph.c $(CONFIG_H) system.h toplev.h flags.h output.h rtl.h \
hard-reg-set.h basic-block.h
collect2$(exeext): collect2.o tlink.o hash.o cplus-dem.o underscore.o \ collect2$(exeext): collect2.o tlink.o hash.o cplus-dem.o underscore.o \
version.o choose-temp.o mkstemp.o $(LIBDEPS) version.o choose-temp.o mkstemp.o $(LIBDEPS)
......
...@@ -502,3 +502,14 @@ extern int current_function_is_thunk; ...@@ -502,3 +502,14 @@ extern int current_function_is_thunk;
/* Value of the -G xx switch, and whether it was passed or not. */ /* Value of the -G xx switch, and whether it was passed or not. */
extern int g_switch_value; extern int g_switch_value;
extern int g_switch_set; extern int g_switch_set;
/* Nonzero if we dump in VCG format, not plain text. */
extern int dump_for_graph;
/* Selection of the graph form. */
enum graph_dump_types
{
no_graph = 0,
vcg
};
extern enum graph_dump_types graph_dump_format;
This diff is collapsed. Click to expand it.
/* Print RTL for GNU C Compiler. /* Print RTL for GNU C Compiler.
Copyright (C) 1987, 1988, 1992, 1997 Free Software Foundation, Inc. Copyright (C) 1987, 1988, 1992, 1997, 1998 Free Software Foundation, Inc.
This file is part of GNU CC. This file is part of GNU CC.
...@@ -60,13 +60,17 @@ extern char **insn_name_ptr; ...@@ -60,13 +60,17 @@ extern char **insn_name_ptr;
This must be defined here so that programs like gencodes can be linked. */ This must be defined here so that programs like gencodes can be linked. */
int flag_dump_unnumbered = 0; int flag_dump_unnumbered = 0;
/* Nonzero if we are dumping graphical description. */
int dump_for_graph;
/* Print IN_RTX onto OUTFILE. This is the recursive part of printing. */ /* Print IN_RTX onto OUTFILE. This is the recursive part of printing. */
static void static void
print_rtx (in_rtx) print_rtx (in_rtx)
register rtx in_rtx; register rtx in_rtx;
{ {
register int i, j; register int i = 0;
register int j;
register char *format_ptr; register char *format_ptr;
register int is_insn; register int is_insn;
...@@ -79,25 +83,38 @@ print_rtx (in_rtx) ...@@ -79,25 +83,38 @@ print_rtx (in_rtx)
if (in_rtx == 0) if (in_rtx == 0)
{ {
fprintf (outfile, "(nil)"); fputs ("(nil)", outfile);
sawclose = 1; sawclose = 1;
return; return;
} }
is_insn = (GET_RTX_CLASS (GET_CODE (in_rtx)) == 'i');
/* When printing in VCG format we write INSNs, NOTE, LABEL, and BARRIER
in separate nodes and therefore have to handle them special here. */
if (dump_for_graph &&
(is_insn || GET_CODE (in_rtx) == NOTE || GET_CODE (in_rtx) == CODE_LABEL
|| GET_CODE (in_rtx) == BARRIER))
{
i = 3;
indent = 0;
}
else
{
/* print name of expression code */ /* print name of expression code */
fprintf (outfile, "(%s", GET_RTX_NAME (GET_CODE (in_rtx))); fprintf (outfile, "(%s", GET_RTX_NAME (GET_CODE (in_rtx)));
if (in_rtx->in_struct) if (in_rtx->in_struct)
fprintf (outfile, "/s"); fputs ("/s", outfile);
if (in_rtx->volatil) if (in_rtx->volatil)
fprintf (outfile, "/v"); fputs ("/v", outfile);
if (in_rtx->unchanging) if (in_rtx->unchanging)
fprintf (outfile, "/u"); fputs ("/u", outfile);
if (in_rtx->integrated) if (in_rtx->integrated)
fprintf (outfile, "/i"); fputs ("/i", outfile);
if (GET_MODE (in_rtx) != VOIDmode) if (GET_MODE (in_rtx) != VOIDmode)
{ {
...@@ -107,11 +124,13 @@ print_rtx (in_rtx) ...@@ -107,11 +124,13 @@ print_rtx (in_rtx)
else else
fprintf (outfile, ":%s", GET_MODE_NAME (GET_MODE (in_rtx))); fprintf (outfile, ":%s", GET_MODE_NAME (GET_MODE (in_rtx)));
} }
}
is_insn = (GET_RTX_CLASS (GET_CODE (in_rtx)) == 'i'); /* Get the format string and skip the first elements if we have handled
format_ptr = GET_RTX_FORMAT (GET_CODE (in_rtx)); them already. */
format_ptr = GET_RTX_FORMAT (GET_CODE (in_rtx)) + i;
for (i = 0; i < GET_RTX_LENGTH (GET_CODE (in_rtx)); i++) for (; i < GET_RTX_LENGTH (GET_CODE (in_rtx)); i++)
switch (*format_ptr++) switch (*format_ptr++)
{ {
case 'S': case 'S':
...@@ -141,9 +160,10 @@ print_rtx (in_rtx) ...@@ -141,9 +160,10 @@ print_rtx (in_rtx)
} }
if (XSTR (in_rtx, i) == 0) if (XSTR (in_rtx, i) == 0)
fprintf (outfile, " \"\""); fputs (dump_for_graph ? " \\\"\\\"" : " \"\"", outfile);
else else
fprintf (outfile, " (\"%s\")", XSTR (in_rtx, i)); fprintf (outfile, dump_for_graph ? " (\\\"%s\\\")" : " (\"%s\")",
XSTR (in_rtx, i));
sawclose = 1; sawclose = 1;
break; break;
...@@ -168,7 +188,7 @@ print_rtx (in_rtx) ...@@ -168,7 +188,7 @@ print_rtx (in_rtx)
(spaces + (sizeof spaces - 1 - indent * 2))); (spaces + (sizeof spaces - 1 - indent * 2)));
sawclose = 0; sawclose = 0;
} }
fprintf (outfile, "[ "); fputs ("[ ", outfile);
if (NULL != XVEC (in_rtx, i)) if (NULL != XVEC (in_rtx, i))
{ {
indent += 2; indent += 2;
...@@ -184,7 +204,7 @@ print_rtx (in_rtx) ...@@ -184,7 +204,7 @@ print_rtx (in_rtx)
fprintf (outfile, "\n%s", fprintf (outfile, "\n%s",
(spaces + (sizeof spaces - 1 - indent * 2))); (spaces + (sizeof spaces - 1 - indent * 2)));
fprintf (outfile, "] "); fputs ("] ", outfile);
sawclose = 1; sawclose = 1;
indent -= 2; indent -= 2;
break; break;
...@@ -205,7 +225,7 @@ print_rtx (in_rtx) ...@@ -205,7 +225,7 @@ print_rtx (in_rtx)
} }
else if (flag_dump_unnumbered else if (flag_dump_unnumbered
&& (is_insn || GET_CODE (in_rtx) == NOTE)) && (is_insn || GET_CODE (in_rtx) == NOTE))
fprintf (outfile, "#"); fputc ('#', outfile);
else else
fprintf (outfile, " %d", value); fprintf (outfile, " %d", value);
} }
...@@ -230,18 +250,18 @@ print_rtx (in_rtx) ...@@ -230,18 +250,18 @@ print_rtx (in_rtx)
if (XEXP (in_rtx, i) != NULL) if (XEXP (in_rtx, i) != NULL)
{ {
if (flag_dump_unnumbered) if (flag_dump_unnumbered)
fprintf (outfile, "#"); fputc ('#', outfile);
else else
fprintf (outfile, " %d", INSN_UID (XEXP (in_rtx, i))); fprintf (outfile, " %d", INSN_UID (XEXP (in_rtx, i)));
} }
else else
fprintf (outfile, " 0"); fputs (" 0", outfile);
sawclose = 0; sawclose = 0;
break; break;
case 'b': case 'b':
if (XBITMAP (in_rtx, i) == NULL) if (XBITMAP (in_rtx, i) == NULL)
fprintf (outfile, " {null}"); fputs (" {null}", outfile);
else else
bitmap_print (outfile, XBITMAP (in_rtx, i), " {", "}"); bitmap_print (outfile, XBITMAP (in_rtx, i), " {", "}");
sawclose = 0; sawclose = 0;
...@@ -253,7 +273,7 @@ print_rtx (in_rtx) ...@@ -253,7 +273,7 @@ print_rtx (in_rtx)
break; break;
case '*': case '*':
fprintf (outfile, " Unknown"); fputs (" Unknown", outfile);
sawclose = 0; sawclose = 0;
break; break;
...@@ -276,8 +296,15 @@ print_rtx (in_rtx) ...@@ -276,8 +296,15 @@ print_rtx (in_rtx)
} }
#endif #endif
fprintf (outfile, ")"); if (dump_for_graph
&& (is_insn || GET_CODE (in_rtx) == NOTE
|| GET_CODE (in_rtx) == CODE_LABEL || GET_CODE (in_rtx) == BARRIER))
sawclose = 0;
else
{
fputc (')', outfile);
sawclose = 1; sawclose = 1;
}
} }
/* Print an rtx on the current line of FILE. Initially indent IND /* Print an rtx on the current line of FILE. Initially indent IND
...@@ -386,7 +413,7 @@ print_rtl (outf, rtx_first) ...@@ -386,7 +413,7 @@ print_rtl (outf, rtx_first)
sawclose = 0; sawclose = 0;
if (rtx_first == 0) if (rtx_first == 0)
fprintf (outf, "(nil)\n"); fputs ("(nil)\n", outf);
else else
switch (GET_CODE (rtx_first)) switch (GET_CODE (rtx_first))
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment