comp.lang.ada
 help / color / mirror / Atom feed
From: Ludovic Brenta <ludovic@ludovic-brenta.org>
Subject: LLVM and GCC (was: Forking old GMGPL libs ?)
Date: Sat, 06 Oct 2012 13:27:48 +0200
Date: 2012-10-06T13:27:48+02:00	[thread overview]
Message-ID: <87fw5rhmbv.fsf_-_@ludovic-brenta.org> (raw)
In-Reply-To: k4ouk2$731$1@dont-email.me

Brian Drummond writes on comp.lang.ada:
> I am currently trying to get GHDL to build with gcc 4.7; it last built
> successfully with gcc4.3.4 or so. Like Gnat, it is written mostly in
> Ada, with a thin layer of C between it and the GCC internals. However
> it is about an order of magnitude smaller than Gnat.

I'm glad you're doing this; the package ghdl in Debian unstable is stale
and is the last one that still requires gnat-4.4; all other Ada packages
have migrated to gnat-4.6 long ago.

> As to targetting Clang versus LLVM, I haven't looked at Clang. But
> LLVM looked to me like a virtual machine (asm-like) rather than a
> syntax tree (AST like Generic or Gimple in gcc terms). Which to me,
> would raise the question of whether the LLVM back end can do the
> optimisations you want.

LLVM is both the virtual machine and an intermediate representation[1].
Contrary to GCC, LLVM's IR is serializable: one can save it to disk and
re-load it into the virtual machine for ahead-of-time or just-in-time
compilation.  LLVM is also a good optimizer that works on that IR; just
not yet as good as GCC.  The IR is, I think, better designed than that
of GCC because it was designed from the onset as language-neutral and
very rich.  The IR of GCC was initially designed for C only and was
later extended in ad hoc ways for other languages.

[1] http://llvm.org/docs/LangRef.html

A hypothetical Ada front-end for LLVM needs only emit this
well-specified IR.  Duncan Sands once made such an Ada front-end based
on the Ada front-end in GCC 4.2.  I'm not sure how this worked at the
time; I suppose Duncan replaced the GCC interface you mentioned with an
LLVM interface.  This has now been superseded by DragonEgg, whereby the
GCC Ada front-end feeds its AST into LLVM, which then translates it to
its IR, runs its optimizers and emits the final assembly.

-- 
Ludovic Brenta.



  reply	other threads:[~2012-10-11  8:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-05 22:51 Forking old GMGPL libs ? Patrick
2012-10-05 23:52 ` Georg Bauhaus
2012-10-06  3:28   ` Patrick
2012-10-06  9:11     ` Georg Bauhaus
2012-10-06  4:52 ` Stephen Leake
2012-10-06  7:10 ` Florian Weimer
2012-10-06  8:10 ` Simon Wright
2012-10-06  9:45 ` Brian Drummond
2012-10-06 11:27   ` Ludovic Brenta [this message]
2012-10-06 14:04     ` LLVM and GCC (was: Forking old GMGPL libs ?) Patrick
2012-10-06 15:11     ` Brian Drummond
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox