Commit c57ddcf1 by Roger Sayle Committed by Roger Sayle

alias.c (mark_constant_function): Check for constancy and purity even of void functions.


	* alias.c (mark_constant_function):  Check for constancy and
	purity even of void functions.  Update both the function decl
	and the cgraph RTL info with the results.

From-SVN: r65981
parent c1a19acb
2003-04-22 Roger Sayle <roger@eyesopen.com> 2003-04-22 Roger Sayle <roger@eyesopen.com>
* alias.c (mark_constant_function): Check for constancy and
purity even of void functions. Update both the function decl
and the cgraph RTL info with the results.
2003-04-22 Roger Sayle <roger@eyesopen.com>
* real.c (do_add): Change to return a bool indicating that the * real.c (do_add): Change to return a bool indicating that the
result of the operation may be inexact due to loss of precision. result of the operation may be inexact due to loss of precision.
(do_multiply): Likewise. (do_multiply): Likewise.
......
...@@ -2642,7 +2642,7 @@ nonlocal_set_p (x) ...@@ -2642,7 +2642,7 @@ nonlocal_set_p (x)
return for_each_rtx (&x, nonlocal_set_p_1, NULL); return for_each_rtx (&x, nonlocal_set_p_1, NULL);
} }
/* Mark the function if it is constant. */ /* Mark the function if it is pure or constant. */
void void
mark_constant_function () mark_constant_function ()
...@@ -2653,7 +2653,6 @@ mark_constant_function () ...@@ -2653,7 +2653,6 @@ mark_constant_function ()
if (TREE_READONLY (current_function_decl) if (TREE_READONLY (current_function_decl)
|| DECL_IS_PURE (current_function_decl) || DECL_IS_PURE (current_function_decl)
|| TREE_THIS_VOLATILE (current_function_decl) || TREE_THIS_VOLATILE (current_function_decl)
|| TYPE_MODE (TREE_TYPE (current_function_decl)) == VOIDmode
|| current_function_has_nonlocal_goto || current_function_has_nonlocal_goto
|| !(*targetm.binds_local_p) (current_function_decl)) || !(*targetm.binds_local_p) (current_function_decl))
return; return;
...@@ -2688,9 +2687,15 @@ mark_constant_function () ...@@ -2688,9 +2687,15 @@ mark_constant_function ()
if (insn) if (insn)
; ;
else if (nonlocal_memory_referenced) else if (nonlocal_memory_referenced)
cgraph_rtl_info (current_function_decl)->pure_function = 1; {
cgraph_rtl_info (current_function_decl)->pure_function = 1;
DECL_IS_PURE (current_function_decl) = 1;
}
else else
cgraph_rtl_info (current_function_decl)->const_function = 1; {
cgraph_rtl_info (current_function_decl)->const_function = 1;
TREE_READONLY (current_function_decl) = 1;
}
} }
......
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