Parsing and Modifying LLVM IR code

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

    The easiest way to do this is to look at one of the existing tools and steal code from it. In this case, you might want to look at the source for llc. It can take either a bitcode or .ll file as input. You can modify the input file any way you want and then write out the file using something similar to the code in llvm-dis if you want a text file.

提交回复
热议问题