From 633a3f2aea9d047c21afd1ae7fb2d5c02589e883 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Fri, 24 May 2013 08:52:35 +0000 Subject: ada-tree.h (LOOP_STMT_NO_UNROLL): New define. * gcc-interface/ada-tree.h (LOOP_STMT_NO_UNROLL): New define. (LOOP_STMT_UNROLL): Likewise. (LOOP_STMT_NO_VECTOR): Likewise. (LOOP_STMT_VECTOR): Likewise. * gcc-interface/trans.c (struct loop_info_d): Replace label field with stmt field. (Pragma_to_gnu) : New case. (Loop_Statement_to_gnu): Save the loop statement onto the stack instead of the label. (gnat_to_gnu) : Retrieve the loop label. From-SVN: r199281 --- gcc/ada/gcc-interface/trans.c | 46 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 40 insertions(+), 6 deletions(-) (limited to 'gcc/ada/gcc-interface/trans.c') diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index 4757139..d95b3f6 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -212,7 +212,7 @@ typedef struct range_check_info_d *range_check_info; /* Structure used to record information for a loop. */ struct GTY(()) loop_info_d { - tree label; + tree stmt; tree loop_var; vec *checks; }; @@ -1189,8 +1189,8 @@ Pragma_to_gnu (Node_Id gnat_node) tree gnu_result = alloc_stmt_list (); Node_Id gnat_temp; - /* Check for (and ignore) unrecognized pragma and do nothing if we are just - annotating types. */ + /* Do nothing if we are just annotating types and check for (and ignore) + unrecognized pragmas. */ if (type_annotate_only || !Is_Pragma_Name (Chars (Pragma_Identifier (gnat_node)))) return gnu_result; @@ -1252,6 +1252,37 @@ Pragma_to_gnu (Node_Id gnat_node) } break; + case Pragma_Loop_Optimize: + for (gnat_temp = First (Pragma_Argument_Associations (gnat_node)); + Present (gnat_temp); + gnat_temp = Next (gnat_temp)) + { + tree gnu_loop_stmt = gnu_loop_stack ->last ()->stmt; + + switch (Chars (Expression (gnat_temp))) + { + case Name_No_Unroll: + LOOP_STMT_NO_UNROLL (gnu_loop_stmt) = 1; + break; + + case Name_Unroll: + LOOP_STMT_UNROLL (gnu_loop_stmt) = 1; + break; + + case Name_No_Vector: + LOOP_STMT_NO_VECTOR (gnu_loop_stmt) = 1; + break; + + case Name_Vector: + LOOP_STMT_VECTOR (gnu_loop_stmt) = 1; + break; + + default: + gcc_unreachable (); + } + } + break; + case Pragma_Optimize: switch (Chars (Expression (First (Pragma_Argument_Associations (gnat_node))))) @@ -1363,6 +1394,9 @@ Pragma_to_gnu (Node_Id gnat_node) &global_options_set, global_dc); } break; + + default: + break; } return gnu_result; @@ -2424,8 +2458,8 @@ Loop_Statement_to_gnu (Node_Id gnat_node) &DECL_SOURCE_LOCATION (gnu_loop_label)); LOOP_STMT_LABEL (gnu_loop_stmt) = gnu_loop_label; - /* Save the label so that a corresponding N_Exit_Statement can find it. */ - gnu_loop_info->label = gnu_loop_label; + /* Save the statement for later reuse. */ + gnu_loop_info->stmt = gnu_loop_stmt; /* Set the condition under which the loop must keep going. For the case "LOOP .... END LOOP;" the condition is always true. */ @@ -6370,7 +6404,7 @@ gnat_to_gnu (Node_Id gnat_node) ? gnat_to_gnu (Condition (gnat_node)) : NULL_TREE), (Present (Name (gnat_node)) ? get_gnu_tree (Entity (Name (gnat_node))) - : gnu_loop_stack->last ()->label)); + : LOOP_STMT_LABEL (gnu_loop_stack->last ()->stmt))); break; case N_Simple_Return_Statement: -- cgit v1.1