code examples for learning LLVM backend programming

前端 未结 3 508
广开言路
广开言路 2020-12-23 15:09

I am learning programming LLVM backends.

Currently I am interested in analysis passes, later program transformations. (I assume as I will be more fluent with analys

相关标签:
3条回答
  • 2020-12-23 15:48

    All LLVM transformations are organized as self-contained passes inside lib/Transforms dir, You can read its sources and run any arbitrary pass on your code using opt tool.

    Also, there is nice tutorial on how to write your own pass and use it as loadable module without recompiling whole LLVM.

    So there is pretty wide playground already.

    0 讨论(0)
  • 2020-12-23 15:52

    As someone that did what you want to do 3 years ago: LLVM codebase has the best examples. Maybe a good place to start is dominator analysis, as it is well described in compiler books.

    Check how it is done in LLVM: http://llvm.org/doxygen/Dominators_8h_source.html

    Other place to look might be instruction scheduling.

    0 讨论(0)
  • 2020-12-23 15:56

    I was looking for something similar, code that uses llvm libraries, and after long session in google I just found it in the llvm website under "llvm projects": http://llvm.org/ProjectsWithLLVM/

    just download what you think relevant for you and play along.

    0 讨论(0)
提交回复
热议问题