Parsing and Modifying LLVM IR code

后端 未结 5 1533
说谎
说谎 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:16

    This is usually done by implementing an LLVM pass/transform. This way you don't have to parse the IR at all because LLVM will do it for you and you will operate on a object-oriented in-memory representation of the IR.

    This is the entry point for writing an LLVM pass. Then you can look at any of the already implemented standard passes that come bundled with LLVM (look into lib/Transforms).

提交回复
热议问题