4 ms·
From an engineering point of view, it’s interesting they chose to implement their own intermediate language, as opposed to just sticking to LLVM IR and “outsour
by codeflo 4y ago
From an engineering point of view, it’s interesting they chose to implement their own intermediate language, as opposed to just sticking to LLVM IR and “outsourcing” the problem of code generation.
I actually researched this some time ago, and was a bit surprised to learn that modern GHC’s intermediate representation seems to differ from what the C-- paper describes quite substantially, in ways that are only described in the source code. They’re still using the same name though.
One observation is that GHC has been somewhat slow to adopt new CPU targets (M1, WebAssembly). I wonder if the reliance on C-- played a role in that.
- FartyMcFarter 4y agoThis project pre-dates LLVM.
- distcs 4y agoLLVM - Initial release: 2003 C-- - Initial release: 1997
- codeflo 4y agoThat by itself only explains the initial decision. It’s still interesting that they’ve stuck to it for 20 years after LLVM’s release. Lots of technical details of GHC changed during that time, it’s not like the architecture is set in stone.
- distcs 4y agoThe point I was replying to was: > it’s interesting they chose to implement their own intermediate language, as opposed to just sticking to LLVM IR and “outsourcing” the problem of code generation I was not replying to: > It’s still interesting that they’ve stuck to it for 20 years after LLVM’s release. Changing the backend from their own IL to LLVM IR several years later is not exactly a "just sticking to LLVM IR" story. Knowing that C-- predates LLVM explains why they chose to implement their own IL.
- nequo 4y agoGHC has supported both Cmm and LLVM as backends for a while: https://downloads.haskell.org/~ghc/7.8.3/docs/html/users_guide/code-generators.html https://downloads.haskell.org/~ghc/7.8.3/docs/html/users_gui...
- remexre 4y agoAnd relevantly, people were clamoring for a non-LLVM AArch64 backend due to how slow LLVM is at codegen by comparison...