Commit 3daa26d0 by Richard Biener Committed by Richard Biener

gimple-fold.h (gimple_fold_builtin): Remove.

2014-08-04  Richard Biener  <rguenther@suse.de>

	* gimple-fold.h (gimple_fold_builtin): Remove.
	* gimple-fold.c (gimple_fold_builtin): Make static.
	* tree-ssa-ccp.c (pass_fold_builtins::execute): Use
	fold_stmt, not gimple_fold_builtin.

From-SVN: r213585
parent 24d4b3d5
2014-08-04 Richard Biener <rguenther@suse.de>
* gimple-fold.h (gimple_fold_builtin): Remove.
* gimple-fold.c (gimple_fold_builtin): Make static.
* tree-ssa-ccp.c (pass_fold_builtins::execute): Use
fold_stmt, not gimple_fold_builtin.
2014-08-04 Martin Liska <mliska@suse.cz> 2014-08-04 Martin Liska <mliska@suse.cz>
* cgraph.h (csi_end_p): Removed. * cgraph.h (csi_end_p): Removed.
......
...@@ -873,7 +873,7 @@ get_maxval_strlen (tree arg, tree *length, bitmap visited, int type) ...@@ -873,7 +873,7 @@ get_maxval_strlen (tree arg, tree *length, bitmap visited, int type)
Note that some builtins expand into inline code that may not Note that some builtins expand into inline code that may not
be valid in GIMPLE. Callers must take care. */ be valid in GIMPLE. Callers must take care. */
tree static tree
gimple_fold_builtin (gimple stmt) gimple_fold_builtin (gimple stmt)
{ {
tree result, val[3]; tree result, val[3];
......
...@@ -25,7 +25,6 @@ along with GCC; see the file COPYING3. If not see ...@@ -25,7 +25,6 @@ along with GCC; see the file COPYING3. If not see
extern tree canonicalize_constructor_val (tree, tree); extern tree canonicalize_constructor_val (tree, tree);
extern tree get_symbol_constant_value (tree); extern tree get_symbol_constant_value (tree);
extern void gimplify_and_update_call_from_tree (gimple_stmt_iterator *, tree); extern void gimplify_and_update_call_from_tree (gimple_stmt_iterator *, tree);
extern tree gimple_fold_builtin (gimple);
extern bool fold_stmt (gimple_stmt_iterator *); extern bool fold_stmt (gimple_stmt_iterator *);
extern bool fold_stmt_inplace (gimple_stmt_iterator *); extern bool fold_stmt_inplace (gimple_stmt_iterator *);
extern tree maybe_fold_and_comparisons (enum tree_code, tree, tree, extern tree maybe_fold_and_comparisons (enum tree_code, tree, tree,
......
...@@ -2655,7 +2655,7 @@ pass_fold_builtins::execute (function *fun) ...@@ -2655,7 +2655,7 @@ pass_fold_builtins::execute (function *fun)
for (i = gsi_start_bb (bb); !gsi_end_p (i); ) for (i = gsi_start_bb (bb); !gsi_end_p (i); )
{ {
gimple stmt, old_stmt; gimple stmt, old_stmt;
tree callee, result; tree callee;
enum built_in_function fcode; enum built_in_function fcode;
stmt = gsi_stmt (i); stmt = gsi_stmt (i);
...@@ -2680,62 +2680,69 @@ pass_fold_builtins::execute (function *fun) ...@@ -2680,62 +2680,69 @@ pass_fold_builtins::execute (function *fun)
gsi_next (&i); gsi_next (&i);
continue; continue;
} }
callee = gimple_call_fndecl (stmt); callee = gimple_call_fndecl (stmt);
if (!callee || DECL_BUILT_IN_CLASS (callee) != BUILT_IN_NORMAL) if (!callee || DECL_BUILT_IN_CLASS (callee) != BUILT_IN_NORMAL)
{ {
gsi_next (&i); gsi_next (&i);
continue; continue;
} }
fcode = DECL_FUNCTION_CODE (callee);
result = gimple_fold_builtin (stmt);
if (result) fcode = DECL_FUNCTION_CODE (callee);
gimple_remove_stmt_histograms (fun, stmt); if (fold_stmt (&i))
;
else
{
tree result = NULL_TREE;
switch (DECL_FUNCTION_CODE (callee))
{
case BUILT_IN_CONSTANT_P:
/* Resolve __builtin_constant_p. If it hasn't been
folded to integer_one_node by now, it's fairly
certain that the value simply isn't constant. */
result = integer_zero_node;
break;
if (!result) case BUILT_IN_ASSUME_ALIGNED:
switch (DECL_FUNCTION_CODE (callee)) /* Remove __builtin_assume_aligned. */
{ result = gimple_call_arg (stmt, 0);
case BUILT_IN_CONSTANT_P: break;
/* Resolve __builtin_constant_p. If it hasn't been
folded to integer_one_node by now, it's fairly
certain that the value simply isn't constant. */
result = integer_zero_node;
break;
case BUILT_IN_ASSUME_ALIGNED: case BUILT_IN_STACK_RESTORE:
/* Remove __builtin_assume_aligned. */ result = optimize_stack_restore (i);
result = gimple_call_arg (stmt, 0); if (result)
break; break;
gsi_next (&i);
continue;
case BUILT_IN_STACK_RESTORE: case BUILT_IN_UNREACHABLE:
result = optimize_stack_restore (i); if (optimize_unreachable (i))
if (result) cfg_changed = true;
break; break;
gsi_next (&i);
continue;
case BUILT_IN_UNREACHABLE: case BUILT_IN_VA_START:
if (optimize_unreachable (i)) case BUILT_IN_VA_END:
cfg_changed = true; case BUILT_IN_VA_COPY:
break; /* These shouldn't be folded before pass_stdarg. */
result = optimize_stdarg_builtin (stmt);
if (result)
break;
/* FALLTHRU */
case BUILT_IN_VA_START: default:;
case BUILT_IN_VA_END: }
case BUILT_IN_VA_COPY:
/* These shouldn't be folded before pass_stdarg. */
result = optimize_stdarg_builtin (stmt);
if (result)
break;
/* FALLTHRU */
default: if (!result)
gsi_next (&i); {
continue; gsi_next (&i);
} continue;
}
if (result == NULL_TREE) if (!update_call_from_tree (&i, result))
break; gimplify_and_update_call_from_tree (&i, result);
}
todoflags |= TODO_update_address_taken;
if (dump_file && (dump_flags & TDF_DETAILS)) if (dump_file && (dump_flags & TDF_DETAILS))
{ {
...@@ -2744,12 +2751,6 @@ pass_fold_builtins::execute (function *fun) ...@@ -2744,12 +2751,6 @@ pass_fold_builtins::execute (function *fun)
} }
old_stmt = stmt; old_stmt = stmt;
if (!update_call_from_tree (&i, result))
{
gimplify_and_update_call_from_tree (&i, result);
todoflags |= TODO_update_address_taken;
}
stmt = gsi_stmt (i); stmt = gsi_stmt (i);
update_stmt (stmt); update_stmt (stmt);
......
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