Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LLVM native code generation

How is native code generated using llvm?

If it is possible, can it be done using a Haskell binding?

upd: I mean generate code not in memory, I mean how to generate code and for example save it to file.

like image 299
user1130663 Avatar asked Mar 29 '26 22:03

user1130663


1 Answers

LLVM is a compiler infrastructure that generates native code by processing its internal language — produced by compilers as textual source or an in-memory representation — through a wide variety of optimisations and transformations before converting and linking it into the final native code. So, yes, LLVM can generate native code; in fact, that's its primary purpose.

There is a binding to the LLVM library for Haskell. You can produce LLVM bitcode files with writeBitcodeToFile; llvm-ld can then link those into native code.

like image 131
ehird Avatar answered Apr 02 '26 08:04

ehird



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!