Hacker News new | past | comments | ask | show | jobs | submit login

The IR acts as an intermediary between the compiler's front-end (parsing and semantic analysis) and the back-end (machine-code optimizations and generation). The independent IR makes it possible to reuse, say, a C-language front-end regardless of the targeted object code. Similarly, an x86 back-end can be reused with any programming language.

Another nicety of a "high-level" IR vs machine code is that a lot of details become easier. LLVM has an infinite number of registers, and abstracts-out much of the calling convention.




I see, thank you. I imagine the target audience is less "users of x86" and more "I just wrote a weird embedded CPU and I want compilers for it, ill just write an LLVM backend and get them for free", is that right?


I wouldn't say "for free", but yes, LLVM definitely contains some non-mainstream backends, and you can write your own.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: