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
This commit is contained in:
Eric Botcazou 2013-05-24 08:52:35 +00:00
parent f2423384e6
commit 633a3f2aea
3 changed files with 61 additions and 8 deletions

View file

@ -1,3 +1,16 @@
2013-05-24 Eric Botcazou <ebotcazou@adacore.com>
* 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.
2013-05-24 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/trans.c: Include diagnostic.h and opts.h.
@ -27,7 +40,7 @@
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Array_Subtype>: Use
int_const_binop to shift bounds by 1 when they are integer constants.
2013-04-25 Arnaud Charlet <charlet@adacore.com>
2013-04-25 Arnaud Charlet <charlet@adacore.com>>
* gcc-interface/Makefile.in (ADA_EXCLUDE_SRCS): Exclude s-init.ad{s,b}

View file

@ -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)

View file

@ -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: