DEV Community

Cover image for LLVM - Writing your first pass

LLVM - Writing your first pass

Elvis Oric on August 03, 2023

Writing your first pass with LLVM What is a pass? Simply put, it is a thing that analyzes or transforms LLVM IR inputs. What are we goi...
Collapse
 
codenameone profile image
Shai Almog

Interesting. I'm just working on my first LLVM project. If I understand correctly this is something you would use to review code or inject things like instrumentation etc. I guess you could add custom optimizations too but most of those are probably good enough already.

Did I get this right?

Collapse
 
elvisoric profile image
Elvis Oric

Well, to some extent you are right. But with custom optimisations/transformations you can do things like: Implement obfuscation passes (obfuscate function names), inject function calls(for example inject printf or logging at the beginning of each function), remove function calls, change the control flow the way you want etc. I plan to write more about it in future posts.
Thanks for the comment.