On Fri, Sep 10, 2010 at 5:51 PM, Ian Lance Taylor <i...@google.com> wrote: > Richard Guenther <richard.guent...@gmail.com> writes: > >> On Fri, Sep 10, 2010 at 5:39 PM, Paulo J. Matos <pocma...@gmail.com> wrote: >>> Hello, >>> >>> On my frontend pass, I am dealing with basic blocks and I am for: >>> ,---- >>> | int f(int n) >>> | { >>> | switch(n) >>> | { >>> | case 0: f1("0"); break; >>> | case 500: f2("500"); break; >>> | case 1000: f3("1000"); break; >>> | default: d(); break; >>> | } >>> | } >>> `---- >>> >>> transforming it into: >>> ,---- >>> | int f(int n) >>> | { >>> | if(n < 500) >>> | if(n == 0) >>> | f1("0"); >>> | else >>> | goto def; >>> | else >>> | if(n == 500) >>> | f2("500"); >>> | else >>> | if(n == 1000) >>> | f3("1000"); >>> | else >>> | goto def; >>> | >>> | return; >>> | >>> | def: >>> | d(); >>> | return; >>> | } >>> `---- >>> >>> The problem with this is that it contains nested ifs. >>> Is there a way for me to insert this tree and ask GCC to rebuild the CFG >>> or I need to build the correct CFG manually? >> >> You need to build it manually. > > Can't he just call find_many_sub_basic_blocks?
I doubt that anbody tested this on the tree-level, so I doubt it'll work correctly. Richard. > Ian >