diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2013-04-24 16:18:30 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2013-04-24 16:18:30 +0200 |
commit | d436b30d99371fec40a60e617f86e3ede5701ac2 (patch) | |
tree | 5288e0f51c7951d5e5361fedd68284f13d64cc55 /gcc/ada/sem_util.adb | |
parent | 06b599fd62cccd693a395130dda53004f577714d (diff) | |
download | gcc-d436b30d99371fec40a60e617f86e3ede5701ac2.zip gcc-d436b30d99371fec40a60e617f86e3ede5701ac2.tar.gz gcc-d436b30d99371fec40a60e617f86e3ede5701ac2.tar.bz2 |
[multiple changes]
2013-04-24 Thomas Quinot <quinot@adacore.com>
* g-socket.adb (Host_Entry): Introduce intermediate copy of
memory location pointed to by Hostent_H_Addr, as it might not
have sufficient alignment.
2013-04-24 Yannick Moy <moy@adacore.com>
* repinfo.adb (List_Rep_Info): Set the value of Unit_Casing before
calling subprograms which may read it.
2013-04-24 Hristian Kirtchev <kirtchev@adacore.com>
* einfo.adb: Remove Loop_Entry_Attributes from the usage of
nodes. Flag 260 is now used.
(Has_Loop_Entry_Attributes): New routine.
(Loop_Entry_Attributes): Removed.
(Set_Has_Loop_Entry_Attributes): New routine.
(Set_Loop_Entry_Attributes): Removed.
(Write_Entity_Flags): Write out Flag 260.
(Write_Field10_Name): Remove the output for Loop_Entry_Attributes.
* einfo.ads: Remove attribute Loop_Entry_Attributes,
its related comment and uses in nodes. Add new attribute
Has_Loop_Entry_Attributes, related comment and uses in loop nodes.
(Has_Loop_Entry_Attributes): New routine and pragma Inline.
(Loop_Entry_Attributes): Removed along with pragma Inline.
(Set_Has_Loop_Entry_Attributes): New routine and pragma Inline.
(Set_Loop_Entry_Attributes): Removed along with pragma Inline.
* exp_attr.adb (Expand_Loop_Entry_Attribute): New routine.
(Expand_N_Attribute_Reference): Expand attribute 'Loop_Entry.
* exp_ch5.adb: Remove with and use clause for Elists.
(Expand_Loop_Entry_Attributes): Removed.
(Expand_N_Loop_Statement): Add local variable Stmt. Rename local
constant Isc to Scheme. When a loop is subject to attribute
'Loop_Entry, retrieve the nested loop from the conditional
block. Move the processing of controlled object at the end of
loop expansion.
* sem_attr.adb (Analyze_Attribute): Do not chain attribute
'Loop_Entry to its related loop.
* sem_ch5.adb (Analyze_Loop_Statement): Add local variable
Stmt. When the iteration scheme mentions attribute 'Loop_Entry,
the entire loop is rewritten into a block. Retrieve the nested
loop in such cases to complete the analysis.
* sem_util.ads, sem_util.adb (Find_Loop_In_Conditional_Block): New
routine.
(Subject_To_Loop_Entry_Attributes): New routine.
2013-04-24 Robert Dewar <dewar@adacore.com>
* exp_prag.adb (Expand_Loop_Variant): Generate pragma Check
(Loop_Variant, xxx) rather than Assert (xxx).
* gnat_rm.texi: Document pragma Loop_Variant.
* sem_prag.adb (Analyze_Pragma, case Loop_Variant): Remove call
to S14_Pragma.
From-SVN: r198235
Diffstat (limited to 'gcc/ada/sem_util.adb')
-rw-r--r-- | gcc/ada/sem_util.adb | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index aca6ac2..5cf86f9 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -4740,6 +4740,41 @@ package body Sem_Util is raise Program_Error; end Find_Corresponding_Discriminant; + ------------------------------------ + -- Find_Loop_In_Conditional_Block -- + ------------------------------------ + + function Find_Loop_In_Conditional_Block (N : Node_Id) return Node_Id is + Stmt : Node_Id; + + begin + Stmt := N; + + if Nkind (Stmt) = N_If_Statement then + Stmt := First (Then_Statements (Stmt)); + end if; + + pragma Assert (Nkind (Stmt) = N_Block_Statement); + + -- Inspect the statements of the conditional block. In general the loop + -- should be the first statement in the statement sequence of the block, + -- but the finalization machinery may have introduced extra object + -- declarations. + + Stmt := First (Statements (Handled_Statement_Sequence (Stmt))); + while Present (Stmt) loop + if Nkind (Stmt) = N_Loop_Statement then + return Stmt; + end if; + + Next (Stmt); + end loop; + + -- The expansion of attribute 'Loop_Entry produced a malformed block + + raise Program_Error; + end Find_Loop_In_Conditional_Block; + -------------------------- -- Find_Overlaid_Entity -- -------------------------- @@ -13870,6 +13905,33 @@ package body Sem_Util is and then not Is_Formal (Entity (R2)); end Statically_Different; + -------------------------------------- + -- Subject_To_Loop_Entry_Attributes -- + -------------------------------------- + + function Subject_To_Loop_Entry_Attributes (N : Node_Id) return Boolean is + Stmt : Node_Id; + + begin + Stmt := N; + + -- The expansion mechanism transform a loop subject to at least one + -- 'Loop_Entry attribute into a conditional block. Infinite loops lack + -- the conditional part. + + if Nkind_In (Stmt, N_Block_Statement, N_If_Statement) + and then Nkind (Original_Node (N)) = N_Loop_Statement + then + Stmt := Original_Node (N); + end if; + + return + Nkind (Stmt) = N_Loop_Statement + and then Present (Identifier (Stmt)) + and then Present (Entity (Identifier (Stmt))) + and then Has_Loop_Entry_Attributes (Entity (Identifier (Stmt))); + end Subject_To_Loop_Entry_Attributes; + ----------------------------- -- Subprogram_Access_Level -- ----------------------------- |