From: anon@att.net
Subject: Re: GNAT stuck, any idea on how to diagnose it?
Date: Sun, 14 Sep 2014 21:45:16 +0000 (UTC)
Date: 2014-09-14T21:45:16+00:00 [thread overview]
Message-ID: <lv5299$ert$1@speranza.aioe.org> (raw)
In-Reply-To: vlxfpcmsetjg$.1em03ijtae3i6$.dlg@40tude.net
GNAT is a command shell for Adacore's Ada compiler. And once it
determines what action to be done, GNAT runs a number of programs.
At first GNAT may call the GNAT1 (Ada compiler). This program converts
Ada to assembly language, if the source code is correct, else reports
errors.
"gnat compile <compiler options> <source filename>.ad[b|s]"
or
"gnat make <compiler options> <source filename>.ad[b|s]"
preforms
GNAT --> "gcc <compiler options> <source filename>.ad[b|s]"
gcc --> "gnat1 <compiler options> <source filename>.ad[b|s]"
Second, if GNAT1 returns a no errors condition then GNAT calls the gcc
assembler "as" (gcc assembler)
GNAT --> "as <assembly options> <source filename>"
You can bypass GNAT and the "gcc" steps, by using
gnat1 <compiler options> <source filename>.ad[b|s]
as <assembly options> <source filename>.s
Also, GNAT BIND works almost the same way as GNAT COMPILE except
BIND creates either a Ada package (default) or a C binding package
that can be linked to the runtime code. Note: The binder creates
a package which starts with "b~" added to the source filename.
GNAT --> "gnatbind <binder options> <source filename>.ali"
GNAT --> "gcc <binder options> <b~source filename>.adb"
gcc --> "gnat1 <binder options> <b~source filename>.adb"
GNAT --> "as <assembly options> <b~source filename>.s"
bypassing GNAT would be:
gnatbind <bind options> <source filename>.ali
gnat1 <bind options> options> <b~source filename>.adb
as <assembly options> <b~source filename>.s
But as for time GNAT does not take that much time. The part that takes
the longest is the gcc backend which GNAT uses to convert it internal
gcc IR language to assembly. Mostly it is the optimization phase
in the gcc backend that requires more time ( options -O2 (default),
-O3, -O4 ).
now the process that GNAT1 uses is
GNAT1 :== Ada source --> AST --> GCC IR
at this movement the GCC backend takes over and processes the GCC IR
into assembly
gcc backend :== GCC IR --> ??? --> assembly code
For speed, GNAT1 loads the entire code into memory at one time. Then
basically processes the source as a large data array, while others
compilers may read a line of code at a time (reduced speed). With all
of the checks that the Ada requires in compiling, GNAT1 is very
efficiency during the syntactic and semantic phases. Now the slow
down starts to occur in the backend converter "gigi" which is written
in C. The "gigi" uses the GCC backend which is efficiency for C/C++ but
is not as efficiency for other languages like Ada, Fortran, etc.
One explanation is in translating Ada into the "GCC IR" code the
"gigi" may use or alter the code that makes it difficult for the
GCC optimization to process.
Which means that Adacore's GNAT by now (20 years) should have its own
backend written in Ada, specifically for Ada. That way the world could
see the true speed of the GNAT compiler.
In <vlxfpcmsetjg$.1em03ijtae3i6$.dlg@40tude.net>, "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes:
>On Sun, 14 Sep 2014 09:21:18 +0000 (UTC), Natasha Kerensikova wrote:
>
> Would you know what is this `gnat1`?
> What part of the build process is it?
> What is the command above supposed to perform?
> Is it known to occasionally take a lot of time?
next prev parent reply other threads:[~2014-09-14 21:45 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-14 9:21 GNAT stuck, any idea on how to diagnose it? Natasha Kerensikova
2014-09-14 11:59 ` Georg Bauhaus
2014-09-14 14:49 ` Dmitry A. Kazakov
2014-09-14 15:21 ` Brad Moore
2014-09-14 21:47 ` Natasha Kerensikova
2014-09-14 22:56 ` Anh Vo
2014-09-15 7:15 ` Dmitry A. Kazakov
2014-09-14 21:45 ` anon [this message]
2014-09-15 7:25 ` Dmitry A. Kazakov
2014-09-15 9:56 ` anon
2014-09-15 7:16 ` Natasha Kerensikova
2014-09-15 7:26 ` Jeffrey Carter
2014-09-14 17:45 ` Robert A Duff
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox