This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH]: CALL_EXPR should set TREE_SIDE_EFFECTS
On 25 Aug 2003 10:50:11 -0700, Mark Mitchell <mark@codesourcery.com> wrote:
> I hate to ask you to go around on this yet again, but how about building
> the node and then using "get_callee_fndecl"? (And then doing the tests
> for const/pure?)
A call through a pointer can also be const if the pointer has the right
type. There's a useful function on the tree-ssa branch that could move
onto the trunk:
/* Return flags associated with the function called by T (see ECF_* in
rtl.h) */
int
call_expr_flags (tree t)
{
int flags;
tree decl = get_callee_fndecl (t);
if (decl)
flags = flags_from_decl_or_type (decl);
else
{
t = TREE_OPERAND (t, 0);
flags = flags_from_decl_or_type (TREE_TYPE (TREE_TYPE (t)));
}
return flags;
}
And then you test for ECF_CONST|ECF_PURE.
Jason