comp.lang.ada
 help / color / mirror / Atom feed
From: Brian Drummond <brian@shapes.demon.co.uk>
Subject: Re: Forking old GMGPL libs ?
Date: Sat, 6 Oct 2012 09:45:38 +0000 (UTC)
Date: 2012-10-06T09:45:38+00:00	[thread overview]
Message-ID: <k4ouk2$731$1@dont-email.me> (raw)
In-Reply-To: 5de9a47c-6594-4653-a083-38f90312e70e@googlegroups.com

On Fri, 05 Oct 2012 15:51:04 -0700, Patrick wrote:


> This is total crack smok'in, I hardly know anything about the clang
> compiler and don't have the time of intelligence to fork GNAT but does
> anyone think it would be technically possible to retool GNAT's to output
> clang's AST. 

Hi Patrick. 

I'm not going to comment on licensing issues, but since I am in the 
process of messing about in the gcc front end for another project:

Grab the gcc sources and look for yourself.
The GNAT compiler is in the gcc/ada folder and it is HUGE. 
However there is a separate folder labelled "gcc-interface" containing 
only 17 files.

Unfortunately these are all in C and some of them are quite large.
Central to the interface is "struct lang-hooks" in misc.c and the defines 
around it. For example, "gnat_parse_file" is the hook into the main 
parser. Hopefully this is written in Ada and exported to the C layer...

This will give you an idea of the size of the project. 

Looking at it, I am glad my project is much smaller, and even that would 
have been too much for a first gcc project.

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.

There have been a couple of suggestions on the GHDL-discuss mailing list 
that GHDL would have been better re-written in C or C++. These take no 
account of the fact that the porting difficulty has ALL been in the 
existing C code (2% or so), the 98% written in Ada has not needed a 
single change...

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.

The benefit of targeting Generic or Gimple is that you can then run GCC's 
extensive optimisation tools before descending to machine output. 
One would hope that Clang can do similar optimisations, given a tree. But 
I don't know the answer to that. 
It looked to me as if LLVM could not; and the DragonEgg plugin for GCC to 
let it output LLVM (after optimisation) suggests there is a need for a 
good optimiser ahead of LLVM. I would be delighted if someone could show 
me otherwise...

- Brian




  parent reply	other threads:[~2012-10-11  7:33 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 [this message]
2012-10-06 11:27   ` LLVM and GCC (was: Forking old GMGPL libs ?) Ludovic Brenta
2012-10-06 14:04     ` 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