[Ada] Implement tiered support for floating-point input operations
authorEric Botcazou <ebotcazou@adacore.com>
Mon, 23 Nov 2020 14:42:08 +0000 (15:42 +0100)
committerPierre-Marie de Rodat <derodat@adacore.com>
Tue, 15 Dec 2020 11:41:55 +0000 (06:41 -0500)
commit338e513351c03cf66197e8316a69d5459e52f9ed
treed56e4d2c3b0c545ac06e13a3fa443ac2d4e4418a
parent1851d3cef24d4cbc3b55305c75c04a2ce9667315
[Ada] Implement tiered support for floating-point input operations

gcc/ada/

* Makefile.rtl (GNATRTL_NONTASKING_OBJS): Remove s-fatsfl$(objext)
and add s-valflt$(objext), s-vallfl$(objext), s-valllf$(objext).
* exp_attr.adb (Find_Fat_Info): Merge Short_Float and Float cases.
* exp_imgv.adb (Expand_Value_Attribute): Replace RE_Value_Real with
RE_Value_Long_Long_Float for fixed-point types and use appropriate
base type for floating-point types.
* rtsfind.ads (RTU_Id): Remove System_Fat_IEEE_Long_Float,
System_Fat_IEEE_Short_Float and System_Val_Real, add System_Val_Flt,
System_Val_LFlt and System_Val_LLF.
(RE_Id): Remove RE_Attr_IEEE_Long, RE_Fat_IEEE_Long,
RE_Attr_IEEE_Short, RE_Fat_IEEE_Short, RE_Attr_Short_Float, add
RE_Value_Float, RE_Value_Long_Float, RE_Value_Long_Long_Float,
(RE_Unit_Table): Likewise.
* libgnat/a-ticoau.ads: Add with clause for Float_Aux and make the
package generic.
(Get): Change parameter types to Num.
(Put): Likewise.
(Gets): Likewise.
(Puts): Likewise.
* libgnat/a-ticoau.adb: Remove clause and renaming for Float_Aux.
(Get): Change parameter types to Num.
(Gets): Likewise.
(Put): Likewise.
(Puts): Likewise.  Add conversion to Long_Long_Float.
* libgnat/a-ticoio.adb: Remove with clause for Ada.Text_IO, add with
clause for Float_Aux, add with and use clauses for System.Val_Flt,
System.Val_LFlt and System.Val_LLF. Instantiate Float_Aux and
Complex_Aux on Float, Long_Float, and Long_Long_Float.
(OK_Float): New boolean constant.
(OK_Long_Float): Likewise.
(Get): Call appropriate Get routine from auxiliary package.
(Get): Call appropriate Gets routine from auxiliary package.
(Put): Call appropriate Put routine from auxiliary package.
(Put): Call appropriate Puts routine from auxiliary package.
* libgnat/a-tideau.adb: Remove with and use clause for Float_Aux.
* libgnat/a-tifiau.adb: Likewise.
* libgnat/a-tifiio.adb: Add with and use clause for System.Val_LLF.
Instantiate Float_Aux on Long_Long_Float.
(Get): Adjust call to Get routine from auxiliary package.
(Get): Adjust call to Gets routine from auxiliary package.
(Put): Adjust call to Put routine from auxiliary package.
(Put): Adjust call to Puts routine from auxiliary package.
* libgnat/a-tifiio__128.adb: Likewise.
(Get): Likewise.
(Get): Likewise.
(Put): Likewise.
(Put): Likewise.
* libgnat/a-tiflau.ads: Make the package generic.
(Get): Change parameter type to Num.
(Put): Likewise.
(Gets): Likewise.
(Puts): Likewise.
* libgnat/a-tiflau.adb: Remove clauses for System.Val_Real.
(Get): Change parameter type to Num and call Scan routine.
(Gets): Likewise.
(Load_Real): Move to...
(Put): Change parameter type and add conversion to Long_Long_Float.
(Puts): Likewise.
* libgnat/a-tiflio.adb: Add with and use clauses for System.Val_Flt,
System.Val_LFlt and System.Val_LLF. Instantiate Float_Aux on Float,
Long_Float and Long_Long_Float.
(OK_Float): New boolean constant.
(OK_Long_Float): Likewise.
(Get): Call appropriate Get routine from auxiliary package.
(Get): Call previous variant.
(Get): Call appropriate Gets routine from auxiliary package.
(Put): Call appropriate Put routine from auxiliary package.
(Put): Call previous variant.
(Put): Call appropriate Puts routine from auxiliary package.
* libgnat/a-tigeau.ads (Load_Real): New procedure.
* libgnat/a-tigeau.adb (Load_Real): ...here.
* libgnat/a-wtcoau.ads: Add with clause for Float_Aux and make the
package generic.
(Get): Change parameter types to Num.
(Put): Likewise.
(Gets): Likewise.
(Puts): Likewise.
* libgnat/a-wtcoau.adb: Remove clause and renaming for Float_Aux.
(Get): Change parameter types to Num.
(Gets): Likewise.
(Put): Likewise.
(Puts): Likewise.  Add conversion to Long_Long_Float.
* libgnat/a-wtcoio.ads: Remove use clause for Complex_Types and use
qualified names throughout accordingly.
* libgnat/a-wtcoio.adb: Remove clause for Ada.Unchecked_Conversion,
add with clause for Float_Aux, add clauses for System.Val_Flt,
System.Val_LFlt and System.Val_LLF. Add clause for Complex_Types.
Instantiate Float_Aux and Complex_Aux on Float, Long_Float, and
Long_Long_Float.  Remove LLF subtype and TFT instantiation.
(OK_Float): New boolean constant.
(OK_Long_Float): Likewise.
(Get): Call appropriate Get routine from auxiliary package.
(Get): Call appropriate Gets routine from auxiliary package.
(Put): Call appropriate Put routine from auxiliary package.
(Put): Call appropriate Puts routine from auxiliary package.
* libgnat/a-wtdeau.adb: Remove with and use clause for Float_Aux.
* libgnat/a-wtfiau.adb: Likewise.
* libgnat/a-wtfiio.adb: Add with and use clause for System.Val_LLF.
Instantiate Float_Aux on Long_Long_Float.
(Get): Adjust call to Get routine from auxiliary package.
(Get): Adjust call to Gets routine from auxiliary package.
(Put): Adjust call to Put routine from auxiliary package.
(Put): Adjust call to Puts routine from auxiliary package.
* libgnat/a-wtfiio__128.adb: Likewise.
(Get): Likewise.
(Get): Likewise.
(Put): Likewise.
(Put): Likewise.
* libgnat/a-wtflau.ads: Make the package generic.
(Get): Change parameter type to Num.
(Put): Likewise.
(Gets): Likewise.
(Puts): Likewise.
* libgnat/a-wtflau.adb: Remove clauses for System.Val_Real.
(Get): Change parameter type to Num and call Scan routine. Set
Ptr parameter lazily.
(Gets): Likewise.
(Load_Real): Move to...
(Put): Change parameter type and add conversion to Long_Long_Float.
Bump buffer length to Max_Real_Image_Length.
(Puts): Likewise.
* libgnat/a-wtflio.adb: Add with and use clauses for System.Val_Flt,
System.Val_LFlt and System.Val_LLF. Instantiate Float_Aux on Float,
Long_Float and Long_Long_Float.
(OK_Float): New boolean constant.
(OK_Long_Float): Likewise.
(Get): Call appropriate Get routine from auxiliary package.  Add
pragma Unsuppress (Range_Check) and manual validity check.
(Get): Call appropriate Gets routine from auxiliary package. Add
pragma Unsuppress (Range_Check) and manual validity check.
(Put): Call appropriate Put routine from auxiliary package.
(Put): Call appropriate Puts routine from auxiliary package.
* libgnat/a-wtgeau.ads (Load_Real): New procedure.
* libgnat/a-wtgeau.adb (Load_Real): ...here.
* libgnat/a-ztcoau.ads: Add with clause for Float_Aux and make the
package generic.
(Get): Change parameter types to Num.
(Put): Likewise.
(Gets): Likewise.
(Puts): Likewise.
* libgnat/a-ztcoau.adb: Remove clause and renaming for Float_Aux.
(Get): Change parameter types to Num.
(Gets): Likewise.
(Put): Likewise.
(Puts): Likewise.  Add conversion to Long_Long_Float.
* libgnat/a-ztcoio.ads: Remove use clause for Complex_Types and use
qualified names throughout accordingly.
* libgnat/a-ztcoio.adb: Remove clause for Ada.Unchecked_Conversion,
add with clause for Float_Aux, add clauses for System.Val_Flt,
System.Val_LFlt and System.Val_LLF. Add clause for Complex_Types.
Instantiate Float_Aux and Complex_Aux on Float, Long_Float, and
Long_Long_Float. Remove LLF subtype and TFT instantiation.
(OK_Float): New boolean constant.
(OK_Long_Float): Likewise.
(Get): Call appropriate Get routine from auxiliary package.
(Get): Call appropriate Gets routine from auxiliary package.
(Put): Call appropriate Put routine from auxiliary package.
(Put): Call appropriate Puts routine from auxiliary package.
* libgnat/a-ztdeau.adb: Remove with and use clause for Float_Aux.
* libgnat/a-ztfiau.adb: Likewise.
* libgnat/a-ztfiio.adb: Add with and use clause for System.Val_LLF.
Instantiate Float_Aux on Long_Long_Float.
(Get): Adjust call to Get routine from auxiliary package.
(Get): Adjust call to Gets routine from auxiliary package.
(Put): Adjust call to Put routine from auxiliary package.
(Put): Adjust call to Puts routine from auxiliary package.
* libgnat/a-ztfiio__128.adb: Likewise.
(Get): Likewise.
(Get): Likewise.
(Put): Likewise.
(Put): Likewise.
* libgnat/a-ztflau.ads: Make the package generic.
(Get): Change parameter type to Num.
(Put): Likewise.
(Gets): Likewise.
(Puts): Likewise.
* libgnat/a-ztflau.adb: Remove clauses for System.Val_Real.
(Get): Change parameter type to Num and call Scan routine. Set
Ptr parameter lazily.
(Gets): Likewise.
(Load_Real): Move to...
(Put): Change parameter type and add conversion to Long_Long_Float.
Bump buffer length to Max_Real_Image_Length.
(Puts): Likewise.
* libgnat/a-ztflio.adb: Add with and use clauses for System.Val_Flt,
System.Val_LFlt and System.Val_LLF. Instantiate Float_Aux on Float,
Long_Float and Long_Long_Float.
(OK_Float): New boolean constant.
(OK_Long_Float): Likewise.
(Get): Call appropriate Get routine from auxiliary package.  Add
pragma Unsuppress (Range_Check) and manual validity check.
(Get): Call appropriate Gets routine from auxiliary package. Add
pragma Unsuppress (Range_Check) and manual validity check.
(Put): Call appropriate Put routine from auxiliary package.
(Put): Call appropriate Puts routine from auxiliary package.
* libgnat/a-ztgeau.ads (Load_Real): New procedure.
* libgnat/a-ztgeau.adb (Load_Real): ...here.
* libgnat/s-fatsfl.ads: Delete.
* libgnat/s-valflt.ads: New package.
* libgnat/s-vallfl.ads: Likewise.
* libgnat/s-valllf.ads: Likewise.
* libgnat/s-valrea.ads: Make generic. Add assertions, defensive
code and clarify intent.
(Scan_Real): Change parameter type to Num.
(Value_Real): Likewise.
* libgnat/s-valrea.adb: Instantiate Value_R on Uns.
(Integer_to_Real): Change parameter and result to Num.
Call Float_Control.Reset only if the mantissa is 64 bits.  Use
a divide to compute the final value if the scale is negative.
(Scan_Real): Change result to Num.
(Value_Real): Likewise.
* libgnat/s-valuer.adb: Add assertions, defensive code and
clarify intent.
(F_Limit): Delete.
(I_Limit): Likewise.
(Precision_Limit): Always use the integer limit.
* libgnat/s-fatgen.adb: Add pragma Annotate.
49 files changed:
gcc/ada/Makefile.rtl
gcc/ada/exp_attr.adb
gcc/ada/exp_imgv.adb
gcc/ada/libgnat/a-ticoau.adb
gcc/ada/libgnat/a-ticoau.ads
gcc/ada/libgnat/a-ticoio.adb
gcc/ada/libgnat/a-tideau.adb
gcc/ada/libgnat/a-tifiau.adb
gcc/ada/libgnat/a-tifiio.adb
gcc/ada/libgnat/a-tifiio__128.adb
gcc/ada/libgnat/a-tiflau.adb
gcc/ada/libgnat/a-tiflau.ads
gcc/ada/libgnat/a-tiflio.adb
gcc/ada/libgnat/a-tigeau.adb
gcc/ada/libgnat/a-tigeau.ads
gcc/ada/libgnat/a-wtcoau.adb
gcc/ada/libgnat/a-wtcoau.ads
gcc/ada/libgnat/a-wtcoio.adb
gcc/ada/libgnat/a-wtcoio.ads
gcc/ada/libgnat/a-wtdeau.adb
gcc/ada/libgnat/a-wtfiau.adb
gcc/ada/libgnat/a-wtfiio.adb
gcc/ada/libgnat/a-wtfiio__128.adb
gcc/ada/libgnat/a-wtflau.adb
gcc/ada/libgnat/a-wtflau.ads
gcc/ada/libgnat/a-wtflio.adb
gcc/ada/libgnat/a-wtgeau.adb
gcc/ada/libgnat/a-wtgeau.ads
gcc/ada/libgnat/a-ztcoau.adb
gcc/ada/libgnat/a-ztcoau.ads
gcc/ada/libgnat/a-ztcoio.adb
gcc/ada/libgnat/a-ztcoio.ads
gcc/ada/libgnat/a-ztdeau.adb
gcc/ada/libgnat/a-ztfiau.adb
gcc/ada/libgnat/a-ztfiio.adb
gcc/ada/libgnat/a-ztfiio__128.adb
gcc/ada/libgnat/a-ztflau.adb
gcc/ada/libgnat/a-ztflau.ads
gcc/ada/libgnat/a-ztflio.adb
gcc/ada/libgnat/a-ztgeau.adb
gcc/ada/libgnat/a-ztgeau.ads
gcc/ada/libgnat/s-fatgen.adb
gcc/ada/libgnat/s-valflt.ads [moved from gcc/ada/libgnat/s-fatsfl.ads with 76% similarity]
gcc/ada/libgnat/s-vallfl.ads [new file with mode: 0644]
gcc/ada/libgnat/s-valllf.ads [new file with mode: 0644]
gcc/ada/libgnat/s-valrea.adb
gcc/ada/libgnat/s-valrea.ads
gcc/ada/libgnat/s-valuer.adb
gcc/ada/rtsfind.ads