Discussion:
LLVM
(too old to reply)
Michael Schnell
2016-12-14 14:36:48 UTC
Permalink
Raw Message
I remember that some time ago an LLVM version of fpc was under discussion.

I'd like to know the state.

Background: I might be interested in doing a project that runs in the
browser. It seems that the upcoming technology for this is WebAssembly.
I found that an LLVM backend for WebAssembly somewhere is under
construction.

Of course another (better) option would be a fpc directly creating
WebAssembly, but I understand that this will take a lot of time.

Thanks,
-Michael

_______________________________________________
fpc-devel maillist - fpc-***@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Jonas Maebe
2016-12-15 07:35:47 UTC
Permalink
Raw Message
Post by Michael Schnell
I remember that some time ago an LLVM version of fpc was under discussion.
I'd like to know the state.
If you don't perform control-flow-based LLVM optimizations, almost
everything works on Darwin/x86-64 (and Linux/x86-64, except for safecall
-- the reason for this extra is that safecall is simply ignored on
Darwin). There are currently about 40 testsuite failures left on
Darwin/x86-64 with LLVM, compared to 26 without LLVM.

With such optimizations enabled, everything apart from try/except and
try/finally should work:
* "should" because I did not actually test this, given that exceptions
are pretty common and hence it's not possible to get a baseline
* it's a pretty big "apart from", obviously. I have some ideas on how to
fix this without breaking compatibility with code produced by the
regular code generators, but I'm still working on it.

Note that even once I fix this, exceptions still won't work equally well
as with our regular code generators, due to the points mentioned under
point 3 of "Progress" at http://wiki.freepascal.org/LLVM
Post by Michael Schnell
Background: I might be interested in doing a project that runs in the
browser. It seems that the upcoming technology for this is WebAssembly.
I found that an LLVM backend for WebAssembly somewhere is under
construction.
You would also have to write a WebAssembly RTL for FPC, and you would
have to add some FPC code generator support for a WebAssembly target
(see the first FAQ on the wiki page mentioned above). LLVM IR is by
construction architecture- and platform-specific. It's not like Java
bytecode or CIL (or, for that matter, WebAssembly).


Jonas
_______________________________________________
fpc-devel maillist - fpc-***@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Michael Schnell
2016-12-15 10:03:19 UTC
Permalink
Raw Message
On 15.12.2016 08:35, Jonas Maebe wrote:

Thanks a lot for the detailed explanation !
-Michael
_______________________________________________
fpc-devel maillist - fpc-***@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Karoly Balogh (Charlie/SGR)
2016-12-15 08:53:58 UTC
Permalink
Raw Message
Hi,
Post by Michael Schnell
Of course another (better) option would be a fpc directly creating
WebAssembly, but I understand that this will take a lot of time.
There is some interest in a WebAssembly backend, but yes it will take a
lot of time. No spoilers for now, and nothing to see, move along.

There is also some work underway, to compile Pascal code to JS, but that's
a separate project, not implemented as an FPC backend.

Charlie
_______________________________________________
fpc-devel maillist - fpc-***@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Loading...