/* Interprocedural analyses.
- Copyright (C) 2005, 2007, 2008, 2009 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2007, 2008, 2009, 2010
+ Free Software Foundation, Inc.
This file is part of GCC.
{
struct ipa_node_params *info = (struct ipa_node_params *) data;
- if (TREE_CODE (op) == PARM_DECL)
+ op = get_base_address (op);
+ if (op
+ && TREE_CODE (op) == PARM_DECL)
{
int index = ipa_get_param_decl_index (info, op);
gcc_assert (index >= 0);
tree val = jump_func->value.constant;
fprintf (f, "CONST: ");
print_generic_expr (f, val, 0);
+ if (TREE_CODE (val) == ADDR_EXPR
+ && TREE_CODE (TREE_OPERAND (val, 0)) == CONST_DECL)
+ {
+ fprintf (f, " -> ");
+ print_generic_expr (f, DECL_INITIAL (TREE_OPERAND (val, 0)),
+ 0);
+ }
fprintf (f, "\n");
}
else if (type == IPA_JF_CONST_MEMBER_PTR)
struct ipa_param_call_note *note;
basic_block bb = gimple_bb (stmt);
- info->params[formal_id].called = 1;
-
note = XCNEW (struct ipa_param_call_note);
note->formal_id = formal_id;
note->stmt = stmt;
static void
ipa_node_removal_hook (struct cgraph_node *node, void *data ATTRIBUTE_UNUSED)
{
+ /* During IPA-CP updating we can be called on not-yet analyze clones. */
+ if (VEC_length (ipa_node_params_t, ipa_node_params_vector)
+ <= (unsigned)node->uid)
+ return;
ipa_free_node_params_substructures (IPA_NODE_REF (node));
}
: "(unnamed)"));
if (ipa_is_param_modified (info, i))
fprintf (f, " modified");
- if (ipa_is_param_called (info, i))
- fprintf (f, " called");
fprintf (f, "\n");
}
}
if (!useless_type_conversion_p (ptrtype, TREE_TYPE (expr)))
expr = fold_convert (ptrtype, expr);
expr = fold_build2 (POINTER_PLUS_EXPR, ptrtype, expr,
- build_int_cst (size_type_node,
+ build_int_cst (sizetype,
adj->offset / BITS_PER_UNIT));
if (!adj->by_ref)
expr = fold_build1 (INDIRECT_REF, adj->type, expr);
bp = bitpack_create ();
bp_pack_value (bp, info->called_with_var_arguments, 1);
+ bp_pack_value (bp, info->uses_analysis_done, 1);
gcc_assert (info->modification_analysis_done
|| ipa_get_param_count (info) == 0);
- gcc_assert (info->uses_analysis_done || ipa_get_param_count (info) == 0);
gcc_assert (!info->node_enqueued);
gcc_assert (!info->ipcp_orig_node);
for (j = 0; j < ipa_get_param_count (info); j++)
- {
- bp_pack_value (bp, info->params[j].modified, 1);
- bp_pack_value (bp, info->params[j].called, 1);
- }
+ bp_pack_value (bp, info->params[j].modified, 1);
lto_output_bitpack (ob->main_stream, bp);
bitpack_delete (bp);
for (e = node->callees; e; e = e->next_callee)
bp = lto_input_bitpack (ib);
info->called_with_var_arguments = bp_unpack_value (bp, 1);
+ info->uses_analysis_done = bp_unpack_value (bp, 1);
if (ipa_get_param_count (info) != 0)
{
info->modification_analysis_done = true;
}
info->node_enqueued = false;
for (k = 0; k < ipa_get_param_count (info); k++)
- {
- info->params[k].modified = bp_unpack_value (bp, 1);
- info->params[k].called = bp_unpack_value (bp, 1);
- }
+ info->params[k].modified = bp_unpack_value (bp, 1);
bitpack_delete (bp);
for (e = node->callees; e; e = e->next_callee)
{
ipa_check_create_edge_args ();
for (node = cgraph_nodes; node; node = node->next)
- {
- if (!node->analyzed)
- continue;
+ if (node->analyzed)
ipa_initialize_node_params (node);
+
+ for (node = cgraph_nodes; node; node = node->next)
+ if (node->analyzed)
for (cs = node->callees; cs; cs = cs->next_callee)
{
if (ipa_get_cs_argument_count (IPA_EDGE_REF (cs))
!= ipa_get_param_count (IPA_NODE_REF (cs->callee)))
ipa_set_called_with_variable_arg (IPA_NODE_REF (cs->callee));
}
- }
}
/* Walk param call notes of NODE and set their call statements given the uid