On Tue, Dec 4, 2012 at 10:18 PM, Xinliang David Li wrote: > Was it a bug then?
Yup, a bug. One I introduced myself with the passes.c changes. With the attached patch I get this dump: --------- 8< ----------- digraph "" { overlap=false; subgraph "foo" { color="black"; label="foo"; fn_0_basic_block_1 [shape=Mdiamond,style=filled,fillcolor=white,label="EXIT"]; fn_0_basic_block_2 [shape=record,style=filled,fillcolor=lightgrey,label="{\<bb\ 2\>:\l\ |_3\ =\ a_1(D)\ *\ b_2(D);\l\ |_5\ =\ c_4(D)\ \<\<\ 1;\l\ |e.0_8\ =\ (int)\ e_7(D);\l\ |_10\ =\ d_9(D)\ \<\<\ e.0_8;\l\ |_6\ =\ f_12(D)\ +\ 1;\l\ |_11\ =\ _6\ +\ _5;\l\ |_13\ =\ _11\ +\ _10;\l\ |_14\ =\ _13\ +\ _3;\l\ |_15\ =\ (int)\ _14;\l\ |return\ _15;\l\ }"]; fn_0_basic_block_0 [shape=Mdiamond,style=filled,fillcolor=white,label="ENTRY"]; fn_0_basic_block_0:s -> fn_0_basic_block_2:n [style="solid,bold",color=blue,weight=100,constraint=true]; fn_0_basic_block_2:s -> fn_0_basic_block_1:n [style="solid,bold",color=black,weight=10,constraint=true]; } subgraph "foo2" { color="black"; label="foo2"; fn_1_basic_block_1 [shape=Mdiamond,style=filled,fillcolor=white,label="EXIT"]; fn_1_basic_block_2 [shape=record,style=filled,fillcolor=lightgrey,label="{\<bb\ 2\>:\l\ |e.1_2\ =\ (int)\ e_1(D);\l\ |_4\ =\ f_3(D)\ \<\<\ e.1_2;\l\ |_6\ =\ d_5(D)\ \<\<\ 1;\l\ |_10\ =\ c_8(D)\ *\ b_9(D);\l\ |_7\ =\ a_12(D)\ +\ 1;\l\ |_11\ =\ _7\ +\ _10;\l\ |_13\ =\ _11\ +\ _6;\l\ |_14\ =\ _13\ +\ _4;\l\ |_15\ =\ (int)\ _14;\l\ |return\ _15;\l\ }"]; fn_1_basic_block_0 [shape=Mdiamond,style=filled,fillcolor=white,label="ENTRY"]; fn_1_basic_block_0:s -> fn_1_basic_block_2:n [style="solid,bold",color=blue,weight=100,constraint=true]; fn_1_basic_block_2:s -> fn_1_basic_block_1:n [style="solid,bold",color=black,weight=10,constraint=true]; } } --------- 8< ----------- > It will be nicer to avoid any postprocessing. Once we have the ability > to dump one function at a time, the support will be there > automatically. True. >> The whole graph dumping infrastructure will get another overhaul for >> GCC 4.9 to make it easier to use for non-CFG dumps and to allow passes >> to add their own meta-data to the dumps. > > Do you have a brief design somewhere? Other than in my head? Not really. I'm thinking of something like "graph_traits" and a template class for graph dumping, and make the CFG dumper one specialization of that template (and later add specializations for e.g. the DDG, alias constraint graph, and call graph). But for me, for now, it's more about exploring C++ (which is totally new to me -- I'm a rocket scientist, not a hacker :-) than about having a Grand Design ready. I'll test the patch and commit it if it passes (it partially reverts one of my earlier changes). Thanks for the feedback! Ciao! Steven
graph_dump_fixes.diff
Description: Binary data