[LLVMdev] Code morphing pass

Speziale Ettore speziale.ettore at gmail.com
Mon Mar 11 00:38:42 PDT 2013


> <xor>
>  <alternative>(xor r1 r2)</alternative>
>  <alternative>
>    (and (or register1 register2) (not (and register1 register2)))
>  </alternative>
> </xor>
> Parsing the string inside the alternative blocks I should be able to
> build basic blocks that contain a sequence of instruction semantically
> equivalent to the original one. And here is my question :)
> Is there any way of doing this using the LLVM infrastructure in a
> simpler or more efficient way?

You can write a TableGen tool to lex and parse your file. The syntax
of the config file will be different, but in this way you have only to
implement semantic analysis.

speziale.ettore at gmail.com

More information about the llvm-dev mailing list