Commit 1d468b06 by Nathan Froyd Committed by Nathan Froyd

c-parser.c (c_parser_omp_for_loop): Use a VEC for for_block.

gcc/
	* c-parser.c (c_parser_omp_for_loop): Use a VEC for for_block.

gcc/cp/
	* parser.c (cp_parser_omp_for_loop): Use a VEC for for_block.

From-SVN: r161599
parent 53337422
2010-06-30 Nathan Froyd <froydnj@codesourcery.com>
* c-parser.c (c_parser_omp_for_loop): Use a VEC for for_block.
2010-06-30 Richard Guenther <rguenther@suse.de> 2010-06-30 Richard Guenther <rguenther@suse.de>
PR target/44722 PR target/44722
......
...@@ -8150,10 +8150,11 @@ c_parser_omp_for_loop (location_t loc, ...@@ -8150,10 +8150,11 @@ c_parser_omp_for_loop (location_t loc,
c_parser *parser, tree clauses, tree *par_clauses) c_parser *parser, tree clauses, tree *par_clauses)
{ {
tree decl, cond, incr, save_break, save_cont, body, init, stmt, cl; tree decl, cond, incr, save_break, save_cont, body, init, stmt, cl;
tree declv, condv, incrv, initv, for_block = NULL, ret = NULL; tree declv, condv, incrv, initv, ret = NULL;
bool fail = false, open_brace_parsed = false; bool fail = false, open_brace_parsed = false;
int i, collapse = 1, nbraces = 0; int i, collapse = 1, nbraces = 0;
location_t for_loc; location_t for_loc;
VEC(tree,gc) *for_block = make_tree_vector ();
for (cl = clauses; cl; cl = OMP_CLAUSE_CHAIN (cl)) for (cl = clauses; cl; cl = OMP_CLAUSE_CHAIN (cl))
if (OMP_CLAUSE_CODE (cl) == OMP_CLAUSE_COLLAPSE) if (OMP_CLAUSE_CODE (cl) == OMP_CLAUSE_COLLAPSE)
...@@ -8185,8 +8186,7 @@ c_parser_omp_for_loop (location_t loc, ...@@ -8185,8 +8186,7 @@ c_parser_omp_for_loop (location_t loc,
if (c_parser_next_token_starts_declaration (parser)) if (c_parser_next_token_starts_declaration (parser))
{ {
if (i > 0) if (i > 0)
for_block VEC_safe_push (tree, gc, for_block, c_begin_compound_stmt (true));
= tree_cons (NULL, c_begin_compound_stmt (true), for_block);
c_parser_declaration_or_fndef (parser, true, true, true, true, true); c_parser_declaration_or_fndef (parser, true, true, true, true, true);
decl = check_for_loop_decls (for_loc); decl = check_for_loop_decls (for_loc);
if (decl == NULL) if (decl == NULL)
...@@ -8416,15 +8416,15 @@ c_parser_omp_for_loop (location_t loc, ...@@ -8416,15 +8416,15 @@ c_parser_omp_for_loop (location_t loc,
ret = stmt; ret = stmt;
} }
pop_scopes: pop_scopes:
while (for_block) while (!VEC_empty (tree, for_block))
{ {
/* FIXME diagnostics: LOC below should be the actual location of /* FIXME diagnostics: LOC below should be the actual location of
this particular for block. We need to build a list of this particular for block. We need to build a list of
locations to go along with FOR_BLOCK. */ locations to go along with FOR_BLOCK. */
stmt = c_end_compound_stmt (loc, TREE_VALUE (for_block), true); stmt = c_end_compound_stmt (loc, VEC_pop (tree, for_block), true);
add_stmt (stmt); add_stmt (stmt);
for_block = TREE_CHAIN (for_block);
} }
release_tree_vector (for_block);
return ret; return ret;
} }
......
2010-06-30 Nathan Froyd <froydnj@codesourcery.com> 2010-06-30 Nathan Froyd <froydnj@codesourcery.com>
* parser.c (cp_parser_omp_for_loop): Use a VEC for for_block.
2010-06-30 Nathan Froyd <froydnj@codesourcery.com>
* repo.c (pending_repo): Change type to a VEC. * repo.c (pending_repo): Change type to a VEC.
(finish_repo): Adjust for new type of pending_repo. (finish_repo): Adjust for new type of pending_repo.
(repo_emit_p): Likewise. (repo_emit_p): Likewise.
......
...@@ -22705,11 +22705,12 @@ static tree ...@@ -22705,11 +22705,12 @@ static tree
cp_parser_omp_for_loop (cp_parser *parser, tree clauses, tree *par_clauses) cp_parser_omp_for_loop (cp_parser *parser, tree clauses, tree *par_clauses)
{ {
tree init, cond, incr, body, decl, pre_body = NULL_TREE, ret; tree init, cond, incr, body, decl, pre_body = NULL_TREE, ret;
tree for_block = NULL_TREE, real_decl, initv, condv, incrv, declv; tree real_decl, initv, condv, incrv, declv;
tree this_pre_body, cl; tree this_pre_body, cl;
location_t loc_first; location_t loc_first;
bool collapse_err = false; bool collapse_err = false;
int i, collapse = 1, nbraces = 0; int i, collapse = 1, nbraces = 0;
VEC(tree,gc) *for_block = make_tree_vector ();
for (cl = clauses; cl; cl = OMP_CLAUSE_CHAIN (cl)) for (cl = clauses; cl; cl = OMP_CLAUSE_CHAIN (cl))
if (OMP_CLAUSE_CODE (cl) == OMP_CLAUSE_COLLAPSE) if (OMP_CLAUSE_CODE (cl) == OMP_CLAUSE_COLLAPSE)
...@@ -22828,8 +22829,7 @@ cp_parser_omp_for_loop (cp_parser *parser, tree clauses, tree *par_clauses) ...@@ -22828,8 +22829,7 @@ cp_parser_omp_for_loop (cp_parser *parser, tree clauses, tree *par_clauses)
LOOKUP_ONLYCONVERTING); LOOKUP_ONLYCONVERTING);
if (CLASS_TYPE_P (TREE_TYPE (decl))) if (CLASS_TYPE_P (TREE_TYPE (decl)))
{ {
for_block VEC_safe_push (tree, gc, for_block, this_pre_body);
= tree_cons (NULL, this_pre_body, for_block);
init = NULL_TREE; init = NULL_TREE;
} }
else else
...@@ -23083,11 +23083,9 @@ cp_parser_omp_for_loop (cp_parser *parser, tree clauses, tree *par_clauses) ...@@ -23083,11 +23083,9 @@ cp_parser_omp_for_loop (cp_parser *parser, tree clauses, tree *par_clauses)
} }
} }
while (for_block) while (!VEC_empty (tree, for_block))
{ add_stmt (pop_stmt_list (VEC_pop (tree, for_block)));
add_stmt (pop_stmt_list (TREE_VALUE (for_block))); release_tree_vector (for_block);
for_block = TREE_CHAIN (for_block);
}
return ret; return ret;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment