From: Vadim Godunko <vgodunko@gmail.com>
Subject: Re: -gnatN breakage was: Child vs nested package : efficiency matter
Date: Wed, 2 Jun 2010 13:35:29 -0700 (PDT)
Date: 2010-06-02T13:35:29-07:00 [thread overview]
Message-ID: <829c18a5-c0e6-49ab-97b0-bf4f9222471d@q33g2000vbt.googlegroups.com> (raw)
In-Reply-To: 4c068a95$0$6760$9b4e6d93@newsspool3.arcor-online.net
On Jun 2, 8:45 pm, Georg Bauhaus <rm.dash-bauh...@futureapps.de>
wrote:
> On 02.06.10 16:39, Vadim Godunko wrote:
>
> > -gnatN is obsolete, you must use pragma Inline/Inline_Always with -
> > gnatn instead.
>
> Does this mean that 3rd party source cannot be
> inlined across units unless GNAT specific pragma Inline_Always
> is added to these 3rd party sources?
No. Use of -gnatn and -O is sufficient to enable inlining of
subprograms marked by pragma Inline. But not all subprograms will be
inlined but only definitely simple.
For example:
package P is
function Simple (X, Y : Integer) return Integer;
pragma Inline (Simple);
function Complex (X, Y : Integer) return Integer;
pragma Inline (Complex);
end P;
package body P is
function Simple (X, Y : Integer) return Integer is
begin
return X + Y + 1;
end Simple;
function Complex (X, Y : Integer) return Integer is
begin
return X + Y + 1;
exception
when others =>
return 0;
end Complex;
end P;
with P;
function Test_Simple (X, Y : Integer) return Integer is
begin
return P.Simple (X, Y);
end Test_Simple;
with P;
function Test_Complex (X, Y : Integer) return Integer is
begin
return P.Complex (X, Y);
end Test_Complex;
$ gcc -c -S -O -gnatn test_simple.adb
$ gcc -c -S -O -gnatn test_complex.adb
From test_simple.s:
_ada_test_simple:
leal 1(%rdi,%rsi), %eax
ret
From test_complex.s:
_ada_test_complex:
subq $8, %rsp
call p__complex
addq $8, %rsp
ret
next prev parent reply other threads:[~2010-06-02 20:35 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-29 12:56 Child vs nested package : efficiency matter Yannick Duchêne (Hibou57)
2010-05-30 1:17 ` BrianG
2010-06-01 15:03 ` Adam Beneschan
2010-06-01 15:34 ` Yannick Duchêne (Hibou57)
2010-06-01 15:38 ` Adam Beneschan
2010-06-01 19:04 ` Simon Wright
2010-06-01 19:11 ` Yannick Duchêne (Hibou57)
2010-06-02 11:11 ` -gnatN breakage was: " Alex R. Mosteo
2010-06-02 14:39 ` Vadim Godunko
2010-06-02 16:45 ` Georg Bauhaus
2010-06-02 16:50 ` Yannick Duchêne (Hibou57)
2010-06-02 20:35 ` Vadim Godunko [this message]
2010-06-01 18:35 ` Adam Beneschan
2010-06-01 19:09 ` Yannick Duchêne (Hibou57)
2010-06-01 19:44 ` Adam Beneschan
2010-06-01 19:56 ` Yannick Duchêne (Hibou57)
2010-06-02 1:38 ` BrianG
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox