LLVM

1 minute read

Published:

I have been learning LLVM for a while; I added a function and variable attribute, new compiler options, wrote a hacky LLVM transformation pass, and deleted my hacky stuff in the backend! I kind of enjoyed it, kind of annoyed; in the end, I think it was good to learn!

The first thing that confused me so much was the New Pass Manager and Legacy Pass Manager. If your pass doesn’t work, that was the reason I think. A blog post about

I was using the cheri-llvm branch, but at that time, that was based on clang-13. I always had a problem understanding how I should do bitcasting, and it always complained that I did wrong casting. One of my colleagues suggested that I use a newer version of Clang that introduces Opaque Pointers. You don’t need to worry about bit cast. Also, control flow analysis is easier.

Some Good References:

  • LLVM IR Tutorial, it is really good for kick-start! https://youtu.be/m8G_S5LwlTo?feature=shared

  • LLVM tutor: https://github.com/banach-space/llvm-tutor

  • LLVM cook book is a good reference

  • LLVM weekly you can check the latest development and activity

  • LLVM Discourse: https://discourse.llvm.org/c/clang/6