From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,362cb73a2f180232 X-Google-Attributes: gid103376,public From: dennison@telepath.com Subject: Re: How does GNAT (or GCC) compile ADA code? Date: 1998/10/16 Message-ID: <707h7o$cvl$1@nnrp1.dejanews.com>#1/1 X-Deja-AN: 401755839 References: X-Http-Proxy: 1.0 x13.dejanews.com:80 (Squid/1.1.22) for client 204.48.27.130 Organization: Deja News - The Leader in Internet Discussion X-Article-Creation-Date: Fri Oct 16 13:20:55 1998 GMT Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.05 [en] (WinNT; I) Date: 1998-10-16T00:00:00+00:00 List-Id: In article , 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. -- T.E.D. -----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own