On Saturday, 24 June 2017 at 18:16:46 UTC, FoxyBrown wrote:
Nice to know it's being worked on. I am not really familiar
with llvm but it seems like it can be quite useful. I'm I
correct that basically llvm is an intermediate
representation(sorta like C#/VBS/F#/etc's IR)?
This means that one simply needs a front end that converts the
source code to llvm's IR and then a back end that converts the
IR to targets binary?
Yes indeed. LDC will output the IR when you use the `-output-ll`
(human readable) or `-output-bc` (binary representation) compile
switches.
For example, a quick search for llvm and 8051 gives this:
https://github.com/AndreaCorallo/llvm-i8051
Since, I assume(since there is no documentation describing what
it does) is a backend compiler for llvm's IR to 8051, we can go
from LDC to LLVM to 8051? In theory, of course.
In theory, yes indeed. What may be important is that the LLVM
versions match (the LLVM version used to build LDC, and the LLVM
version of that 8051 fork). With every new LLVM version, the IR
may change in subtle ways...
Is GCC effectively the same(although the IR is skipped?)?
As far as I know, GCC also uses an IR (it's used for LTO).
-Johan