diff options
author | Giuliano Belinassi <giuliano.belinassi@usp.br> | 2020-08-22 17:43:43 -0300 |
---|---|---|
committer | Giuliano Belinassi <giuliano.belinassi@usp.br> | 2020-08-22 17:43:43 -0300 |
commit | a926878ddbd5a98b272c22171ce58663fc04c3e0 (patch) | |
tree | 86af256e5d9a9c06263c00adc90e5fe348008c43 /gcc/ada/aspects.adb | |
parent | 542730f087133690b47e036dfd43eb0db8a650ce (diff) | |
parent | 07cbaed8ba7d1b6e4ab3a9f44175502a4e1ecdb1 (diff) | |
download | gcc-devel/autopar_devel.zip gcc-devel/autopar_devel.tar.gz gcc-devel/autopar_devel.tar.bz2 |
Merge branch 'autopar_rebase2' into autopar_develdevel/autopar_devel
Quickly commit changes in the rebase branch.
Diffstat (limited to 'gcc/ada/aspects.adb')
-rw-r--r-- | gcc/ada/aspects.adb | 234 |
1 files changed, 36 insertions, 198 deletions
diff --git a/gcc/ada/aspects.adb b/gcc/ada/aspects.adb index 3b8b7c4..c222c33 100644 --- a/gcc/ada/aspects.adb +++ b/gcc/ada/aspects.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2010-2019, Free Software Foundation, Inc. -- +-- Copyright (C) 2010-2020, 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- -- @@ -33,7 +33,6 @@ with Atree; use Atree; with Einfo; use Einfo; with Nlists; use Nlists; with Sinfo; use Sinfo; -with Tree_IO; use Tree_IO; with GNAT.HTable; @@ -70,16 +69,6 @@ package body Aspects is Aspect_Variable_Indexing => True, others => False); - procedure Set_Aspect_Specifications_No_Check (N : Node_Id; L : List_Id); - -- Same as Set_Aspect_Specifications, but does not contain the assertion - -- that checks that N does not already have aspect specifications. This - -- subprogram is supposed to be used as a part of Tree_Read. When reading - -- tree, first read nodes with their basic properties (as Atree.Tree_Read), - -- this includes reading the Has_Aspects flag for each node, then we reed - -- all the list tables and only after that we call Tree_Read for Aspects. - -- That is, when reading the tree, the list of aspects is attached to the - -- node that already has Has_Aspects flag set ON. - ------------------------------------------ -- Hash Table for Aspect Specifications -- ------------------------------------------ @@ -153,12 +142,9 @@ package body Aspects is -- The routine should be invoked on a body [stub] with aspects pragma Assert (Has_Aspects (N)); - pragma Assert (Nkind (N) in N_Body_Stub - or else Nkind_In (N, N_Entry_Body, - N_Package_Body, - N_Protected_Body, - N_Subprogram_Body, - N_Task_Body)); + pragma Assert + (Nkind (N) in N_Body_Stub | N_Entry_Body | N_Package_Body | + N_Protected_Body | N_Subprogram_Body | N_Task_Body); -- Look through all aspects and see whether they can be applied to a -- body [stub]. @@ -412,9 +398,8 @@ package body Aspects is -- Note: It is better to use Is_Single_Concurrent_Type_Declaration -- here, but Aspects and Sem_Util have incompatible licenses. - elsif Nkind_In - (Original_Node (From), N_Single_Protected_Declaration, - N_Single_Task_Declaration) + elsif Nkind (Original_Node (From)) in + N_Single_Protected_Declaration | N_Single_Task_Declaration then Asp_Id := Get_Aspect_Id (Asp); @@ -511,136 +496,36 @@ package body Aspects is -- Table used for Same_Aspect, maps aspect to canonical aspect - Canonical_Aspect : constant array (Aspect_Id) of Aspect_Id := - (No_Aspect => No_Aspect, - Aspect_Abstract_State => Aspect_Abstract_State, - Aspect_Address => Aspect_Address, - Aspect_Alignment => Aspect_Alignment, - Aspect_All_Calls_Remote => Aspect_All_Calls_Remote, - Aspect_Annotate => Aspect_Annotate, - Aspect_Async_Readers => Aspect_Async_Readers, - Aspect_Async_Writers => Aspect_Async_Writers, - Aspect_Asynchronous => Aspect_Asynchronous, - Aspect_Atomic => Aspect_Atomic, - Aspect_Atomic_Components => Aspect_Atomic_Components, - Aspect_Attach_Handler => Aspect_Attach_Handler, - Aspect_Bit_Order => Aspect_Bit_Order, - Aspect_Component_Size => Aspect_Component_Size, - Aspect_Constant_After_Elaboration => Aspect_Constant_After_Elaboration, - Aspect_Constant_Indexing => Aspect_Constant_Indexing, - Aspect_Contract_Cases => Aspect_Contract_Cases, - Aspect_Convention => Aspect_Convention, - Aspect_CPU => Aspect_CPU, - Aspect_Default_Component_Value => Aspect_Default_Component_Value, - Aspect_Default_Initial_Condition => Aspect_Default_Initial_Condition, - Aspect_Default_Iterator => Aspect_Default_Iterator, - Aspect_Default_Storage_Pool => Aspect_Default_Storage_Pool, - Aspect_Default_Value => Aspect_Default_Value, - Aspect_Depends => Aspect_Depends, - Aspect_Dimension => Aspect_Dimension, - Aspect_Dimension_System => Aspect_Dimension_System, - Aspect_Disable_Controlled => Aspect_Disable_Controlled, - Aspect_Discard_Names => Aspect_Discard_Names, - Aspect_Dispatching_Domain => Aspect_Dispatching_Domain, - Aspect_Dynamic_Predicate => Aspect_Predicate, - Aspect_Effective_Reads => Aspect_Effective_Reads, - Aspect_Effective_Writes => Aspect_Effective_Writes, - Aspect_Elaborate_Body => Aspect_Elaborate_Body, - Aspect_Export => Aspect_Export, - Aspect_Extensions_Visible => Aspect_Extensions_Visible, - Aspect_External_Name => Aspect_External_Name, - Aspect_External_Tag => Aspect_External_Tag, - Aspect_Favor_Top_Level => Aspect_Favor_Top_Level, - Aspect_Ghost => Aspect_Ghost, - Aspect_Global => Aspect_Global, - Aspect_Implicit_Dereference => Aspect_Implicit_Dereference, - Aspect_Import => Aspect_Import, - Aspect_Independent => Aspect_Independent, - Aspect_Independent_Components => Aspect_Independent_Components, - Aspect_Inline => Aspect_Inline, - Aspect_Inline_Always => Aspect_Inline, - Aspect_Initial_Condition => Aspect_Initial_Condition, - Aspect_Initializes => Aspect_Initializes, - Aspect_Input => Aspect_Input, - Aspect_Interrupt_Handler => Aspect_Interrupt_Handler, - Aspect_Interrupt_Priority => Aspect_Priority, - Aspect_Invariant => Aspect_Invariant, - Aspect_Iterable => Aspect_Iterable, - Aspect_Iterator_Element => Aspect_Iterator_Element, - Aspect_Link_Name => Aspect_Link_Name, - Aspect_Linker_Section => Aspect_Linker_Section, - Aspect_Lock_Free => Aspect_Lock_Free, - Aspect_Machine_Radix => Aspect_Machine_Radix, - Aspect_Max_Entry_Queue_Depth => Aspect_Max_Entry_Queue_Depth, - Aspect_Max_Entry_Queue_Length => Aspect_Max_Entry_Queue_Length, - Aspect_Max_Queue_Length => Aspect_Max_Queue_Length, - Aspect_No_Caching => Aspect_No_Caching, - Aspect_No_Elaboration_Code_All => Aspect_No_Elaboration_Code_All, - Aspect_No_Inline => Aspect_No_Inline, - Aspect_No_Return => Aspect_No_Return, - Aspect_No_Tagged_Streams => Aspect_No_Tagged_Streams, - Aspect_Obsolescent => Aspect_Obsolescent, - Aspect_Object_Size => Aspect_Object_Size, - Aspect_Output => Aspect_Output, - Aspect_Pack => Aspect_Pack, - Aspect_Part_Of => Aspect_Part_Of, - Aspect_Persistent_BSS => Aspect_Persistent_BSS, - Aspect_Post => Aspect_Post, - Aspect_Postcondition => Aspect_Post, - Aspect_Pre => Aspect_Pre, - Aspect_Precondition => Aspect_Pre, - Aspect_Predicate => Aspect_Predicate, - Aspect_Predicate_Failure => Aspect_Predicate_Failure, - Aspect_Preelaborate => Aspect_Preelaborate, - Aspect_Preelaborable_Initialization => Aspect_Preelaborable_Initialization, - Aspect_Priority => Aspect_Priority, - Aspect_Pure => Aspect_Pure, - Aspect_Pure_Function => Aspect_Pure_Function, - Aspect_Refined_Depends => Aspect_Refined_Depends, - Aspect_Refined_Global => Aspect_Refined_Global, - Aspect_Refined_Post => Aspect_Refined_Post, - Aspect_Refined_State => Aspect_Refined_State, - Aspect_Remote_Access_Type => Aspect_Remote_Access_Type, - Aspect_Remote_Call_Interface => Aspect_Remote_Call_Interface, - Aspect_Remote_Types => Aspect_Remote_Types, - Aspect_Read => Aspect_Read, - Aspect_Relative_Deadline => Aspect_Relative_Deadline, - Aspect_Scalar_Storage_Order => Aspect_Scalar_Storage_Order, - Aspect_Secondary_Stack_Size => Aspect_Secondary_Stack_Size, - Aspect_Shared => Aspect_Atomic, - Aspect_Shared_Passive => Aspect_Shared_Passive, - Aspect_Simple_Storage_Pool => Aspect_Simple_Storage_Pool, - Aspect_Simple_Storage_Pool_Type => Aspect_Simple_Storage_Pool_Type, - Aspect_Size => Aspect_Size, - Aspect_Small => Aspect_Small, - Aspect_SPARK_Mode => Aspect_SPARK_Mode, - Aspect_Static_Predicate => Aspect_Predicate, - Aspect_Storage_Pool => Aspect_Storage_Pool, - Aspect_Storage_Size => Aspect_Storage_Size, - Aspect_Stream_Size => Aspect_Stream_Size, - Aspect_Suppress => Aspect_Suppress, - Aspect_Suppress_Debug_Info => Aspect_Suppress_Debug_Info, - Aspect_Suppress_Initialization => Aspect_Suppress_Initialization, - Aspect_Synchronization => Aspect_Synchronization, - Aspect_Test_Case => Aspect_Test_Case, - Aspect_Thread_Local_Storage => Aspect_Thread_Local_Storage, - Aspect_Type_Invariant => Aspect_Invariant, - Aspect_Unchecked_Union => Aspect_Unchecked_Union, - Aspect_Unimplemented => Aspect_Unimplemented, - Aspect_Universal_Aliasing => Aspect_Universal_Aliasing, - Aspect_Universal_Data => Aspect_Universal_Data, - Aspect_Unmodified => Aspect_Unmodified, - Aspect_Unreferenced => Aspect_Unreferenced, - Aspect_Unreferenced_Objects => Aspect_Unreferenced_Objects, - Aspect_Unsuppress => Aspect_Unsuppress, - Aspect_Variable_Indexing => Aspect_Variable_Indexing, - Aspect_Value_Size => Aspect_Value_Size, - Aspect_Volatile => Aspect_Volatile, - Aspect_Volatile_Components => Aspect_Volatile_Components, - Aspect_Volatile_Full_Access => Aspect_Volatile_Full_Access, - Aspect_Volatile_Function => Aspect_Volatile_Function, - Aspect_Warnings => Aspect_Warnings, - Aspect_Write => Aspect_Write); + type Aspect_To_Aspect_Mapping is array (Aspect_Id) of Aspect_Id; + + function Init_Canonical_Aspect return Aspect_To_Aspect_Mapping; + -- Initialize the Canonical_Aspect mapping below + + function Init_Canonical_Aspect return Aspect_To_Aspect_Mapping is + Result : Aspect_To_Aspect_Mapping; + begin + -- They all map to themselves... + + for Aspect in Aspect_Id loop + Result (Aspect) := Aspect; + end loop; + + -- ...except for these: + + Result (Aspect_Dynamic_Predicate) := Aspect_Predicate; + Result (Aspect_Inline_Always) := Aspect_Inline; + Result (Aspect_Interrupt_Priority) := Aspect_Priority; + Result (Aspect_Postcondition) := Aspect_Post; + Result (Aspect_Precondition) := Aspect_Pre; + Result (Aspect_Shared) := Aspect_Atomic; + Result (Aspect_Static_Predicate) := Aspect_Predicate; + Result (Aspect_Type_Invariant) := Aspect_Invariant; + + return Result; + end Init_Canonical_Aspect; + + Canonical_Aspect : constant Aspect_To_Aspect_Mapping := + Init_Canonical_Aspect; function Same_Aspect (A1 : Aspect_Id; A2 : Aspect_Id) return Boolean is begin @@ -662,53 +547,6 @@ package body Aspects is Aspect_Specifications_Hash_Table.Set (N, L); end Set_Aspect_Specifications; - ---------------------------------------- - -- Set_Aspect_Specifications_No_Check -- - ---------------------------------------- - - procedure Set_Aspect_Specifications_No_Check (N : Node_Id; L : List_Id) is - begin - pragma Assert (Permits_Aspect_Specifications (N)); - pragma Assert (L /= No_List); - - Set_Has_Aspects (N); - Set_Parent (L, N); - Aspect_Specifications_Hash_Table.Set (N, L); - end Set_Aspect_Specifications_No_Check; - - --------------- - -- Tree_Read -- - --------------- - - procedure Tree_Read is - Node : Node_Id; - List : List_Id; - begin - loop - Tree_Read_Int (Int (Node)); - Tree_Read_Int (Int (List)); - exit when List = No_List; - Set_Aspect_Specifications_No_Check (Node, List); - end loop; - end Tree_Read; - - ---------------- - -- Tree_Write -- - ---------------- - - procedure Tree_Write is - Node : Node_Id := Empty; - List : List_Id; - begin - Aspect_Specifications_Hash_Table.Get_First (Node, List); - loop - Tree_Write_Int (Int (Node)); - Tree_Write_Int (Int (List)); - exit when List = No_List; - Aspect_Specifications_Hash_Table.Get_Next (Node, List); - end loop; - end Tree_Write; - -- Package initialization sets up Aspect Id hash table begin |