Commit Graph

27 Commits

Author SHA1 Message Date
Bill Currie d3f010a81b Fix the flow-dag connections in the flow graphs. 2012-11-18 11:34:01 +09:00
Bill Currie c1776fc2ad Make the dags in flow graphs a little easier to read. 2012-11-16 12:42:57 +09:00
Bill Currie 2b2ea5c9b3 Compute dags as part of data flow analysis.
I want to use the live variable information when building the dags.
2012-11-15 13:44:08 +09:00
Bill Currie c4d4174ebc Make some minor improvements to flow graph dumps. 2012-11-15 13:44:08 +09:00
Bill Currie cd224c00d4 Add live variable info to flow graph dumps.
Things are a little bogus, but at least the bogosity is visible :)
2012-11-15 13:44:08 +09:00
Bill Currie d6d03a63b4 Print the depth-first order of the flow graph nodes. 2012-11-15 13:44:07 +09:00
Bill Currie d7177a78e9 Rewrite the flow graph code.
The flow graph nodes are now properly separated from the graph, and edge
information is stored in the graph struct. This actually made for much
cleaner code (partly thanks to the use of sets and set iterators).

Flow graph reduction has been (temporarily) ripped out as the entire
approach was wrong. There was also a bug in that I didn't really understand
the dragon book about selecting nodes and thus messed things up. The
depth-first search tree "fixed" the problem, but was really the wrong
solution (sledge hammer :P).

Also, now that I understand that dot's directed graphs must be acyclic, I
now have much better control over the graphs (back edges need to be
flipped).
2012-11-15 13:44:07 +09:00
Bill Currie d3d88290b5 Mostly satisfactory output of nested regions.
It turns out dot does not like cyclic graphs (thus some of the weird
layouts), but fixing it by flipping back-edges requires proper recording of
edge info (I guess that's what T is for in the dragon book).
2012-11-15 13:44:07 +09:00
Bill Currie 2da038ce0f Bring back dot_flow.c.
However, it produces simplified flow graphs (ie, just nodes and edges, no
statements, though later on data flow information will be added).
2012-11-15 13:44:07 +09:00
Bill Currie 8b374305d2 Rename dot_flow.c and print_flow.
They're now dot_sblock.c and print_sblock. The new names both better
reflect their purpose and free up "flow" for outputting the real flow
analysis graphs.
2012-11-15 13:44:07 +09:00
Bill Currie c483770121 Rework flow.c with the aim of graph reduction.
Much of the data recently added to sblock_t has been moved to flownode_t.
No graph reduction is carried out yet, but the initial (innermost level)
graph has been built.
2012-11-15 13:44:07 +09:00
Bill Currie 7853bf1859 Calculate a node's successors and predecessors.
The dot graphs are a little odd (arrow heads on the wrong end of the
predecessor edges), but things seem to be correct.
2012-11-15 13:44:06 +09:00
Bill Currie dbf1aa8f72 Attach dags to statement blocks.
Now, if a dag is attached to a statement block, it will be included in the
flowgraph with that statement block.
2012-11-15 13:44:06 +09:00
Bill Currie f8bdd909cc Separate out C and html quoting into separate functions.
Dot sometimes wants normal C quotes, othertimes html. Quite annoying,
really, but this is cleaner anyway.
2012-10-30 12:31:22 +09:00
Bill Currie 034139b806 Move some code around so it's more accessible. 2012-10-27 11:43:29 +09:00
Bill Currie 55ecf94f2d 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.
2012-05-05 18:04:10 +09:00
Bill Currie e866619de6 Output basic block flow diagrams to files.
The output can be controlled via --block-dot (not yet documented). The
files a named <sourcefile>.<function>.<stage>.dot. Currently, stage will be
one of "initial" (after expression to statement conversion), "thread"
(after jump threading), "dead" (after dead block removal), "final" (final
state before actual code emission).
2012-05-04 09:45:51 +09:00
Bill Currie 159f1bafea Add a little more info to statement flow diagrams.
The relative block number and the label user count are printed now.
2012-05-03 22:09:49 +09:00
Bill Currie c79620f04c Make statement blocks more identifiable. 2012-05-03 19:10:44 +09:00
Bill Currie bc1b483525 Nuke the rcsid stuff.
It's pretty useless in git.
2012-04-22 10:56:32 +09:00
Bill Currie 55cc0f9206 Bring back the unsigned type (PROGS version bump)
This is only low-level support (the unsigned keyword still does not work),
but sufficient to make switch statements using jump tables work.
2011-04-09 10:07:47 +09:00
Bill Currie d937172243 Create and use alias operands for alias expressions.
This avoids the alias expression modifying the operand used in other
expressions.
2011-03-03 13:46:07 +09:00
Bill Currie 352be1f8bd Handle null string pointers. 2011-02-14 23:10:45 +09:00
Bill Currie 4a41d97afc Angle brackets and html :P 2011-02-10 14:24:31 +09:00
Bill Currie c7adde8709 Fix some case&paste errors. 2011-02-09 22:04:54 +09:00
Bill Currie 3c849b970b Handle union access now that they're detected properly. 2011-02-08 14:45:48 +09:00
Bill Currie 3b462e16cf Produce flow diagrams of the basic blocks. 2011-01-22 11:40:53 +09:00