On Fri, 21 Oct 2016 01:32:03 -0700, vincent.diemunsch wrote:
> Le jeudi 20 octobre 2016 20:20:44 UTC+2, Simon Clubley a écrit :
>
>> There is no viable Ada frontend for current versions of LLVM (AFAIK)
>> although various people have looked at this.
>
> Thank you Simon for your answer.
>
> Why Gnat on LLVM has been abandoned ?
My understanding is that it never worked *completely* - maybe it did on
32-bit but the 64-bit backend was giving problems, and there wasn't
enough effort to resolve these issues and keep it up to date with newer
LLVM releases. So if you can find the sources, they are (a) not
completely functional and (b) increasingly obsolete (see Dennis'
experience buisding with gcc versions back to 4.3)
> Was LLVM less appropriate than GCC
> for GNAT ?
Yes. Roughly, the issue is that LLVM is designed to not support local
subprograms (e.g. procedures declared local to other procedures, sharing
the scope of the outer procedure).
This limits its (easy) use to C-like languages, and if you are to support
an Ada-like language you have to find ways round this problem.
The DragonEgg compiler did have such support but as far as I know it was
incomplete in some resperts - memory suggests, exception propagation
didn't work properly for local subprograms, but I'm vague on the details.
> My question precisely was not about the Ada frontend in fact but about a
> binding to use the LLVM from an Ada program that is a sort of compiler.
> I think that those who ported GNAT to LLVM should have created this kind
> of binding, no ?
This has been done.
Not for Ada, but for a compiler written in Ada for another (somewhat) Ada-
like language ... the ghdl compiler for VHDL.
Here, local subprograms are supported, however VHDL doesn't have
exceptions, so that specific bullet has been dodged.
https://github.com/tgingold/ghdl
GHDL is actively supported, and compiles VHDL to three differen compiler
backends - gcc (upto 4.9), LLVM(3.5) and its own JIT compiler, mcode, all
via its own intermediate language "ortho" (which is not normally written
out to file, but can be written and read back in through the LLVM back
end for compiler debugging purposes)
So the compilation stage between "ortho" and the LLVM backend may be
worth looking at, to help develop your own compiler.
-- Brian