[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Native code generation and gcc
From: |
Helmut Eller |
Subject: |
Re: Native code generation and gcc |
Date: |
Sun, 04 Dec 2016 11:09:54 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) |
The following message is a courtesy copy of an article
that has been posted to gmane.lisp.guile.devel as well.
On Sat, Dec 03 2016, Mikael Djurfeldt wrote:
> Are there fundamental reasons for not re-using the gcc backends for
> native code generation? I'm thinking of the (im?)possibility to
> convert the cps to some of the intermediate languages of gcc.
Tail calls come to mind. GCC is built around the C/C++ ABI and C
calling conventions. Due to C's varargs, that's almost always some
variant of "caller pops arguments". I think sibling calls can be
optimized everywhere but not general tail calls. You could add support
for tail calls to some backends, but that's far from "for free". The C
calling convention is also not that great for returning a (statically)
unknown number of values.
Sure, there are tricks/kludges to compile Scheme to C. I think it would
be simpler/less risky to make a C generating backend for Guile before
going directly to GCC. The main advantage of a direct GCC front-end
would be better control over debugging information.
Helmut