4 ms·
TypeError: Cannot compare Types COMPLIER and LANGUAGE LLVM is an open source modular complier system. There are three main pieces: The Front-end. This is a pa
by patmorgan23 3y ago
TypeError: Cannot compare Types COMPLIER and LANGUAGE
LLVM is an open source modular complier system. There are three main pieces:
The Front-end. This is a part that reads in your source code files and generates any syntax errors. Clang is an example of a front end. The front end produces IR or "Internal Representation" which is consumed by the other parts of the compiler.
The optimizer. Pretty self explanatory. The optimizer takes in IR and (ideally) moves stuff around some that the final executable runs faster.
The backend. This is where the magic really happens. The backend takes in IR and produces that sweet sweet machine code that we're really after.
The benefit to zig of using LLVM is that they only have to write/maintain a Frontend. I don't think gcc and other C/C++ compliers where quite designed for modularity like LLVM was so building a new front end for them is difficult compared to LLVM.