[Ada] Add Max_Integer_Size attribute and couple of helper functions
authorEric Botcazou <ebotcazou@adacore.com>
Tue, 23 Jun 2020 10:49:04 +0000 (12:49 +0200)
committerPierre-Marie de Rodat <derodat@adacore.com>
Fri, 16 Oct 2020 07:31:15 +0000 (03:31 -0400)
commitc7c7dd3a1ded3f8bcdbfb352277246a521108710
tree3cee854425c54f59389e7c436adcdaad865cfe96
parent429ad0bb0d3dc77e44f95620341da4938d49168e
[Ada] Add Max_Integer_Size attribute and couple of helper functions

gcc/ada/

* doc/gnat_rm/implementation_defined_attributes.rst: Document the
new Max_Integer_Size attribute.
* gnat_rm.texi: Regenerate.
* exp_attr.adb (Get_Integer_Type): Call Small_Integer_Type_For.
(Expand_N_Attribute_Reference) <Attribute_Pred>: Replace selection
code with call to Integer_Type_For.
<Attribute_Succ>: Likewise.
<Attribute_Val>: Likewise.
<Attribute_Valid>: Likewise.
<Attribute_Max_Integer_Size>: Raise Program_Error.
* exp_ch3.adb (Expand_Freeze_Enumeration_Type): Replace selection
code with call to Integer_Type_For.
(Simple_Init_Initialize_Scalars_Type): Use Long_Long_Unsigned and
System_Max_Integer_Size to size the largest integer type.
* exp_pakd.adb (Compute_Linear_Subscript): Minor tweak.
(Create_Packed_Array_Impl_Type): Use Small_Integer_Type_For.
* exp_util.ads (Integer_Type_For): New function.
(Small_Integer_Type_For): Likewise.
* exp_util.adb (Adjust_Condition): Use Integer_Type_For.
(Component_May_Be_Bit_Aligned): Use System_Max_Integer_Size.
(Integer_Type_For): New function.
(Small_Integer_Type_For): Likewise.
(Matching_Standard_Type): Use Small_Integer_Type_For.
(Needs_Constant_Address): Replace 64 with System_Max_Integer_Size.
* freeze.adb (Set_Small_Size): Likewise.
(Size_Known): Likewise.
(Check_Suspicious_Modulus): Likewise.
(Check_Large_Modular_Array): Likewise.
(Freeze_Entity): Likewise.
* layout.adb (Layout_Type): Likewise.
* sem_aggr.adb: Add with and use clauses for Ttypes.
(Resolve_Aggregate): Replace 64 with System_Max_Integer_Size.
* sem_attr.ads (Attribute_Impl_Def): Add Attribute_Max_Integer_Size.
* sem_attr.adb (Analyze_Attribute) <Attribute_Max_Integer_Size>: New
(Eval_Attribute): Likewise.
* sem_ch13.adb (Adjust_Record_For_Reverse_Bit_Order): Change max
scalar size to System_Max_Integer_Size.
(Check_Array_Type): Replace 64 with System_Max_Integer_Size and
remove superfluous test.
(OK_Component): Likewise.
* sem_ch5.adb: Add with and use clauses for Ttypes.
(Analyze_Assignment): Replace 64 with System_Max_Integer_Size.
* snames.ads-tmpl (Name_Max_Integer_Size): New attribute name.
(Attribute_Id): Add Attribute_Max_Integer_Size.
* ttypes.ads (System_Max_Integer_Size): New constant.
16 files changed:
gcc/ada/doc/gnat_rm/implementation_defined_attributes.rst
gcc/ada/exp_attr.adb
gcc/ada/exp_ch3.adb
gcc/ada/exp_pakd.adb
gcc/ada/exp_util.adb
gcc/ada/exp_util.ads
gcc/ada/freeze.adb
gcc/ada/gnat_rm.texi
gcc/ada/layout.adb
gcc/ada/sem_aggr.adb
gcc/ada/sem_attr.adb
gcc/ada/sem_attr.ads
gcc/ada/sem_ch13.adb
gcc/ada/sem_ch5.adb
gcc/ada/snames.ads-tmpl
gcc/ada/ttypes.ads