diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2018-09-26 09:17:31 +0000 |
---|---|---|
committer | Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> | 2018-09-26 09:17:31 +0000 |
commit | d58008d23d073916471ca95587b5fcd090675243 (patch) | |
tree | 98693b59c277e460cb5d6139ddef18edb966839f | |
parent | 52ba224d888aead9a9f00ce04b14200f2f4ef8a5 (diff) | |
download | gcc-d58008d23d073916471ca95587b5fcd090675243.zip gcc-d58008d23d073916471ca95587b5fcd090675243.tar.gz gcc-d58008d23d073916471ca95587b5fcd090675243.tar.bz2 |
[Ada] Preparation for new description of interface thunks
This adjusts and exposes a couple of functions of the front-end used for the
generation of interface thunks so as to make them callable from gigi. This
also propagates the debug info setting from the targets to the thunks so as
to make stepping into primitives work better in the debugger.
2018-09-26 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* exp_disp.adb (Expand_Interface_Conversion): Use Present test.
(Expand_Interface_Thunk): Propagate debug info setting from
target.
* exp_util.ads (Find_Interface_Tag): Adjust comment.
* exp_util.adb (Find_Interface_Tag): Remove assertions of
success.
* sem_util.adb (Is_Variable_Size_Record): Only look at
components and robustify the implementation.
* fe.h (Find_Interface_Tag): Declare.
(Is_Variable_Size_Record): Likewise.
From-SVN: r264614
-rw-r--r-- | gcc/ada/ChangeLog | 13 | ||||
-rw-r--r-- | gcc/ada/exp_disp.adb | 3 | ||||
-rw-r--r-- | gcc/ada/exp_util.adb | 3 | ||||
-rw-r--r-- | gcc/ada/exp_util.ads | 5 | ||||
-rw-r--r-- | gcc/ada/fe.h | 6 | ||||
-rw-r--r-- | gcc/ada/sem_util.adb | 6 |
6 files changed, 26 insertions, 10 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 94f90d3..08087d9 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,16 @@ +2018-09-26 Eric Botcazou <ebotcazou@adacore.com> + + * exp_disp.adb (Expand_Interface_Conversion): Use Present test. + (Expand_Interface_Thunk): Propagate debug info setting from + target. + * exp_util.ads (Find_Interface_Tag): Adjust comment. + * exp_util.adb (Find_Interface_Tag): Remove assertions of + success. + * sem_util.adb (Is_Variable_Size_Record): Only look at + components and robustify the implementation. + * fe.h (Find_Interface_Tag): Declare. + (Is_Variable_Size_Record): Likewise. + 2018-09-26 Thomas Quinot <quinot@adacore.com> * exp_util.adb (Make_CW_Equivalent_Type): Propagate bit order diff --git a/gcc/ada/exp_disp.adb b/gcc/ada/exp_disp.adb index 8270492..cf7ce49 100644 --- a/gcc/ada/exp_disp.adb +++ b/gcc/ada/exp_disp.adb @@ -1454,7 +1454,7 @@ package body Exp_Disp is end if; Iface_Tag := Find_Interface_Tag (Operand_Typ, Iface_Typ); - pragma Assert (Iface_Tag /= Empty); + pragma Assert (Present (Iface_Tag)); -- Keep separate access types to interfaces because one internal -- function is used to handle the null value (see following comments) @@ -2046,6 +2046,7 @@ package body Exp_Disp is Set_Ekind (Thunk_Id, Ekind (Prim)); Set_Is_Thunk (Thunk_Id); Set_Convention (Thunk_Id, Convention (Prim)); + Set_Needs_Debug_Info (Thunk_Id, Needs_Debug_Info (Target)); Set_Thunk_Entity (Thunk_Id, Target); -- Procedure case diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb index 31e36ee..183797c 100644 --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -5529,7 +5529,6 @@ package body Exp_Util is then -- Skip the tag associated with the primary table - pragma Assert (Etype (First_Tag_Component (Typ)) = RTE (RE_Tag)); AI_Tag := Next_Tag_Component (First_Tag_Component (Typ)); pragma Assert (Present (AI_Tag)); @@ -5590,14 +5589,12 @@ package body Exp_Util is -- primary dispatch table. if Is_Ancestor (Iface, Typ, Use_Full_View => True) then - pragma Assert (Etype (First_Tag_Component (Typ)) = RTE (RE_Tag)); return First_Tag_Component (Typ); -- Otherwise we need to search for its associated tag component else Find_Tag (Typ); - pragma Assert (Found); return AI_Tag; end if; end Find_Interface_Tag; diff --git a/gcc/ada/exp_util.ads b/gcc/ada/exp_util.ads index 708da20..b5e2a7b 100644 --- a/gcc/ada/exp_util.ads +++ b/gcc/ada/exp_util.ads @@ -585,8 +585,9 @@ package Exp_Util is function Find_Interface_Tag (T : Entity_Id; Iface : Entity_Id) return Entity_Id; - -- Ada 2005 (AI-251): Given a type T implementing the interface Iface, - -- return the record component containing the tag of Iface. + -- Ada 2005 (AI-251): Given a type T and an interface Iface, return the + -- record component containing the tag of Iface if T implements Iface or + -- Empty if it does not. function Find_Prim_Op (T : Entity_Id; Name : Name_Id) return Entity_Id; -- Find the first primitive operation of a tagged type T with name Name. diff --git a/gcc/ada/fe.h b/gcc/ada/fe.h index 2d07aa5..7c32044 100644 --- a/gcc/ada/fe.h +++ b/gcc/ada/fe.h @@ -159,8 +159,10 @@ extern void Get_External_Name (Entity_Id, Boolean, String_Pointer); /* exp_util: */ #define Is_Fully_Repped_Tagged_Type exp_util__is_fully_repped_tagged_type +#define Find_Interface_Tag exp_util__find_interface_tag extern Boolean Is_Fully_Repped_Tagged_Type (Entity_Id); +extern Entity_Id Find_Interface_Tag (Entity_Id, Entity_Id); /* lib: */ @@ -269,12 +271,14 @@ extern Boolean Is_OK_Static_Subtype (Entity_Id); #define Defining_Entity sem_util__defining_entity #define First_Actual sem_util__first_actual #define Next_Actual sem_util__next_actual +#define Is_Variable_Size_Record sem_util__is_variable_size_record #define Requires_Transient_Scope sem_util__requires_transient_scope extern Entity_Id Defining_Entity (Node_Id); extern Node_Id First_Actual (Node_Id); extern Node_Id Next_Actual (Node_Id); -extern Boolean Requires_Transient_Scope (Entity_Id); +extern Boolean Is_Variable_Size_Record (Entity_Id Id); +extern Boolean Requires_Transient_Scope (Entity_Id); /* sinfo: */ diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 2b31cf7..7235c96 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -17714,9 +17714,9 @@ package body Sem_Util is begin pragma Assert (Is_Record_Type (E)); - Comp := First_Entity (E); + Comp := First_Component (E); while Present (Comp) loop - Comp_Typ := Etype (Comp); + Comp_Typ := Underlying_Type (Etype (Comp)); -- Recursive call if the record type has discriminants @@ -17732,7 +17732,7 @@ package body Sem_Util is return True; end if; - Next_Entity (Comp); + Next_Component (Comp); end loop; return False; |