Menu

Post image 1
Post image 2
Post image 3
Post image 4
1 / 4
0

LLVM #6 — Compiling to Object Code.

DEV Community·Lahari Tenneti·4 months ago
#FGv7j0w6
#dev#should#include#fullscreen#celsius#target
Reading 0:00
15s threshold

This is a short chapter but with a very tangible and "objective" payoff. Basically, every function we typed into the REPL got compiled and ran inside the same process, in RAM. The JIT took the IR, converted it into machine code, and executed it instantly. When the process exits, it's all gone. Now, instead of "running" the code, we write it to the disk as a .o file, which is compiled into machine code in a format the linker understands. This can be linked with any other C++ program, enabling us to call the Kaleidoscope functions as if they were normal C functions. The code actually outlives the compiler process that produced it. What I built: Commit f229e86 What I understood: The process of emitting object code includes picking a target, describing the machine, configuring the module, and emitting. 1) The Target Triple: So LLVM is designed for cross-compilation, meaning it can target an Intel Mac, an ARM Phone, a Windows PC... anything.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More