Parsing and Modifying LLVM IR code

后端 未结 5 1530
说谎
说谎 2020-12-14 04:20

I want to read (parse) LLVM IR code (which is saved in a text file) and add some of my own code to it. I need some example of doing this, that is, how this is done by using

5条回答
  •  执念已碎
    2020-12-14 05:22

    The Opt tool takes llvm IR code, runs a pass on it, and then spits out transformed llvm IR on the other side.

    The easiest to start hacking is lib\Transforms\Hello\Hello.cpp. Hack it, run through opt with your source file as input, inspect output.

    Apart from that, the docs for writing passes is really quite good.

提交回复
热议问题