/* Tree inlining.
- Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
- Free Software Foundation, Inc.
+ Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
+ 2012 Free Software Foundation, Inc.
Contributed by Alexandre Oliva <aoliva@redhat.com>
This file is part of GCC.
|| decl_function_context (*tp) == id->src_fn))
/* These may need to be remapped for EH handling. */
*tp = remap_decl (*tp, id);
+ else if (TREE_CODE (*tp) == FIELD_DECL)
+ {
+ /* If the enclosing record type is variably_modified_type_p, the field
+ has already been remapped. Otherwise, it need not be. */
+ tree *n = (tree *) pointer_map_contains (id->decl_map, *tp);
+ if (n)
+ *tp = *n;
+ *walk_subtrees = 0;
+ }
else if (TYPE_P (*tp))
/* Types may need remapping as well. */
*tp = remap_type (*tp, id);
ptr, TREE_OPERAND (*tp, 1));
TREE_THIS_NOTRAP (*tp) = TREE_THIS_NOTRAP (old);
TREE_THIS_VOLATILE (*tp) = TREE_THIS_VOLATILE (old);
+ TREE_SIDE_EFFECTS (*tp) = TREE_SIDE_EFFECTS (old);
TREE_NO_WARNING (*tp) = TREE_NO_WARNING (old);
*walk_subtrees = 0;
return NULL;
/* Make gimplifier happy about this variable. */
DECL_SEEN_IN_BIND_EXPR_P (var) = 1;
+ /* We are eventually using the value - make sure all variables
+ referenced therein are properly recorded. */
+ if (value
+ && gimple_in_ssa_p (cfun)
+ && TREE_CODE (value) == ADDR_EXPR)
+ {
+ tree base = get_base_address (TREE_OPERAND (value, 0));
+ if (base && TREE_CODE (base) == VAR_DECL)
+ add_referenced_var (base);
+ }
+
/* If the parameter is never assigned to, has no SSA_NAMEs created,
we would not need to create a new variable here at all, if it
weren't for debug info. Still, we can just use the argument
if (gimple_in_ssa_p (id->src_cfun))
add_referenced_var (temp);
insert_decl_map (id, result, temp);
- /* When RESULT_DECL is in SSA form, we need to use it's default_def
- SSA_NAME. */
- if (gimple_in_ssa_p (id->src_cfun) && gimple_default_def (id->src_cfun, result))
- temp = remap_ssa_name (gimple_default_def (id->src_cfun, result), id);
+ /* When RESULT_DECL is in SSA form, we need to remap and initialize
+ it's default_def SSA_NAME. */
+ if (gimple_in_ssa_p (id->src_cfun)
+ && is_gimple_reg (result))
+ {
+ temp = make_ssa_name (temp, NULL);
+ insert_decl_map (id, gimple_default_def (id->src_cfun, result),
+ temp);
+ }
insert_init_stmt (id, entry_bb, gimple_build_assign (temp, var));
}
else
goto egress;
if (lookup_attribute ("always_inline", DECL_ATTRIBUTES (fn))
+ /* For extern inline functions that get redefined we always
+ silently ignored always_inline flag. Better behaviour would
+ be to be able to keep both bodies and use extern inline body
+ for inlining, but we can't do that because frontends overwrite
+ the body. */
+ && !cg_edge->callee->local.redefined_extern_inline
/* Avoid warnings during early inline pass. */
&& cgraph_global_info_ready
/* PR 20090218-1_0.c. Body can be provided by another module. */
/* Add local vars. */
add_local_variables (DECL_STRUCT_FUNCTION (old_decl), cfun, &id, false);
- if (VOID_TYPE_P (TREE_TYPE (DECL_RESULT (old_decl))))
+ if (DECL_RESULT (old_decl) == NULL_TREE)
;
- else if (skip_return)
+ else if (skip_return && !VOID_TYPE_P (TREE_TYPE (DECL_RESULT (old_decl))))
{
DECL_RESULT (new_decl)
= build_decl (DECL_SOURCE_LOCATION (DECL_RESULT (old_decl)),