From: Ed Schonberg Date: Tue, 22 May 2018 13:25:22 +0000 (+0000) Subject: [Ada] Ada2020: Reduction expressions X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=801b4022e11b50c4124b489ccc621332b2d92946;p=gcc.git [Ada] Ada2020: Reduction expressions This patch dismantles the prototype implementation of the first proposal for Reduction expressions, one of the important potentially parallel constructs for Ada2020. The ARG is going in a different direction with a simpler syntax. 2018-05-22 Ed Schonberg gcc/ada/ * exp_ch4.ads, exp_ch4.adb, exp_util.adb, expander.adb: Remove mention of N_Reduction_Expression and N_Reduction_Expression_Parameter. * par-ch4.adb: Remove parsing routines for reduction expressions. * sem.adb, sinfo.ads, sinfo.adb, sem_ch4.ads, sem_ch4.adb, sem_res.adb, sem_spark.adb, sprint.adb: Remove analysis routines for reduction expressions. From-SVN: r260524 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index bfbb5625045..aa3a1c034b7 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,12 @@ +2018-05-22 Ed Schonberg + + * exp_ch4.ads, exp_ch4.adb, exp_util.adb, expander.adb: Remove mention + of N_Reduction_Expression and N_Reduction_Expression_Parameter. + * par-ch4.adb: Remove parsing routines for reduction expressions. + * sem.adb, sinfo.ads, sinfo.adb, sem_ch4.ads, sem_ch4.adb, sem_res.adb, + sem_spark.adb, sprint.adb: Remove analysis routines for reduction + expressions. + 2018-05-22 Arnaud Charlet * sem_ch8.adb (Check_Frozen_Renaming): Do not emit error in diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb index 33d364b743f..b903719bcdd 100644 --- a/gcc/ada/exp_ch4.adb +++ b/gcc/ada/exp_ch4.adb @@ -10077,77 +10077,6 @@ package body Exp_Ch4 is Analyze_And_Resolve (N, Standard_Boolean); end Expand_N_Quantified_Expression; - ----------------------------------- - -- Expand_N_Reduction_Expression -- - ----------------------------------- - - procedure Expand_N_Reduction_Expression (N : Node_Id) is - Actions : constant List_Id := New_List; - Expr : constant Node_Id := Expression (N); - Iter_Spec : constant Node_Id := Iterator_Specification (N); - Loc : constant Source_Ptr := Sloc (N); - Loop_Spec : constant Node_Id := Loop_Parameter_Specification (N); - Typ : constant Entity_Id := Etype (N); - - Actual : Node_Id; - New_Call : Node_Id; - Reduction_Par : Node_Id; - Result : Entity_Id; - Scheme : Node_Id; - - begin - Result := Make_Temporary (Loc, 'R', N); - New_Call := New_Copy_Tree (Expr); - - if Nkind (New_Call) = N_Function_Call then - Actual := First (Parameter_Associations (New_Call)); - - if Nkind (Actual) /= N_Reduction_Expression_Parameter then - Actual := Next_Actual (Actual); - end if; - - elsif Nkind (New_Call) in N_Binary_Op then - Actual := Left_Opnd (New_Call); - - if Nkind (Actual) /= N_Reduction_Expression_Parameter then - Actual := Right_Opnd (New_Call); - end if; - end if; - - Reduction_Par := Expression (Actual); - - Append_To (Actions, - Make_Object_Declaration (Loc, - Defining_Identifier => Result, - Object_Definition => New_Occurrence_Of (Typ, Loc), - Expression => New_Copy_Tree (Reduction_Par))); - - if Present (Iter_Spec) then - Scheme := - Make_Iteration_Scheme (Loc, - Iterator_Specification => Iter_Spec); - else - Scheme := - Make_Iteration_Scheme (Loc, - Loop_Parameter_Specification => Loop_Spec); - end if; - - Replace (Actual, New_Occurrence_Of (Result, Loc)); - - Append_To (Actions, - Make_Loop_Statement (Loc, - Iteration_Scheme => Scheme, - Statements => New_List (Make_Assignment_Statement (Loc, - New_Occurrence_Of (Result, Loc), New_Call)), - End_Label => Empty)); - - Rewrite (N, - Make_Expression_With_Actions (Loc, - Expression => New_Occurrence_Of (Result, Loc), - Actions => Actions)); - Analyze_And_Resolve (N, Typ); - end Expand_N_Reduction_Expression; - --------------------------------- -- Expand_N_Selected_Component -- --------------------------------- diff --git a/gcc/ada/exp_ch4.ads b/gcc/ada/exp_ch4.ads index e6560e24909..0f2ec85cc52 100644 --- a/gcc/ada/exp_ch4.ads +++ b/gcc/ada/exp_ch4.ads @@ -68,7 +68,6 @@ package Exp_Ch4 is procedure Expand_N_Or_Else (N : Node_Id); procedure Expand_N_Qualified_Expression (N : Node_Id); procedure Expand_N_Quantified_Expression (N : Node_Id); - procedure Expand_N_Reduction_Expression (N : Node_Id); procedure Expand_N_Selected_Component (N : Node_Id); procedure Expand_N_Slice (N : Node_Id); procedure Expand_N_Type_Conversion (N : Node_Id); diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb index 64dcb1161b6..610ba9a517a 100644 --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -7349,8 +7349,6 @@ package body Exp_Util is | N_Real_Literal | N_Real_Range_Specification | N_Record_Definition - | N_Reduction_Expression - | N_Reduction_Expression_Parameter | N_Reference | N_SCIL_Dispatch_Table_Tag_Init | N_SCIL_Dispatching_Call diff --git a/gcc/ada/expander.adb b/gcc/ada/expander.adb index 604d6a64014..e26daf5b616 100644 --- a/gcc/ada/expander.adb +++ b/gcc/ada/expander.adb @@ -435,9 +435,6 @@ package body Expander is when N_Record_Representation_Clause => Expand_N_Record_Representation_Clause (N); - when N_Reduction_Expression => - Expand_N_Reduction_Expression (N); - when N_Requeue_Statement => Expand_N_Requeue_Statement (N); diff --git a/gcc/ada/par-ch4.adb b/gcc/ada/par-ch4.adb index faa45e8cc45..d0b46740ada 100644 --- a/gcc/ada/par-ch4.adb +++ b/gcc/ada/par-ch4.adb @@ -75,8 +75,7 @@ package body Ch4 is function P_Aggregate_Or_Paren_Expr return Node_Id; function P_Allocator return Node_Id; function P_Case_Expression_Alternative return Node_Id; - function P_Iterated_Component_Assoc_Or_Reduction return Node_Id; - function P_Reduction_Expression (Lparen : Boolean) return Node_Id; + function P_Iterated_Component_Association return Node_Id; function P_Record_Or_Array_Component_Association return Node_Id; function P_Factor return Node_Id; function P_Primary return Node_Id; @@ -645,9 +644,6 @@ package body Ch4 is -- case of a name which can be extended in the normal manner. -- This case is handled by LP_State_Name or LP_State_Expr. - -- (Ada 2020): the expression can be a reduction_expression_ - -- parameter, i.e. a box or < Simple_Expression >. - -- Note: if and case expressions (without an extra level of -- parentheses) are permitted in this context). @@ -656,10 +652,6 @@ package body Ch4 is -- If there is at least one occurrence of identifier => (but -- none of the other cases apply), then we have a call. - -- < simple_expression > - -- In Ada 2020 this is a reduction expression parameter that - -- specifies the initial value of the reduction. - -- Test for Id => case if Token = Tok_Identifier then @@ -678,27 +670,9 @@ package body Ch4 is end if; end if; - -- Here we have an expression after all, which may be a reduction - -- expression with a binary operator. + -- Here we have an expression after all - if Token = Tok_Less then - Scan; -- past < - - Expr_Node := - New_Node (N_Reduction_Expression_Parameter, Token_Ptr); - Set_Expression (Expr_Node, P_Simple_Expression); - - if Token = Tok_Greater then - Scan; - else - Error_Msg_N - ("malformed reduction expression parameter", Expr_Node); - raise Error_Resync; - end if; - - else - Expr_Node := P_Expression_Or_Range_Attribute_If_OK; - end if; + Expr_Node := P_Expression_Or_Range_Attribute_If_OK; -- Check cases of discrete range for a slice @@ -1425,13 +1399,8 @@ package body Ch4 is elsif Token = Tok_For then Aggregate_Node := New_Node (N_Aggregate, Lparen_Sloc); - Expr_Node := P_Iterated_Component_Assoc_Or_Reduction; - - if Nkind (Expr_Node) = N_Reduction_Expression then - return Expr_Node; - else - goto Aggregate; - end if; + Expr_Node := P_Iterated_Component_Association; + goto Aggregate; end if; -- Scan expression, handling box appearing as positional argument @@ -1463,14 +1432,6 @@ package body Ch4 is Set_Expression (Aggregate_Node, Expr_Node); Expr_Node := Empty; - if Nkind (Aggregate_Node) = N_Delta_Aggregate - and then (Token = Tok_Arrow or else Token = Tok_Others) - then - Error_Msg_SC - ("expect record component association in delta aggregate"); - raise Error_Resync; - end if; - goto Aggregate; else @@ -1653,7 +1614,7 @@ package body Ch4 is Expr_Node := Empty; elsif Token = Tok_For then - Expr_Node := P_Iterated_Component_Assoc_Or_Reduction; + Expr_Node := P_Iterated_Component_Association; else Save_Scan_State (Scan_State); -- at start of expression @@ -1705,8 +1666,10 @@ package body Ch4 is Assoc_Node : Node_Id; begin + -- A loop indicates an iterated_component_association + if Token = Tok_For then - return P_Iterated_Component_Assoc_Or_Reduction; + return P_Iterated_Component_Association; end if; Assoc_Node := New_Node (N_Component_Association, Token_Ptr); @@ -2867,7 +2830,7 @@ package body Ch4 is end if; else Restore_Scan_State (Scan_State); -- To FOR - Node1 := P_Iterated_Component_Assoc_Or_Reduction; + Node1 := P_Iterated_Component_Association; end if; return Node1; @@ -2894,18 +2857,6 @@ package body Ch4 is Node1 := P_Name; return Node1; - -- Ada 2020: reduction expression parameter - - when Tok_Less => - Scan; -- past < - - Node1 := - New_Node (N_Reduction_Expression_Parameter, Token_Ptr); - Set_Expression (Node1, P_Simple_Expression); - - Scan; -- past > - return Node1; - -- Anything else is illegal as the first token of a primary, but -- we test for some common errors, to improve error messages. @@ -3350,195 +3301,36 @@ package body Ch4 is return Case_Alt_Node; end P_Case_Expression_Alternative; - --------------------------------------------- - -- P_Iterated_Component_Assoc_Or_Reduction -- - --------------------------------------------- + -------------------------------------- + -- P_Iterated_Component_Association -- + -------------------------------------- -- ITERATED_COMPONENT_ASSOCIATION ::= -- for DEFINING_IDENTIFIER in DISCRETE_CHOICE_LIST => EXPRESSION - function P_Iterated_Component_Assoc_Or_Reduction return Node_Id is - Expr : Node_Id; - - function OK_Reduction_Expression_Parameter (L : List_Id) return Boolean; - -- Check that if a reduction_expression_Parameter appears, it is a - -- single one. - - --------------------------------------- - -- OK_Reduction_Expression_Parameter -- - --------------------------------------- - - function OK_Reduction_Expression_Parameter - (L : List_Id) return Boolean - is - Actual : Node_Id; - Num : Int := 0; - Seen : Boolean; - - begin - Seen := False; - Actual := First (L); - while Present (Actual) loop - if Nkind (Actual) = N_Reduction_Expression_Parameter then - if Seen then - Error_Msg_N ("only one reduction parameter allowed", Expr); - else - Seen := True; - end if; - end if; - - Num := Num + 1; - Next (Actual); - end loop; - - if Seen and then Num > 2 then - Error_Msg_N ("too many parameters in reduction function", Expr); - end if; - - return Seen; - end OK_Reduction_Expression_Parameter; - - -- Local variables - - Lparen : constant Boolean := Prev_Token = Tok_Left_Paren; + function P_Iterated_Component_Association return Node_Id is Assoc_Node : Node_Id; - State : Saved_Scan_State; - -- Start of processing for P_Iterated_Component_Assoc_Or_Reduction + -- Start of processing for P_Iterated_Component_Association begin Scan; -- past FOR Assoc_Node := New_Node (N_Iterated_Component_Association, Prev_Token_Ptr); - Save_Scan_State (State); Set_Defining_Identifier (Assoc_Node, P_Defining_Identifier); - - if Token = Tok_In then - Scan; -- past in - - Set_Discrete_Choices (Assoc_Node, P_Discrete_Choice_List); - TF_Arrow; - - if Token = Tok_Less then - Restore_Scan_State (State); - return P_Reduction_Expression (Lparen); - else - Expr := P_Expression; - end if; - - if Nkind (Expr) = N_Function_Call - and then OK_Reduction_Expression_Parameter - (Parameter_Associations (Expr)) - then - Restore_Scan_State (State); - return P_Reduction_Expression (Lparen); - - elsif Nkind (Expr) in N_Op - and then - Nkind (Right_Opnd (Expr)) = N_Reduction_Expression_Parameter - then - return P_Reduction_Expression (Lparen); - - elsif Nkind (Expr) in N_Binary_Op - and then - Nkind (Left_Opnd (Expr)) = N_Reduction_Expression_Parameter - then - return P_Reduction_Expression (Lparen); - - elsif Nkind (Expr) = N_Indexed_Component - and then OK_Reduction_Expression_Parameter (Expressions (Expr)) - then - Restore_Scan_State (State); - return P_Reduction_Expression (Lparen); - end if; - - Set_Expression (Assoc_Node, Expr); - if Ada_Version < Ada_2020 then - Error_Msg_SC ("iterated component is an Ada 2020 extension"); - Error_Msg_SC ("\compile with -gnatX"); - end if; - - return Assoc_Node; - - elsif Token = Tok_Of then - Restore_Scan_State (State); - return P_Reduction_Expression (Lparen); - - else - raise Error_Resync; - end if; - end P_Iterated_Component_Assoc_Or_Reduction; - - ---------------------------- - -- P_Reduction_Expression -- - ---------------------------- - - function P_Reduction_Expression (Lparen : Boolean) return Node_Id is - Expr : Node_Id; - I_Spec : Node_Id; - Left_Opnd : Node_Id; - Reduction_Node : Node_Id; - - begin - Reduction_Node := New_Node (N_Reduction_Expression, Prev_Token_Ptr); - - I_Spec := P_Loop_Parameter_Specification; - - if Nkind (I_Spec) = N_Loop_Parameter_Specification then - Set_Loop_Parameter_Specification (Reduction_Node, I_Spec); - else - Set_Iterator_Specification (Reduction_Node, I_Spec); - end if; - - T_Arrow; - if Token = Tok_Less and then False then - Scan; -- past < - - Left_Opnd := New_Node (N_Reduction_Expression_Parameter, Token_Ptr); - Set_Expression (Left_Opnd, P_Simple_Expression); - - Scan; -- past > - - if Token = Tok_Plus then - Set_Expression - (Reduction_Node, New_Op_Node (N_Op_Add, Token_Ptr)); - else - Set_Expression - (Reduction_Node, New_Op_Node (N_Op_Concat, Token_Ptr)); - end if; - - Scan; -- past operstor - Set_Left_Opnd (Expression (Reduction_Node), Left_Opnd); - Set_Right_Opnd (Expression (Reduction_Node), P_Primary); - - else - Expr := P_Expression; - Set_Expression (Reduction_Node, Expr); - - -- if Nkind (Expr) = N_Indexed_Component - -- and then List_Length (Expressions (Expr)) /= 2 - -- then - -- Error_Msg_N - -- ("combiner function call must have two arguments", Expr); - -- end if; - end if; + T_In; + Set_Discrete_Choices (Assoc_Node, P_Discrete_Choice_List); + TF_Arrow; + Set_Expression (Assoc_Node, P_Expression); if Ada_Version < Ada_2020 then - Error_Msg_SC ("Reduction_Expression is an Ada 2020 extension"); + Error_Msg_SC ("iterated component is an Ada 2020 extension"); Error_Msg_SC ("\compile with -gnatX"); end if; - if not (Lparen and then Token = Tok_Right_Paren) then - Error_Msg - ("reduction expression must be parenthesized", - Sloc (Reduction_Node)); - else - Scan; -- past ??? - end if; - - return Reduction_Node; - end P_Reduction_Expression; + return Assoc_Node; + end P_Iterated_Component_Association; --------------------- -- P_If_Expression -- @@ -3773,7 +3565,7 @@ package body Ch4 is -- an aggregate. Restore_Scan_State (Scan_State); - Result := P_Iterated_Component_Assoc_Or_Reduction; + Result := P_Iterated_Component_Association; end if; -- No other possibility should exist (caller was supposed to check) diff --git a/gcc/ada/sem.adb b/gcc/ada/sem.adb index c1fb188b51d..49878452e81 100644 --- a/gcc/ada/sem.adb +++ b/gcc/ada/sem.adb @@ -515,12 +515,6 @@ package body Sem is when N_Record_Representation_Clause => Analyze_Record_Representation_Clause (N); - when N_Reduction_Expression => - Analyze_Reduction_Expression (N); - - when N_Reduction_Expression_Parameter => - Analyze_Reduction_Expression_Parameter (N); - when N_Reference => Analyze_Reference (N); diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb index 0d77ad1562b..5d2e81b3056 100644 --- a/gcc/ada/sem_ch4.adb +++ b/gcc/ada/sem_ch4.adb @@ -4365,83 +4365,6 @@ package body Sem_Ch4 is Check_Function_Writable_Actuals (N); end Analyze_Range; - ----------------------------------- - -- Analyze_Reduction_Expression -- - ----------------------------------- - - procedure Analyze_Reduction_Expression (N : Node_Id) is - Expr : constant Node_Id := Expression (N); - QE_Scop : Entity_Id; - - begin - -- The processing is similar to that for quantified expressions, - -- which have a similar structure and are eventually transformed - -- into a loop. - - QE_Scop := New_Internal_Entity (E_Loop, Current_Scope, Sloc (N), 'L'); - Set_Etype (QE_Scop, Standard_Void_Type); - Set_Scope (QE_Scop, Current_Scope); - Set_Parent (QE_Scop, N); - - Push_Scope (QE_Scop); - - -- All constituents are preanalyzed and resolved to avoid untimely - -- generation of various temporaries and types. Full analysis and - -- expansion is carried out when the reduction expression is - -- transformed into an expression with actions. - - if Present (Iterator_Specification (N)) then - Preanalyze (Iterator_Specification (N)); - - else pragma Assert (Present (Loop_Parameter_Specification (N))); - declare - Loop_Par : constant Node_Id := Loop_Parameter_Specification (N); - - begin - Preanalyze (Loop_Par); - - if Nkind (Discrete_Subtype_Definition (Loop_Par)) = N_Function_Call - and then Parent (Loop_Par) /= N - then - -- The parser cannot distinguish between a loop specification - -- and an iterator specification. If after preanalysis the - -- proper form has been recognized, rewrite the expression to - -- reflect the right kind. This is needed for proper ASIS - -- navigation. If expansion is enabled, the transformation is - -- performed when the expression is rewritten as a loop. - - Set_Iterator_Specification (N, - New_Copy_Tree (Iterator_Specification (Parent (Loop_Par)))); - - Set_Defining_Identifier (Iterator_Specification (N), - Relocate_Node (Defining_Identifier (Loop_Par))); - Set_Name (Iterator_Specification (N), - Relocate_Node (Discrete_Subtype_Definition (Loop_Par))); - Set_Comes_From_Source (Iterator_Specification (N), - Comes_From_Source (Loop_Parameter_Specification (N))); - Set_Loop_Parameter_Specification (N, Empty); - end if; - end; - end if; - - Preanalyze (Expr); - End_Scope; - - Set_Etype (N, Etype (Expr)); - end Analyze_Reduction_Expression; - - -------------------------------------------- - -- Analyze_Reduction_Expression_Parameter -- - -------------------------------------------- - - procedure Analyze_Reduction_Expression_Parameter (N : Node_Id) is - Expr : constant Node_Id := Expression (N); - - begin - Analyze (Expr); - Set_Etype (N, Etype (Expr)); - end Analyze_Reduction_Expression_Parameter; - ----------------------- -- Analyze_Reference -- ----------------------- diff --git a/gcc/ada/sem_ch4.ads b/gcc/ada/sem_ch4.ads index 6e0f391bbfd..e78a9f52c95 100644 --- a/gcc/ada/sem_ch4.ads +++ b/gcc/ada/sem_ch4.ads @@ -45,8 +45,6 @@ package Sem_Ch4 is procedure Analyze_Qualified_Expression (N : Node_Id); procedure Analyze_Quantified_Expression (N : Node_Id); procedure Analyze_Range (N : Node_Id); - procedure Analyze_Reduction_Expression (N : Node_Id); - procedure Analyze_Reduction_Expression_Parameter (N : Node_Id); procedure Analyze_Reference (N : Node_Id); procedure Analyze_Selected_Component (N : Node_Id); procedure Analyze_Short_Circuit (N : Node_Id); diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index 41de3fe4e62..e7ee70e6ed1 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -2904,13 +2904,6 @@ package body Sem_Res is when N_Real_Literal => Resolve_Real_Literal (N, Ctx_Type); - when N_Reduction_Expression => - null; - -- Resolve (Expression (N), Ctx_Type); - - when N_Reduction_Expression_Parameter => - null; - when N_Reference => Resolve_Reference (N, Ctx_Type); diff --git a/gcc/ada/sem_spark.adb b/gcc/ada/sem_spark.adb index e8aede44af9..c44fbc61c4f 100644 --- a/gcc/ada/sem_spark.adb +++ b/gcc/ada/sem_spark.adb @@ -1376,12 +1376,6 @@ package body Sem_SPARK is Free_Env (Saved_Env); end; - when N_Reduction_Expression => - null; - - when N_Reduction_Expression_Parameter => - null; - -- Analyze the list of associations in the aggregate when N_Aggregate => diff --git a/gcc/ada/sinfo.adb b/gcc/ada/sinfo.adb index d27a9051046..4ab5614f6db 100644 --- a/gcc/ada/sinfo.adb +++ b/gcc/ada/sinfo.adb @@ -1279,8 +1279,6 @@ package body Sinfo is or else NT (N).Nkind = N_Qualified_Expression or else NT (N).Nkind = N_Raise_Expression or else NT (N).Nkind = N_Raise_Statement - or else NT (N).Nkind = N_Reduction_Expression - or else NT (N).Nkind = N_Reduction_Expression_Parameter or else NT (N).Nkind = N_Simple_Return_Statement or else NT (N).Nkind = N_Type_Conversion or else NT (N).Nkind = N_Unchecked_Expression @@ -2217,8 +2215,7 @@ package body Sinfo is begin pragma Assert (False or else NT (N).Nkind = N_Iteration_Scheme - or else NT (N).Nkind = N_Quantified_Expression - or else NT (N).Nkind = N_Reduction_Expression); + or else NT (N).Nkind = N_Quantified_Expression); return Node2 (N); end Iterator_Specification; @@ -2348,8 +2345,7 @@ package body Sinfo is begin pragma Assert (False or else NT (N).Nkind = N_Iteration_Scheme - or else NT (N).Nkind = N_Quantified_Expression - or else NT (N).Nkind = N_Reduction_Expression); + or else NT (N).Nkind = N_Quantified_Expression); return Node4 (N); end Loop_Parameter_Specification; @@ -4746,8 +4742,6 @@ package body Sinfo is or else NT (N).Nkind = N_Qualified_Expression or else NT (N).Nkind = N_Raise_Expression or else NT (N).Nkind = N_Raise_Statement - or else NT (N).Nkind = N_Reduction_Expression - or else NT (N).Nkind = N_Reduction_Expression_Parameter or else NT (N).Nkind = N_Simple_Return_Statement or else NT (N).Nkind = N_Type_Conversion or else NT (N).Nkind = N_Unchecked_Expression @@ -5684,8 +5678,7 @@ package body Sinfo is begin pragma Assert (False or else NT (N).Nkind = N_Iteration_Scheme - or else NT (N).Nkind = N_Quantified_Expression - or else NT (N).Nkind = N_Reduction_Expression); + or else NT (N).Nkind = N_Quantified_Expression); Set_Node2_With_Parent (N, Val); end Set_Iterator_Specification; @@ -5815,8 +5808,7 @@ package body Sinfo is begin pragma Assert (False or else NT (N).Nkind = N_Iteration_Scheme - or else NT (N).Nkind = N_Quantified_Expression - or else NT (N).Nkind = N_Reduction_Expression); + or else NT (N).Nkind = N_Quantified_Expression); Set_Node4_With_Parent (N, Val); end Set_Loop_Parameter_Specification; diff --git a/gcc/ada/sinfo.ads b/gcc/ada/sinfo.ads index dd09773bce1..c453c281f52 100644 --- a/gcc/ada/sinfo.ads +++ b/gcc/ada/sinfo.ads @@ -4762,31 +4762,6 @@ package Sinfo is -- Condition (Node1) -- All_Present (Flag15) - -------------------------------- - -- 4.5.9 Reduction Expression -- - -------------------------------- - - -- REDUCTION_EXPRESSION ::= - -- for LOOP_PARAMETER_SPECIFICATION => COMBINER_FUNCTION_CALL - -- for ITERATOR_SPECIFIATION => COMBINER_FUNCTION_CALL - - -- At most one of (Iterator_Specification, Loop_Parameter_Specification) - -- is present at a time, in which case the other one is empty. - - -- N_Reduction_Expression - -- Sloc points to FOR - -- Iterator_Specification (Node2) - -- Expression (Node3) - -- Loop_Parameter_Specification (Node4) - -- plus fields for expression - - -- COMBINER_FUNCTION_CALL => FUNCTION_CALL - - -- A Combiner_Function_Call is either a function call (including an - -- operator) with one reduction expression parameter, appearing either - -- as a left operand or as the first actual in the parameter list. In - -- a reduction expression this is represented as an expression. - -------------------------- -- 4.6 Type Conversion -- -------------------------- @@ -5649,16 +5624,6 @@ package Sinfo is -- EXPLICIT_ACTUAL_PARAMETER ::= -- EXPRESSION | variable_NAME | REDUCTION_EXPRESSION_PARAMETER - ------------------------------------------ - -- 6.4.6 Reduction_Expression_Parameter -- - ------------------------------------------ - - -- REDUCTION_EXPRESSION_PARAMETER ::= <> | < EXPRESSION > - - -- N_Reduction_Expression_Parameter - -- Expression (Node3) (Set to Empty if no expression present) - -- plus fields for expression - --------------------------- -- 6.5 Return Statement -- --------------------------- @@ -8781,8 +8746,6 @@ package Sinfo is N_Null, N_Qualified_Expression, N_Quantified_Expression, - N_Reduction_Expression, - N_Reduction_Expression_Parameter, N_Aggregate, N_Allocator, N_Case_Expression, @@ -12173,20 +12136,6 @@ package Sinfo is 4 => True, -- Loop_Parameter_Specification (Node4) 5 => False), -- Etype (Node5-Sem) - N_Reduction_Expression => - (1 => False, -- unused - 2 => True, -- Iterator_Specification (Node2) - 3 => True, -- Expression (Node3) - 4 => True, -- Loop_Parameter_Specification (Node4) - 5 => False), -- Etype (Node5-Sem) - - N_Reduction_Expression_Parameter => - (1 => False, -- unused - 2 => False, -- unused - 3 => True, -- Expression (Node3) - 4 => False, -- unused - 5 => False), -- Etype (Node5-Sem) - N_Allocator => (1 => False, -- Storage_Pool (Node1-Sem) 2 => False, -- Procedure_To_Call (Node2-Sem) diff --git a/gcc/ada/sprint.adb b/gcc/ada/sprint.adb index ce5721b1a28..f19629c6f9a 100644 --- a/gcc/ada/sprint.adb +++ b/gcc/ada/sprint.adb @@ -3110,28 +3110,6 @@ package body Sprint is Sprint_Indented_List (Component_Clauses (Node)); Write_Indent_Str ("end record;"); - when N_Reduction_Expression => - Write_Str (" for"); - - if Present (Iterator_Specification (Node)) then - Sprint_Node (Iterator_Specification (Node)); - else - Sprint_Node (Loop_Parameter_Specification (Node)); - end if; - - Write_Str (" => "); - Sprint_Node (Expression (Node)); - null; - - when N_Reduction_Expression_Parameter => - Write_Char ('<'); - - if Present (Expression (Node)) then - Sprint_Node (Expression (Node)); - end if; - - Write_Char ('>'); - when N_Reference => Sprint_Node (Prefix (Node)); Write_Str_With_Col_Check_Sloc ("'reference");