diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2019-07-10 09:01:58 +0000 |
---|---|---|
committer | Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> | 2019-07-10 09:01:58 +0000 |
commit | 9ead6ee5c84ed6a5d670e0c5a46d0b1e9a926ca3 (patch) | |
tree | 16bf8ad1fad77c3c54a7b92c95d142609ea900e1 /gcc/ada/init.c | |
parent | 27572ba35feadc66d1a8c1f85a5c12e8bc4a010b (diff) | |
download | gcc-9ead6ee5c84ed6a5d670e0c5a46d0b1e9a926ca3.zip gcc-9ead6ee5c84ed6a5d670e0c5a46d0b1e9a926ca3.tar.gz gcc-9ead6ee5c84ed6a5d670e0c5a46d0b1e9a926ca3.tar.bz2 |
[Ada] Improve support for tuning branch probability heuristics
This adds a new GNAT.Branch_Prediction package to make it possible to
tune the branch probability heuristics more finely. This package
contains the equivalent of __builtin_expect in C/C++ plus a couple of
specializations.
The following program gives a summary of the usage:
package Q is
I : Integer;
pragma Volatile (I);
end Q;
with GNAT.Branch_Prediction; use GNAT.Branch_Prediction;
with Text_IO; use Text_IO;
with Q; use Q;
procedure P is
begin
if Unlikely (I = 0) then
Put_Line ("Zero was passed");
return;
end if;
if Likely (I > 0) then
Put_Line ("A positive number was passed");
else
Put_Line ("A negative number was passed");
end if;
if Expect ((I rem 2) = 0, False) then
Put_Line ("An even number was passed");
else
Put_Line ("An odd number was passed");
end if;
end;
2019-07-10 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* Makefile.rtl (GNATRTL_NONTASKING_OBJS): Add g-brapre.
* libgnat/g-brapre.ads: New package specification.
* doc/gnat_rm/the_gnat_library.rst: Document it.
* gnat_rm.texi: Regenerate.
From-SVN: r273340
Diffstat (limited to 'gcc/ada/init.c')
0 files changed, 0 insertions, 0 deletions