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?
Cheers,
--
PMatos