[LLVMdev] Fwd: tblgen bug in handling case , switch_on

Mikhail Glushenkov the.dead.shall.rise at gmail.com
Thu Sep 10 05:25:51 PDT 2009


On Thu, Sep 10, 2009 at 7:26 AM, Sanjiv Gupta
<sanjiv.gupta at microchip.com> wrote:
>> Another way would be to include a "break" command, to take you after the
>> default label.

Yes, this can be useful. I think we should add both 'break' and a
'match' form, and make 'match' the only one allowed in the cmd_line
property. This will make the semantics of 'case' less ambiguous.

> Also, it would be nice to have some "general predicates" to do some cleaning
> up of the command line.
> For example: if an user specifies all -O0, -O1, -O2 on the command line, one
> would be able to choose only the first or last, or give an error.
> option_validator ("O0", "O1", "O2"), (choose_first)
> OR
> option_validator ("O0", "O1", "O2"), (choose_last)
> OR
> option_validator ("O0", "O1", "O2"), (error "Only one of -O0, -O1, or -O2
> are allowed).

Good idea. I propose adding something along these lines:

def Preprocess : OptionPreprocessor <[
 (squash ["O1", "O2", "O3"], "O3"),
 (squash ["O1", "O2"], "O2"),
 (conflict  (and (switch_on "E"), (switch_on "S"))),
 (warning (and (switch_on "E"), (switch_on "S")), "-E conflicts with -S")

The preprocessing code will run once in the beginning.

()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments

More information about the llvm-dev mailing list