Hacker News new | ask | show | jobs
by jcranmer 1689 days ago
When you have an LLVM frontend, what you generally do is have your driver run the optimization and code generation steps itself using the LLVM APIs rather than using opt/llc binaries to drive this step. That way, you don't need the LLVM binaries, just the libraries that you statically link into your executable.

For example, all of the code in clang to do this is located in https://github.com/llvm/llvm-project/blob/main/clang/lib/Cod...

1 comments

What if my frontend is written in non cpp? e.g haskell, js, java, c#, etc.
You use the LLVM-C bindings via your favorite FFI mechanism to generate the code then, usually.