summaryrefslogtreecommitdiff
path: root/gcc/ada/eval_fat.adb
diff options
context:
space:
mode:
authorGeert Bosch <bosch@adacore.com>2010-10-22 09:28:24 +0000
committerArnaud Charlet <charlet@gcc.gnu.org>2010-10-22 11:28:24 +0200
commitd32e3ceeb2eb3af35508ee00f288d8cf3483ff21 (patch)
tree7f0e836c6c46bdea870554de215d6ec19f206413 /gcc/ada/eval_fat.adb
parent8110ee3b6349ae4b1a369996a25161dc6a0f067e (diff)
downloadgcc-d32e3ceeb2eb3af35508ee00f288d8cf3483ff21.tar.gz
Make-lang.in: Remove ttypef.ads
2010-10-22 Geert Bosch <bosch@adacore.com> * gcc-interface/Make-lang.in: Remove ttypef.ads * checks.adb: Use Machine_Mantissa_Value and Machine_Radix_Value instead of Machine_Mantissa and Machine_Radix. * cstand.adb (P_Float_Range): Directly print the Type_Low_Bound and Type_High_Bound of the type, instead of choosing constants from Ttypef. (Set_Float_Bounds): Compute the bounds based on Machine_Radix_Value, Machine_Emax_Value and Machine_Mantissa_Value instead of special-casing each type. * einfo.ads (Machine_Emax_Value, Machine_Emin_Value, Machine_Mantissa_Value, Machine_Radix_Value, Model_Emin_Value, Model_Epsilon_Value, Model_Mantissa_Value, Model_Small_Value, Safe_Emax_Value, Safe_First_Value, Safe_Last_Value): Add new synthesized floating point attributes. * einfo.adb (Float_Rep): Determine the kind of floating point representation used for a given type. (Machine_Emax_Value, Machine_Emin_Value, Machine_Mantissa_Value, Machine_Radix_Value): Implement based on Float_Rep_Kind of a type and the number of digits in the type. (Model_Emin_Value, Model_Epsilon_Value, Model_Mantissa_Value, Model_Small_Value, Safe_Emax_Value, Safe_First_Value, Safe_Last_Value): Implement new synthesized floating point attributes based on the various machine attributes. * eval_fat.ads: Remove Machine_Mantissa and Machine_Radix. * eval_fat.adb (Machine_Mantissa, Machine_Radix): Remove. Use the Machine_Mantissa_Value and Machine_Radix_Value functions instead. * exp_vfpt.adb (VAXFF_Digits, VAXDF_Digits, VAXFG_Digits): Define local constants, instead of using constants from Ttypef. * gnat_rm.texi: Reword comments referencing Ttypef. * sem_attr.ads: Reword comment referencing Ttypef. * sem_attr.adb (Float_Attribute_Universal_Integer, Float_Attribute_Universal_Real): Remove. (Attribute_Machine_Emax, Attribute_Machine_Emin, Attribute_Machine_Mantissa, Attribute_Model_Epsilon, Attribute_Model_Mantissa, Attribute_Model_Small, Attribute_Safe_Emax, Attribute_Safe_First, Attribute_Safe_Last, Model_Small_Value): Use attributes in Einfo instead of Float_Attribute_Universal_Real and Float_Attribute_Universal_Integer and all explicit constants. * sem_util.ads, sem_util.adb (Real_Convert): Remove. * sem_vfpt.adb (VAXDF_Digits, VAXFF_Digits, VAXGF_Digits, IEEEL_Digits, IEEES_Digits): New local constants, in order to remove dependency on Ttypef. * tbuild.ads (Make_Float_Literal): New function. * tbuild.adb (Make_Float_Literal): New function to create a new N_Real_Literal, constructing it as simple as possible for best output of constants in -gnatS. * ttypef.ads: Remove. From-SVN: r165808
Diffstat (limited to 'gcc/ada/eval_fat.adb')
-rw-r--r--gcc/ada/eval_fat.adb135
1 files changed, 14 insertions, 121 deletions
diff --git a/gcc/ada/eval_fat.adb b/gcc/ada/eval_fat.adb
index 78dcea60165..3d0bff6a30f 100644
--- a/gcc/ada/eval_fat.adb
+++ b/gcc/ada/eval_fat.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -25,8 +25,6 @@
with Einfo; use Einfo;
with Errout; use Errout;
-with Sem_Util; use Sem_Util;
-with Ttypef; use Ttypef;
with Targparm; use Targparm;
package body Eval_Fat is
@@ -67,13 +65,11 @@ package body Eval_Fat is
Mode : Rounding_Mode);
-- This is similar to Decompose, except that the Fraction value returned
-- is an integer representing the value Fraction * Scale, where Scale is
- -- the value (Radix ** Machine_Mantissa (RT)). The value is obtained by
- -- using biased rounding (halfway cases round away from zero), round to
- -- even, a floor operation or a ceiling operation depending on the setting
- -- of Mode (see corresponding descriptions in Urealp).
-
- function Machine_Emin (RT : R) return Int;
- -- Return value of the Machine_Emin attribute
+ -- the value (Machine_Radix_Value (RT) ** Machine_Mantissa_Value (RT)). The
+ -- value is obtained by using biased rounding (halfway cases round away
+ -- from zero), round to even, a floor operation or a ceiling operation
+ -- depending on the setting of Mode (see corresponding descriptions in
+ -- Urealp).
--------------
-- Adjacent --
@@ -155,7 +151,7 @@ package body Eval_Fat is
Fraction := UR_From_Components
(Num => Int_F,
- Den => UI_From_Int (Machine_Mantissa (RT)),
+ Den => Machine_Mantissa_Value (RT),
Rbase => Radix,
Negative => False);
@@ -192,7 +188,7 @@ package body Eval_Fat is
-- True iff Fraction is even
Most_Significant_Digit : constant UI :=
- Radix ** (Machine_Mantissa (RT) - 1);
+ Radix ** (Machine_Mantissa_Value (RT) - 1);
Uintp_Mark : Uintp.Save_Mark;
-- The code is divided into blocks that systematically release
@@ -475,7 +471,7 @@ package body Eval_Fat is
------------------
function Leading_Part (RT : R; X : T; Radix_Digits : UI) return T is
- RD : constant UI := UI_Min (Radix_Digits, Machine_Mantissa (RT));
+ RD : constant UI := UI_Min (Radix_Digits, Machine_Mantissa_Value (RT));
L : UI;
Y : T;
begin
@@ -496,7 +492,7 @@ package body Eval_Fat is
is
X_Frac : T;
X_Exp : UI;
- Emin : constant UI := UI_From_Int (Machine_Emin (RT));
+ Emin : constant UI := Machine_Emin_Value (RT);
begin
Decompose (RT, X, X_Frac, X_Exp, Mode);
@@ -513,9 +509,8 @@ package body Eval_Fat is
if X_Exp < Emin then
declare
- Emin_Den : constant UI :=
- UI_From_Int
- (Machine_Emin (RT) - Machine_Mantissa (RT) + 1);
+ Emin_Den : constant UI := Machine_Emin_Value (RT)
+ - Machine_Mantissa_Value (RT) + Uint_1;
begin
if X_Exp < Emin_Den or not Denorm_On_Target then
if UR_Is_Negative (X) then
@@ -569,108 +564,6 @@ package body Eval_Fat is
return Scaling (RT, X_Frac, X_Exp);
end Machine;
- ------------------
- -- Machine_Emin --
- ------------------
-
- function Machine_Emin (RT : R) return Int is
- Digs : constant UI := Digits_Value (RT);
- Emin : Int;
-
- begin
- if Vax_Float (RT) then
- if Digs = VAXFF_Digits then
- Emin := VAXFF_Machine_Emin;
-
- elsif Digs = VAXDF_Digits then
- Emin := VAXDF_Machine_Emin;
-
- else
- pragma Assert (Digs = VAXGF_Digits);
- Emin := VAXGF_Machine_Emin;
- end if;
-
- elsif Is_AAMP_Float (RT) then
- if Digs = AAMPS_Digits then
- Emin := AAMPS_Machine_Emin;
-
- else
- pragma Assert (Digs = AAMPL_Digits);
- Emin := AAMPL_Machine_Emin;
- end if;
-
- else
- if Digs = IEEES_Digits then
- Emin := IEEES_Machine_Emin;
-
- elsif Digs = IEEEL_Digits then
- Emin := IEEEL_Machine_Emin;
-
- else
- pragma Assert (Digs = IEEEX_Digits);
- Emin := IEEEX_Machine_Emin;
- end if;
- end if;
-
- return Emin;
- end Machine_Emin;
-
- ----------------------
- -- Machine_Mantissa --
- ----------------------
-
- function Machine_Mantissa (RT : R) return Nat is
- Digs : constant UI := Digits_Value (RT);
- Mant : Nat;
-
- begin
- if Vax_Float (RT) then
- if Digs = VAXFF_Digits then
- Mant := VAXFF_Machine_Mantissa;
-
- elsif Digs = VAXDF_Digits then
- Mant := VAXDF_Machine_Mantissa;
-
- else
- pragma Assert (Digs = VAXGF_Digits);
- Mant := VAXGF_Machine_Mantissa;
- end if;
-
- elsif Is_AAMP_Float (RT) then
- if Digs = AAMPS_Digits then
- Mant := AAMPS_Machine_Mantissa;
-
- else
- pragma Assert (Digs = AAMPL_Digits);
- Mant := AAMPL_Machine_Mantissa;
- end if;
-
- else
- if Digs = IEEES_Digits then
- Mant := IEEES_Machine_Mantissa;
-
- elsif Digs = IEEEL_Digits then
- Mant := IEEEL_Machine_Mantissa;
-
- else
- pragma Assert (Digs = IEEEX_Digits);
- Mant := IEEEX_Machine_Mantissa;
- end if;
- end if;
-
- return Mant;
- end Machine_Mantissa;
-
- -------------------
- -- Machine_Radix --
- -------------------
-
- function Machine_Radix (RT : R) return Nat is
- pragma Warnings (Off, RT);
- begin
- return Radix;
- end Machine_Radix;
-
-----------
-- Model --
-----------
@@ -818,8 +711,8 @@ package body Eval_Fat is
----------
function Succ (RT : R; X : T) return T is
- Emin : constant UI := UI_From_Int (Machine_Emin (RT));
- Mantissa : constant UI := UI_From_Int (Machine_Mantissa (RT));
+ Emin : constant UI := Machine_Emin_Value (RT);
+ Mantissa : constant UI := Machine_Mantissa_Value (RT);
Exp : UI := UI_Max (Emin, Exponent (RT, X));
Frac : T;
New_Frac : T;