News for hackers. Stuff that matters.
Re:Opinion piece on GHC back ends by chrisseaton on Saturday August 31, 2019 @10:52PM (#20850247)
There are several projects that have tried to use LLVM as a direct backend for higher-level languages, and not many have gone well.

- Rubinius - Ruby JIT on LLVM, often slower than the standard interpreter (!!)

- Pyston - Python JIT by Dropbox, abandoned because it wasn't going anywhere

- FTL - JavaScript backend by Mozilla, they're now doing their own thing with BBB and abandoned LLVM because it wasn't working out

The only ones that have worked well, like Falcon (Java backend by Azul), have major IR and passes in front of them and use LLVM like a portable assembler, but as you say that's not ideal anyway.

You can't just dump your language into LLVM and expect it to work miracles, but people keep trying again and again and again.

Re:Opinion piece on GHC back ends by Q6T46nT668w6i3m on Saturday August 31, 2019 @11:49PM (#20850398)
* Crystal

* R

* Julia

* MATLAB

* Mathematica

* Swift

Use LLVM as their backend.

Re:Opinion piece on GHC back ends by chrisseaton on Sunday September 01, 2019 @12:11AM (#20850452)
These are just more examples of exactly what I mean!

- Crystal is Ruby simplified in order to make it amenable to compilation by LLVM. They couldn't move LLVM to the language, so they had to move the language to LLVM.

- R's performance is very limited.

- Julia was specifically designed to be easy to compile.

- Swift has SIL - they don't just output LLVM. See what they say about LLVM! https://llvm.org/devmtg/2015-10/slides/GroffLattner-SILHighL... 'Wide abstraction gap between source and LLVM IR', 'IR isn't suitable for source-level analysis', etc. And they have these problems even with the best LLVM experts on their team!

I don't know much about MATLAB or Mathematica, sorry.

Re:Opinion piece on GHC back ends by comex on Sunday September 01, 2019 @02:36AM (#20850823)
Even Clang would greatly benefit from an intermediate IR between the C/C++ AST and LLVM IR; the presentation you linked starts off by going over that (and I can confirm that it’s still a problem). That doesn’t mean that LLVM or its IR is bad, or that C or C++ are not suited to being compiled to it. It just means that some analyses and optimizations are best done at a higher level.
Re:Opinion piece on GHC back ends by chrisseaton on Sunday September 01, 2019 @11:48AM (#20852878)
> It just means that some analyses and optimizations are best done at a higher level.

Yes that’s my point - you can’t just emit LLVM and cross your fingers. But people keep on trying.

Re:Opinion piece on GHC back ends by swsieber on Sunday September 01, 2019 @12:51AM (#20850523)
Rust as well.

Notably not on this list and known for fast compile times:

* Nim

* Go

Re:Opinion piece on GHC back ends by chrisseaton on Sunday September 01, 2019 @12:54AM (#20850533)
No, Rust has MIR, and Go is a relatively simple to compile language that maps to LLVM pretty directly. I don't know about Nim, sorry.
Re:Opinion piece on GHC back ends by swsieber on Sunday September 01, 2019 @10:20AM (#20852412)
Ah, I missed "directly" in you original comment. Yeah, rust has a couple of layers.