[LLVMdev] tblgen bug in handling case , switch_on

Sanjiv Gupta sanjiv.gupta at microchip.com
Sat Sep 5 11:46:35 PDT 2009


Hi Mikhail,

What is mentioned in the reference manual is this:

    // Evaluates to "cmdline1" if the option "-A" is provided on the
    // command line; to "cmdline2" if "-B" is provided;
    // otherwise to "cmdline3".
  
   (case
        (switch_on "A"), "cmdline1",
        (switch_on "B"), "cmdline2",
        (default), "cmdline3")
 

What is generated is this:

     if (A) {
       ...
     }
   
     if (B) {
       ....
     } else {
       ....
     }

   
IMO, What should be generated is below:

     if (A) {
       ...
     } else if (B) {
       ....
     } else {
       ....
     }

BTW, to give you more details, I am using append_cmd on each switch_on.


- Sanjiv




More information about the llvm-dev mailing list