From: Eric Botcazou <ebotca...@adacore.com> It breaks the Allow_Integer_Address special mode.
Add new standard_address parameters to gigi and alphabetize others, this is necessary when addresses are not treated like integers. gcc/ada/ * back_end.adb (Call_Back_End): Add gigi_standard_address to the signature of the gigi procedure and alphabetize other parameters. Pass Standard_Address as actual parameter for it. * cstand.adb (Create_Standard): Do not set Is_Descendant_Of_Address on Standard_Address. * gcc-interface/gigi.h (gigi): Add a standard_address parameter and alphabetize others. * gcc-interface/trans.cc (gigi): Likewise. Record a builtin address type and save it as the type for Standard.Address. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/back_end.adb | 10 ++++++---- gcc/ada/cstand.adb | 2 -- gcc/ada/gcc-interface/gigi.h | 5 +++-- gcc/ada/gcc-interface/trans.cc | 16 +++++++++++----- 4 files changed, 20 insertions(+), 13 deletions(-) diff --git a/gcc/ada/back_end.adb b/gcc/ada/back_end.adb index 23f5abe955e..bc370e9e9c7 100644 --- a/gcc/ada/back_end.adb +++ b/gcc/ada/back_end.adb @@ -103,11 +103,12 @@ package body Back_End is number_file : Nat; file_info_ptr : Address; + gigi_standard_address : Entity_Id; gigi_standard_boolean : Entity_Id; - gigi_standard_integer : Entity_Id; gigi_standard_character : Entity_Id; - gigi_standard_long_long_float : Entity_Id; gigi_standard_exception_type : Entity_Id; + gigi_standard_integer : Entity_Id; + gigi_standard_long_long_float : Entity_Id; gigi_operating_mode : Back_End_Mode_Type); pragma Import (C, gigi); @@ -171,11 +172,12 @@ package body Back_End is number_file => Num_Source_Files, file_info_ptr => File_Info_Array'Address, + gigi_standard_address => Standard_Address, gigi_standard_boolean => Standard_Boolean, - gigi_standard_integer => Standard_Integer, gigi_standard_character => Standard_Character, - gigi_standard_long_long_float => Standard_Long_Long_Float, gigi_standard_exception_type => Standard_Exception_Type, + gigi_standard_integer => Standard_Integer, + gigi_standard_long_long_float => Standard_Long_Long_Float, gigi_operating_mode => Mode); end Call_Back_End; diff --git a/gcc/ada/cstand.adb b/gcc/ada/cstand.adb index d4a420deda9..fbd5888b198 100644 --- a/gcc/ada/cstand.adb +++ b/gcc/ada/cstand.adb @@ -1370,11 +1370,9 @@ package body CStand is -- Standard_Address is not user visible, but is used internally. It is -- an unsigned type mod 2**System_Address_Size with System.Address size. - -- We flag it as Is_Descendant_Of_Address for code generation purposes. Standard_Address := New_Standard_Entity ("standard_address"); Build_Unsigned_Integer_Type (Standard_Address, System_Address_Size); - Set_Is_Descendant_Of_Address (Standard_Address); -- Note: universal integer and universal real are constructed as fully -- formed signed numeric types, with parameters corresponding to the diff --git a/gcc/ada/gcc-interface/gigi.h b/gcc/ada/gcc-interface/gigi.h index fee0450a338..ec85ce44bc3 100644 --- a/gcc/ada/gcc-interface/gigi.h +++ b/gcc/ada/gcc-interface/gigi.h @@ -245,11 +245,12 @@ extern void gigi (Node_Id gnat_root, struct List_Header *list_headers_ptr, Nat number_file, struct File_Info_Type *file_info_ptr, + Entity_Id standard_address, Entity_Id standard_boolean, - Entity_Id standard_integer, Entity_Id standard_character, - Entity_Id standard_long_long_float, Entity_Id standard_exception_type, + Entity_Id standard_integer, + Entity_Id standard_long_long_float, Int gigi_operating_mode); #ifdef __cplusplus diff --git a/gcc/ada/gcc-interface/trans.cc b/gcc/ada/gcc-interface/trans.cc index c26f1b6e1ac..13f438c424b 100644 --- a/gcc/ada/gcc-interface/trans.cc +++ b/gcc/ada/gcc-interface/trans.cc @@ -290,11 +290,12 @@ gigi (Node_Id gnat_root, struct List_Header *list_headers_ptr, Nat number_file, struct File_Info_Type *file_info_ptr, + Entity_Id standard_address, Entity_Id standard_boolean, - Entity_Id standard_integer, Entity_Id standard_character, - Entity_Id standard_long_long_float, Entity_Id standard_exception_type, + Entity_Id standard_integer, + Entity_Id standard_long_long_float, Int gigi_operating_mode) { Node_Id gnat_iter; @@ -375,14 +376,19 @@ gigi (Node_Id gnat_root, double_float_alignment = get_target_double_float_alignment (); double_scalar_alignment = get_target_double_scalar_alignment (); - /* Record the builtin types. Define `integer' and `character' first so that - dbx will output them first. */ + /* Record the builtin types. */ + record_builtin_type ("address", pointer_sized_int_node, false); record_builtin_type ("integer", integer_type_node, false); record_builtin_type ("character", char_type_node, false); record_builtin_type ("boolean", boolean_type_node, false); record_builtin_type ("void", void_type_node, false); - /* Save the type we made for integer as the type for Standard.Integer. */ + /* Save the type we made for address as the type for Standard.Address. */ + save_gnu_tree (Base_Type (standard_address), + TYPE_NAME (pointer_sized_int_node), + false); + + /* Likewise for integer as the type for Standard.Integer. */ save_gnu_tree (Base_Type (standard_integer), TYPE_NAME (integer_type_node), false); -- 2.40.0