gimple.h (gimple_call_fntype): New function.
2011-04-08 Richard Guenther <rguenther@suse.de> * gimple.h (gimple_call_fntype): New function. (gimple_call_return_type): Use it. * expr.c (expand_expr_real_1): Use gimple_call_fntype. * gimple-low.c (gimple_check_call_args): Likewise. * gimple.c (gimple_call_flags): Likewise. (gimple_call_arg_flags): Likewise. (gimple_call_return_flags): Likewise. * tree-cfg.c (verify_gimple_call): Likewise. (do_warn_unused_result): Likewise. * tree-ssa-ccp.c (ccp_fold_stmt): Likewise. * value-prof.c (gimple_ic_transform): Fix fndecl check. From-SVN: r172178
This commit is contained in:
parent
7c1f0b4020
commit
9bfc434b7a
|
@ -1,3 +1,17 @@
|
|||
2011-04-08 Richard Guenther <rguenther@suse.de>
|
||||
|
||||
* gimple.h (gimple_call_fntype): New function.
|
||||
(gimple_call_return_type): Use it.
|
||||
* expr.c (expand_expr_real_1): Use gimple_call_fntype.
|
||||
* gimple-low.c (gimple_check_call_args): Likewise.
|
||||
* gimple.c (gimple_call_flags): Likewise.
|
||||
(gimple_call_arg_flags): Likewise.
|
||||
(gimple_call_return_flags): Likewise.
|
||||
* tree-cfg.c (verify_gimple_call): Likewise.
|
||||
(do_warn_unused_result): Likewise.
|
||||
* tree-ssa-ccp.c (ccp_fold_stmt): Likewise.
|
||||
* value-prof.c (gimple_ic_transform): Fix fndecl check.
|
||||
|
||||
2011-04-08 Dmitry Melnik <dm@ispras.ru>
|
||||
|
||||
PR rtl-optimization/48235
|
||||
|
|
|
@ -8533,8 +8533,7 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
|
|||
&& (g = SSA_NAME_DEF_STMT (ssa_name))
|
||||
&& gimple_code (g) == GIMPLE_CALL)
|
||||
pmode = promote_function_mode (type, mode, &unsignedp,
|
||||
TREE_TYPE
|
||||
(TREE_TYPE (gimple_call_fn (g))),
|
||||
gimple_call_fntype (g),
|
||||
2);
|
||||
else
|
||||
pmode = promote_decl_mode (exp, &unsignedp);
|
||||
|
|
|
@ -222,11 +222,10 @@ gimple_check_call_args (gimple stmt)
|
|||
|
||||
/* Get argument types for verification. */
|
||||
fndecl = gimple_call_fndecl (stmt);
|
||||
parms = NULL_TREE;
|
||||
if (fndecl)
|
||||
parms = TYPE_ARG_TYPES (TREE_TYPE (fndecl));
|
||||
else if (POINTER_TYPE_P (TREE_TYPE (gimple_call_fn (stmt))))
|
||||
parms = TYPE_ARG_TYPES (TREE_TYPE (TREE_TYPE (gimple_call_fn (stmt))));
|
||||
else
|
||||
parms = TYPE_ARG_TYPES (gimple_call_fntype (stmt));
|
||||
|
||||
/* Verify if the type of the argument matches that of the function
|
||||
declaration. If we cannot verify this or there is a mismatch,
|
||||
|
|
14
gcc/gimple.c
14
gcc/gimple.c
|
@ -1780,15 +1780,17 @@ gimple_call_flags (const_gimple stmt)
|
|||
{
|
||||
int flags;
|
||||
tree decl = gimple_call_fndecl (stmt);
|
||||
tree t;
|
||||
|
||||
if (decl)
|
||||
flags = flags_from_decl_or_type (decl);
|
||||
else
|
||||
{
|
||||
t = TREE_TYPE (gimple_call_fn (stmt));
|
||||
if (t && TREE_CODE (t) == POINTER_TYPE)
|
||||
flags = flags_from_decl_or_type (TREE_TYPE (t));
|
||||
tree t = TREE_TYPE (gimple_call_fn (stmt));
|
||||
/* ??? We can end up being called from gimple_set_modified from
|
||||
gsi_remove in which case the function being called can
|
||||
be a released SSA name. Give up in that case. */
|
||||
if (t)
|
||||
flags = flags_from_decl_or_type (gimple_call_fntype (stmt));
|
||||
else
|
||||
flags = 0;
|
||||
}
|
||||
|
@ -1804,7 +1806,7 @@ gimple_call_flags (const_gimple stmt)
|
|||
int
|
||||
gimple_call_arg_flags (const_gimple stmt, unsigned arg)
|
||||
{
|
||||
tree type = TREE_TYPE (TREE_TYPE (gimple_call_fn (stmt)));
|
||||
tree type = gimple_call_fntype (stmt);
|
||||
tree attr = lookup_attribute ("fn spec", TYPE_ATTRIBUTES (type));
|
||||
if (!attr)
|
||||
return 0;
|
||||
|
@ -1848,7 +1850,7 @@ gimple_call_return_flags (const_gimple stmt)
|
|||
if (gimple_call_flags (stmt) & ECF_MALLOC)
|
||||
return ERF_NOALIAS;
|
||||
|
||||
type = TREE_TYPE (TREE_TYPE (gimple_call_fn (stmt)));
|
||||
type = gimple_call_fntype (stmt);
|
||||
attr = lookup_attribute ("fn spec", TYPE_ATTRIBUTES (type));
|
||||
if (!attr)
|
||||
return 0;
|
||||
|
|
15
gcc/gimple.h
15
gcc/gimple.h
|
@ -2011,6 +2011,13 @@ gimple_call_fn (const_gimple gs)
|
|||
return gimple_op (gs, 1);
|
||||
}
|
||||
|
||||
/* Return the function type of the function called by GS. */
|
||||
|
||||
static inline tree
|
||||
gimple_call_fntype (const_gimple gs)
|
||||
{
|
||||
return TREE_TYPE (TREE_TYPE (gimple_call_fn (gs)));
|
||||
}
|
||||
|
||||
/* Return a pointer to the tree node representing the function called by call
|
||||
statement GS. */
|
||||
|
@ -2073,13 +2080,9 @@ gimple_call_fndecl (const_gimple gs)
|
|||
static inline tree
|
||||
gimple_call_return_type (const_gimple gs)
|
||||
{
|
||||
tree fn = gimple_call_fn (gs);
|
||||
tree type = TREE_TYPE (fn);
|
||||
tree type = gimple_call_fntype (gs);
|
||||
|
||||
/* See through the pointer. */
|
||||
type = TREE_TYPE (type);
|
||||
|
||||
/* The type returned by a FUNCTION_DECL is the type of its
|
||||
/* The type returned by a function is the type of its
|
||||
function type. */
|
||||
return TREE_TYPE (type);
|
||||
}
|
||||
|
|
|
@ -3086,7 +3086,7 @@ verify_gimple_call (gimple stmt)
|
|||
return true;
|
||||
}
|
||||
|
||||
fntype = TREE_TYPE (TREE_TYPE (fn));
|
||||
fntype = gimple_call_fntype (stmt);
|
||||
if (gimple_call_lhs (stmt)
|
||||
&& !useless_type_conversion_p (TREE_TYPE (gimple_call_lhs (stmt)),
|
||||
TREE_TYPE (fntype))
|
||||
|
@ -7441,7 +7441,7 @@ do_warn_unused_result (gimple_seq seq)
|
|||
LHS. All calls whose value is ignored should be
|
||||
represented like this. Look for the attribute. */
|
||||
fdecl = gimple_call_fndecl (g);
|
||||
ftype = TREE_TYPE (TREE_TYPE (gimple_call_fn (g)));
|
||||
ftype = gimple_call_fntype (g);
|
||||
|
||||
if (lookup_attribute ("warn_unused_result", TYPE_ATTRIBUTES (ftype)))
|
||||
{
|
||||
|
|
|
@ -1727,7 +1727,7 @@ ccp_fold_stmt (gimple_stmt_iterator *gsi)
|
|||
this can use the argument slot types for type verification
|
||||
instead of the current argument type. We also can safely
|
||||
drop qualifiers here as we are dealing with constants anyway. */
|
||||
argt = TYPE_ARG_TYPES (TREE_TYPE (TREE_TYPE (gimple_call_fn (stmt))));
|
||||
argt = TYPE_ARG_TYPES (gimple_call_fntype (stmt));
|
||||
for (i = 0; i < gimple_call_num_args (stmt) && argt;
|
||||
++i, argt = TREE_CHAIN (argt))
|
||||
{
|
||||
|
|
|
@ -1230,16 +1230,13 @@ gimple_ic_transform (gimple stmt)
|
|||
histogram_value histogram;
|
||||
gcov_type val, count, all, bb_all;
|
||||
gcov_type prob;
|
||||
tree callee;
|
||||
gimple modify;
|
||||
struct cgraph_node *direct_call;
|
||||
|
||||
if (gimple_code (stmt) != GIMPLE_CALL)
|
||||
return false;
|
||||
|
||||
callee = gimple_call_fn (stmt);
|
||||
|
||||
if (TREE_CODE (callee) == FUNCTION_DECL)
|
||||
if (gimple_call_fndecl (stmt) != NULL_TREE)
|
||||
return false;
|
||||
|
||||
histogram = gimple_histogram_value_of_type (cfun, stmt, HIST_TYPE_INDIR_CALL);
|
||||
|
|
Loading…
Reference in New Issue