From: Matt H. <mat...@gm...> - 2007-06-22 03:31:29
|
I think this was done to keep conditionals simple, since the prepareCFG function is used to simplify control flow. You can change this, if you'd like. Of course, this only occurs when using prepareCFG. -- Matt On 6/21/07, Muriel Roger <mur...@ce...> wrote: > > When two or more cases with the same action, CIL tranforms the switch > with multiples such cases. > It's not really false but it's not necessary. > > Here an example : > > > void sw (int sw___f1, int sw___f2) { > > switch( sw___f2 ) > { > case 0 : > printf("case 0\n"); > switch( sw___f1 ) > { > case 1000 : > case 1001 : > printf("case 0/1000...\n"); > break ; > > default : > printf("case 0/default\n"); > break ; > } > break ; > > default : > printf("default\n"); > break ; > } > } > > > and the output file with two cases 1000 and 1001 : > > > void sw(int sw___f1 , int sw___f2 ) > { > > { > if (sw___f2 == 0) { > goto switch_0_0; > } else { > { > goto switch_0_default; > if (0) { > switch_0_0: /* CIL Label */ > printf("case 0\n"); > if (sw___f1 == 1000) { > goto switch_1_1000; > } else { > if (sw___f1 == 1001) { > goto switch_1_1000; > } else { > if (sw___f1 == 1000) { > goto switch_1_1000; > } else { > if (sw___f1 == 1001) { > goto switch_1_1000; > } else { > { > goto switch_1_default; > if (0) { > switch_1_1000: /* CIL Label */ > switch_1_1001: /* CIL Label */ > printf("case 0/1000...\n"); > goto switch_1_break; > switch_1_default: /* CIL Label */ > printf("case 0/default\n"); > goto switch_1_break; > } else { > switch_1_break: /* CIL Label */ ; > } > } > } > } > } > } > goto switch_0_break; > switch_0_default: /* CIL Label */ > printf("default\n"); > goto switch_0_break; > } else { > switch_0_break: /* CIL Label */ ; > } > } > } > return; > } > } > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > CIL-users mailing list > CIL...@li... > https://lists.sourceforge.net/lists/listinfo/cil-users > |