Parsing and Modifying LLVM IR code

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

    As mentioned above the best way it to write a pass. But if you want to simply iterate through the instructions and do something with the LLVM provided an InstVisitor class. It is a class that implements the visitor pattern for instructions. It is very straight forward to user, so if you want to avoid learning how to implement a pass, you could resort to that.

提交回复
热议问题