Don't draw arrows leaving return statements.

Return statements never flow to the next block (or any other block, for
that matter), so drawing arrows leaving them not only messes up dot's
graphs, but is quite missleading.
This commit is contained in:
Bill Currie 2012-05-05 18:04:10 +09:00
parent 099d9ec3f2
commit 55ecf94f2d

View file

@ -172,6 +172,14 @@ is_goto (statement_t *s)
return !strcmp (s->opcode, "<GOTO>");
}
static int
is_return (statement_t *s)
{
if (!s)
return 0;
return !strncmp (s->opcode, "<RETURN", 7);
}
static sblock_t *
get_target (statement_t *s)
{
@ -211,7 +219,8 @@ flow_sblock (dstring_t *dstr, sblock_t *sblock, int blockno)
dasprintf (dstr, " <td></td>\n");
dasprintf (dstr, " </tr>\n");
dasprintf (dstr, " </table>>];\n");
if (sblock->next && !is_goto ((statement_t *) sblock->tail))
if (sblock->next && !is_goto ((statement_t *) sblock->tail)
&& !is_return ((statement_t *) sblock->tail))
dasprintf (dstr, " sb_%p:e -> sb_%p:s;\n", sblock, sblock->next);
if ((target = get_target ((statement_t *) sblock->tail)))
dasprintf (dstr, " sb_%p:e -> sb_%p:s [label=\"%s\"];\n", sblock,