diff options
author | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2013-05-24 08:52:35 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2013-05-24 08:52:35 +0000 |
commit | 633a3f2aea9d047c21afd1ae7fb2d5c02589e883 (patch) | |
tree | 18fe171da5a381948dfbf137744f8dee636874af /gcc/ada/gcc-interface | |
parent | f2423384e6b5de57267b6b6004301f71e8878ec9 (diff) | |
download | gcc-633a3f2aea9d047c21afd1ae7fb2d5c02589e883.zip gcc-633a3f2aea9d047c21afd1ae7fb2d5c02589e883.tar.gz gcc-633a3f2aea9d047c21afd1ae7fb2d5c02589e883.tar.bz2 |
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) <Pragma_Loop_Optimize>: New case.
(Loop_Statement_to_gnu): Save the loop statement onto the stack
instead of the label.
(gnat_to_gnu) <N_Exit_Statement>: Retrieve the loop label.
From-SVN: r199281
Diffstat (limited to 'gcc/ada/gcc-interface')
-rw-r--r-- | gcc/ada/gcc-interface/ada-tree.h | 8 | ||||
-rw-r--r-- | gcc/ada/gcc-interface/trans.c | 46 |
2 files changed, 47 insertions, 7 deletions
diff --git a/gcc/ada/gcc-interface/ada-tree.h b/gcc/ada/gcc-interface/ada-tree.h index ec00cc4..15d1cdd 100644 --- a/gcc/ada/gcc-interface/ada-tree.h +++ b/gcc/ada/gcc-interface/ada-tree.h @@ -6,7 +6,7 @@ * * * C Header File * * * - * Copyright (C) 1992-2012, Free Software Foundation, Inc. * + * Copyright (C) 1992-2013, 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- * @@ -507,5 +507,11 @@ do { \ #define LOOP_STMT_BOTTOM_COND_P(NODE) TREE_LANG_FLAG_0 (LOOP_STMT_CHECK (NODE)) #define LOOP_STMT_TOP_UPDATE_P(NODE) TREE_LANG_FLAG_1 (LOOP_STMT_CHECK (NODE)) +/* Optimization hints on loops. */ +#define LOOP_STMT_NO_UNROLL(NODE) TREE_LANG_FLAG_2 (LOOP_STMT_CHECK (NODE)) +#define LOOP_STMT_UNROLL(NODE) TREE_LANG_FLAG_3 (LOOP_STMT_CHECK (NODE)) +#define LOOP_STMT_NO_VECTOR(NODE) TREE_LANG_FLAG_4 (LOOP_STMT_CHECK (NODE)) +#define LOOP_STMT_VECTOR(NODE) TREE_LANG_FLAG_5 (LOOP_STMT_CHECK (NODE)) + #define EXIT_STMT_COND(NODE) TREE_OPERAND_CHECK_CODE (NODE, EXIT_STMT, 0) #define EXIT_STMT_LABEL(NODE) TREE_OPERAND_CHECK_CODE (NODE, EXIT_STMT, 1) 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<range_check_info, va_gc> *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: |