comp.lang.ada
 help / color / mirror / Atom feed
From: dewarr@my-dejanews.com
Subject: Re: How does GNAT (or GCC) compile ADA code?
Date: 1998/10/16
Date: 1998-10-16T00:00:00+00:00	[thread overview]
Message-ID: <708jne$2kd$1@nnrp1.dejanews.com> (raw)
In-Reply-To: 707h7o$cvl$1@nnrp1.dejanews.com

In article <707h7o$cvl$1@nnrp1.dejanews.com>,
  dennison@telepath.com wrote:
> In article <asmang-1510981424440001@192.168.0.22>,
>   asmang@mail.wm.edu (Arun Mangalam) wrote:
> > I don't really know how GCC is the backend for GNAT. Does gcc translate
> > Ada code into c and then compile c into machine language, or is it from
> > Ada code directly to machine language code? I'm just curious, and since I
> > don't have gcc installed, I was wondering if someone can either explain
> > this or direct me to a place where I can find this out for myself. Thank
> > you for any help.
>
> Most compilers don't translate source directly into machine code. Instead
they
> first translate the source code into a very low-level (yes, even lower-level
> than C :-) ) intermediate form that is somewhat machine-independent. Most
> optimizations then get performed on that intermediate code. In the final step
> the "backend" of the compiler translates the intermediate form into the
> appropriate machine code for the target cpu.
>
> All forms of gcc, including gnat, gnu fortran, gnu pascal, etc. do this. One
> of the nice things about this approach is that it makes porting easier. Only
> the back-end code generator needs to be changed to port the compiler to a new
> architecture. It also makes it easier to create new compilers, as multiple
> compilers can use the same back-end.
>
> So here's what gnat does. It converts (translates, compiles, whatever term
> you prefer) Ada source code into the special intermediate form that the gcc
> backend understands. Then it has the gcc backend do optimizations and machine
> code generation.


This is more or less correct, but is wrong in one important respect. The
intermediate form into which the Ada is translated for code generation is
in semantic terms certainly not lower level than C, and indeed in some
important respects, considerably higher semantic level than C (it has a
much more advanced type model for example).

Robert Dewar

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    




  reply	other threads:[~1998-10-16  0:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-10-15  0:00 How does GNAT (or GCC) compile ADA code? Arun Mangalam
1998-10-16  0:00 ` dennison
1998-10-16  0:00   ` dewarr [this message]
1998-10-22  0:00   ` Van Snyder
1998-10-22  0:00     ` dennison
replies disabled

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