public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Symbol table 8/many: ipa-ref API reorg
@ 2012-04-18  8:23 Jan Hubicka
  0 siblings, 0 replies; only message in thread
From: Jan Hubicka @ 2012-04-18  8:23 UTC (permalink / raw)
  To: gcc-patches

Hi,
this patch reorgs ipa-ref API for the new object scheme removing types of references
and updating functions working on both functions and variables.

Bootstrapped/regtested x86_64-linux. Will commit it shortly.

Honza

	* lto-symtab.c (lto_cgraph_replace_node): Update.
	* cgraphbuild.c (record_reference, record_type_list,
	record_eh_tables, mark_address, mark_load, mark_store): Update.
	* cgraph.c (cgraph_same_body_alias, dump_cgraph_node,
	cgraph_create_virtual_clone, cgraph_for_node_thunks_and_aliases):
	Update.
	* cgraph.h (symtab_node_def, symtab_node, const_symtab_node): Remove.
	(cgraph_alias_aliased_node, varpool_alias_aliased_node): Update.
	* reload.c: Fix typo in comment.
	* rtlanal.c: Likewise.
	* tree-emultls.c (gen_emutls_addr): Update.
	* ipa-reference.c (analyze_function): Update.
	* cgraphunit.c (cgraph_analyze_function,
	cgraph_process_same_body_aliases, assemble_thunks_and_aliases):
	Update.
	* ipa-ref.c (ipa_record_reference): Reorg to avoid reference types.
	(ipa_remove_reference): Likewise.
	(ipa_remove_all_refering): Rename to ...
	(ipa_remove_all_referring): ... this one; update.
	(ipa_dump_references): Update.
	(ipa_dump_referring): Update.
	(ipa_clone_references): Update.
	(ipa_clone_refering): Rename to ...
	(ipa_clone_referring): ... this one; update.
	(ipa_ref_cannot_lead_to_return): Update.
	(ipa_ref_has_aliases_p): Update.
	* ipa-ref.h (symtab_node_def, symtab_node, const_symtab_node): New
	forward typedefs.
	(ipa_ref_type): Remove.
	(ipa_ref_ptr_u): Remove.
	(ipa_ref): Remove referencing, refered, refered_index, refering_type
	and refered_type; add referring, referred and referred_index.
	(ipa_ref_list): Rename refering to referring.
	(ipa_record_reference, ipa_remove_all_referring, ipa_dump_referring,
	ipa_clone_references, ipa_clone_referring): Update prototypes.
	* lto-cgraph.c (referenced_from_other_partition_p): Update.
	(lto_output_ref): Update.
	(add_references): Update.
	(input_varpool_node): Update.
	(input_refs): Update.
	* ipa-ref-inline.h (ipa_ref_node): Update.
	(ipa_ref_varpool_node): Update.
	(ipa_ref_referring_node); Update.
	(ipa_ref_referring_varpool_node): Update.
	(ipa_ref_referring_ref_list); Update.
	(ipa_ref_referred_ref_list): Update.
	(ipa_ref_list_first_referring): Update.
	(ipa_empty_ref_list): Update.
	(ipa_ref_list_refering_iterate): Rename to ...
	(ipa_ref_list_referring_iterate): ... this one.
	* cse.c: Update comment.
	* ipa-utils.c (ipa_reverse_postorder): Update.
	* tree-ssa-alias.c: Update.
	* ipa-inline.c (reset_edge_caches): Update.
	(update_caller_keys): Update.
	* ipa-inline.h: Update comments.
	* jump.c: Update comment.
	* alias.c: Likewise.
	* ipa.c (process_references): Update.
	(cgraph_remove_unreachable_nodes): Likewise.
	(ipa_discover_readonly_nonaddressable_var): Likewise.
	(cgraph_address_taken_from_non_vtable_p): Likewise.
	* trans-mem.c (ipa_tm_execute): Update.
	* simplify-rtx.c: Fix comment.
	* rtl.c: Fix comment.
	* symtab.c (symtab_unregister_node): Update.
	* varpool.c (dump_varpool_node): Update.
	(varpool_analyze_pending_decls): Update.
	(assemble_aliases): Update.
	(varpool_for_node_and_aliases

	* partitionc.c (add_references_to_partition, lto_balanced_map):
	Update for new ipa-ref API.
Index: lto-symtab.c
===================================================================
*** lto-symtab.c	(revision 186558)
--- lto-symtab.c	(working copy)
*************** lto_cgraph_replace_node (struct cgraph_n
*** 249,255 ****
  	e->call_stmt_cannot_inline_p = 1;
      }
    /* Redirect incomming references.  */
!   ipa_clone_refering (prevailing_node, NULL, &node->symbol.ref_list);
  
    /* Finally remove the replaced node.  */
    cgraph_remove_node (node);
--- 249,255 ----
  	e->call_stmt_cannot_inline_p = 1;
      }
    /* Redirect incomming references.  */
!   ipa_clone_referring ((symtab_node)prevailing_node, &node->symbol.ref_list);
  
    /* Finally remove the replaced node.  */
    cgraph_remove_node (node);
*************** lto_varpool_replace_node (struct varpool
*** 271,277 ****
    gcc_assert (!vnode->finalized || prevailing_node->finalized);
    gcc_assert (!vnode->analyzed || prevailing_node->analyzed);
  
!   ipa_clone_refering (NULL, prevailing_node, &vnode->symbol.ref_list);
  
    /* Be sure we can garbage collect the initializer.  */
    if (DECL_INITIAL (vnode->symbol.decl))
--- 271,277 ----
    gcc_assert (!vnode->finalized || prevailing_node->finalized);
    gcc_assert (!vnode->analyzed || prevailing_node->analyzed);
  
!   ipa_clone_referring ((symtab_node)prevailing_node, &vnode->symbol.ref_list);
  
    /* Be sure we can garbage collect the initializer.  */
    if (DECL_INITIAL (vnode->symbol.decl))
Index: cgraphbuild.c
===================================================================
*** cgraphbuild.c	(revision 186558)
--- cgraphbuild.c	(working copy)
*************** record_reference (tree *tp, int *walk_su
*** 77,83 ****
  	  struct cgraph_node *node = cgraph_get_create_node (decl);
  	  if (!ctx->only_vars)
  	    cgraph_mark_address_taken_node (node);
! 	  ipa_record_reference (NULL, ctx->varpool_node, node, NULL,
  			        IPA_REF_ADDR, NULL);
  	}
  
--- 77,84 ----
  	  struct cgraph_node *node = cgraph_get_create_node (decl);
  	  if (!ctx->only_vars)
  	    cgraph_mark_address_taken_node (node);
! 	  ipa_record_reference ((symtab_node)ctx->varpool_node,
! 				(symtab_node)node,
  			        IPA_REF_ADDR, NULL);
  	}
  
*************** record_reference (tree *tp, int *walk_su
*** 87,94 ****
  	  if (lang_hooks.callgraph.analyze_expr)
  	    lang_hooks.callgraph.analyze_expr (&decl, walk_subtrees);
  	  varpool_mark_needed_node (vnode);
! 	  ipa_record_reference (NULL, ctx->varpool_node,
! 				NULL, vnode,
  				IPA_REF_ADDR, NULL);
  	}
        *walk_subtrees = 0;
--- 88,95 ----
  	  if (lang_hooks.callgraph.analyze_expr)
  	    lang_hooks.callgraph.analyze_expr (&decl, walk_subtrees);
  	  varpool_mark_needed_node (vnode);
! 	  ipa_record_reference ((symtab_node)ctx->varpool_node,
! 				(symtab_node)vnode,
  				IPA_REF_ADDR, NULL);
  	}
        *walk_subtrees = 0;
*************** record_type_list (struct cgraph_node *no
*** 130,137 ****
  	    {
  	      struct varpool_node *vnode = varpool_node (type);
  	      varpool_mark_needed_node (vnode);
! 	      ipa_record_reference (node, NULL,
! 				    NULL, vnode,
  				    IPA_REF_ADDR, NULL);
  	    }
  	}
--- 131,138 ----
  	    {
  	      struct varpool_node *vnode = varpool_node (type);
  	      varpool_mark_needed_node (vnode);
! 	      ipa_record_reference ((symtab_node)node,
! 				    (symtab_node)vnode,
  				    IPA_REF_ADDR, NULL);
  	    }
  	}
*************** record_eh_tables (struct cgraph_node *no
*** 151,157 ****
        struct cgraph_node *per_node;
  
        per_node = cgraph_get_create_node (DECL_FUNCTION_PERSONALITY (node->symbol.decl));
!       ipa_record_reference (node, NULL, per_node, NULL, IPA_REF_ADDR, NULL);
        cgraph_mark_address_taken_node (per_node);
      }
  
--- 152,158 ----
        struct cgraph_node *per_node;
  
        per_node = cgraph_get_create_node (DECL_FUNCTION_PERSONALITY (node->symbol.decl));
!       ipa_record_reference ((symtab_node)node, (symtab_node)per_node, IPA_REF_ADDR, NULL);
        cgraph_mark_address_taken_node (per_node);
      }
  
*************** mark_address (gimple stmt, tree addr, vo
*** 232,239 ****
      {
        struct cgraph_node *node = cgraph_get_create_node (addr);
        cgraph_mark_address_taken_node (node);
!       ipa_record_reference ((struct cgraph_node *)data, NULL,
! 			    node, NULL,
  			    IPA_REF_ADDR, stmt);
      }
    else if (addr && TREE_CODE (addr) == VAR_DECL
--- 233,240 ----
      {
        struct cgraph_node *node = cgraph_get_create_node (addr);
        cgraph_mark_address_taken_node (node);
!       ipa_record_reference ((symtab_node)data,
! 			    (symtab_node)node,
  			    IPA_REF_ADDR, stmt);
      }
    else if (addr && TREE_CODE (addr) == VAR_DECL
*************** mark_address (gimple stmt, tree addr, vo
*** 245,252 ****
        if (lang_hooks.callgraph.analyze_expr)
  	lang_hooks.callgraph.analyze_expr (&addr, &walk_subtrees);
        varpool_mark_needed_node (vnode);
!       ipa_record_reference ((struct cgraph_node *)data, NULL,
! 			    NULL, vnode,
  			    IPA_REF_ADDR, stmt);
      }
  
--- 246,253 ----
        if (lang_hooks.callgraph.analyze_expr)
  	lang_hooks.callgraph.analyze_expr (&addr, &walk_subtrees);
        varpool_mark_needed_node (vnode);
!       ipa_record_reference ((symtab_node)data,
! 			    (symtab_node)vnode,
  			    IPA_REF_ADDR, stmt);
      }
  
*************** mark_load (gimple stmt, tree t, void *da
*** 265,272 ****
  	 directly manipulated in the code.  Pretend that it's an address.  */
        struct cgraph_node *node = cgraph_get_create_node (t);
        cgraph_mark_address_taken_node (node);
!       ipa_record_reference ((struct cgraph_node *)data, NULL,
! 			    node, NULL,
  			    IPA_REF_ADDR, stmt);
      }
    else if (t && TREE_CODE (t) == VAR_DECL
--- 266,273 ----
  	 directly manipulated in the code.  Pretend that it's an address.  */
        struct cgraph_node *node = cgraph_get_create_node (t);
        cgraph_mark_address_taken_node (node);
!       ipa_record_reference ((symtab_node)data,
! 			    (symtab_node)node,
  			    IPA_REF_ADDR, stmt);
      }
    else if (t && TREE_CODE (t) == VAR_DECL
*************** mark_load (gimple stmt, tree t, void *da
*** 278,285 ****
        if (lang_hooks.callgraph.analyze_expr)
  	lang_hooks.callgraph.analyze_expr (&t, &walk_subtrees);
        varpool_mark_needed_node (vnode);
!       ipa_record_reference ((struct cgraph_node *)data, NULL,
! 			    NULL, vnode,
  			    IPA_REF_LOAD, stmt);
      }
    return false;
--- 279,286 ----
        if (lang_hooks.callgraph.analyze_expr)
  	lang_hooks.callgraph.analyze_expr (&t, &walk_subtrees);
        varpool_mark_needed_node (vnode);
!       ipa_record_reference ((symtab_node)data,
! 			    (symtab_node)vnode,
  			    IPA_REF_LOAD, stmt);
      }
    return false;
*************** mark_store (gimple stmt, tree t, void *d
*** 300,307 ****
        if (lang_hooks.callgraph.analyze_expr)
  	lang_hooks.callgraph.analyze_expr (&t, &walk_subtrees);
        varpool_mark_needed_node (vnode);
!       ipa_record_reference ((struct cgraph_node *)data, NULL,
! 			    NULL, vnode,
  			    IPA_REF_STORE, stmt);
       }
    return false;
--- 301,308 ----
        if (lang_hooks.callgraph.analyze_expr)
  	lang_hooks.callgraph.analyze_expr (&t, &walk_subtrees);
        varpool_mark_needed_node (vnode);
!       ipa_record_reference ((symtab_node)data,
! 			    (symtab_node)vnode,
  			    IPA_REF_STORE, stmt);
       }
    return false;
*************** build_cgraph_edges (void)
*** 348,366 ****
  	      && gimple_omp_parallel_child_fn (stmt))
  	    {
  	      tree fn = gimple_omp_parallel_child_fn (stmt);
! 	      ipa_record_reference (node, NULL, cgraph_get_create_node (fn),
! 				    NULL, IPA_REF_ADDR, stmt);
  	    }
  	  if (gimple_code (stmt) == GIMPLE_OMP_TASK)
  	    {
  	      tree fn = gimple_omp_task_child_fn (stmt);
  	      if (fn)
! 		ipa_record_reference (node, NULL, cgraph_get_create_node (fn),
! 				      NULL, IPA_REF_ADDR, stmt);
  	      fn = gimple_omp_task_copy_fn (stmt);
  	      if (fn)
! 		ipa_record_reference (node, NULL, cgraph_get_create_node (fn),
! 				      NULL, IPA_REF_ADDR, stmt);
  	    }
  	}
        for (gsi = gsi_start (phi_nodes (bb)); !gsi_end_p (gsi); gsi_next (&gsi))
--- 349,370 ----
  	      && gimple_omp_parallel_child_fn (stmt))
  	    {
  	      tree fn = gimple_omp_parallel_child_fn (stmt);
! 	      ipa_record_reference ((symtab_node)node,
! 				    (symtab_node)cgraph_get_create_node (fn),
! 				    IPA_REF_ADDR, stmt);
  	    }
  	  if (gimple_code (stmt) == GIMPLE_OMP_TASK)
  	    {
  	      tree fn = gimple_omp_task_child_fn (stmt);
  	      if (fn)
! 		ipa_record_reference ((symtab_node)node,
! 				      (symtab_node) cgraph_get_create_node (fn),
! 				      IPA_REF_ADDR, stmt);
  	      fn = gimple_omp_task_copy_fn (stmt);
  	      if (fn)
! 		ipa_record_reference ((symtab_node)node,
! 				      (symtab_node)cgraph_get_create_node (fn),
! 				      IPA_REF_ADDR, stmt);
  	    }
  	}
        for (gsi = gsi_start (phi_nodes (bb)); !gsi_end_p (gsi); gsi_next (&gsi))
Index: cgraph.c
===================================================================
*** cgraph.c	(revision 186559)
--- cgraph.c	(working copy)
*************** cgraph_same_body_alias (struct cgraph_no
*** 528,535 ****
    n = cgraph_create_function_alias (alias, decl);
    n->same_body_alias = true;
    if (same_body_aliases_done)
!     ipa_record_reference (n, NULL, cgraph_get_node (decl), NULL, IPA_REF_ALIAS,
! 			  NULL);
    return n;
  }
  
--- 528,535 ----
    n = cgraph_create_function_alias (alias, decl);
    n->same_body_alias = true;
    if (same_body_aliases_done)
!     ipa_record_reference ((symtab_node)n, (symtab_node)cgraph_get_node (decl),
! 			  IPA_REF_ALIAS, NULL);
    return n;
  }
  
*************** cgraph_clone_node (struct cgraph_node *n
*** 1927,1933 ****
    for (e = n->indirect_calls; e; e = e->next_callee)
      cgraph_clone_edge (e, new_node, e->call_stmt, e->lto_stmt_uid,
  		       count_scale, freq, update_original);
!   ipa_clone_references (new_node, NULL, &n->symbol.ref_list);
  
    new_node->next_sibling_clone = n->clones;
    if (n->clones)
--- 1927,1933 ----
    for (e = n->indirect_calls; e; e = e->next_callee)
      cgraph_clone_edge (e, new_node, e->call_stmt, e->lto_stmt_uid,
  		       count_scale, freq, update_original);
!   ipa_clone_references ((symtab_node)new_node, &n->symbol.ref_list);
  
    new_node->next_sibling_clone = n->clones;
    if (n->clones)
*************** cgraph_create_virtual_clone (struct cgra
*** 2023,2028 ****
--- 2023,2029 ----
    FOR_EACH_VEC_ELT (ipa_replace_map_p, tree_map, i, map)
      {
        tree var = map->new_tree;
+       symtab_node ref_node;
  
        STRIP_NOPS (var);
        if (TREE_CODE (var) != ADDR_EXPR)
*************** cgraph_create_virtual_clone (struct cgra
*** 2030,2048 ****
        var = get_base_var (var);
        if (!var)
  	continue;
  
        /* Record references of the future statement initializing the constant
  	 argument.  */
!       if (TREE_CODE (var) == FUNCTION_DECL)
! 	{
! 	  struct cgraph_node *ref_node = cgraph_get_node (var);
! 	  gcc_checking_assert (ref_node);
! 	  ipa_record_reference (new_node, NULL, ref_node, NULL, IPA_REF_ADDR,
! 				NULL);
! 	}
!       else if (TREE_CODE (var) == VAR_DECL)
! 	ipa_record_reference (new_node, NULL, NULL, varpool_node (var),
! 			      IPA_REF_ADDR, NULL);
      }
    if (!args_to_skip)
      new_node->clone.combined_args_to_skip = old_node->clone.combined_args_to_skip;
--- 2031,2046 ----
        var = get_base_var (var);
        if (!var)
  	continue;
+       if (TREE_CODE (var) != FUNCTION_DECL
+ 	  && TREE_CODE (var) != VAR_DECL)
+ 	continue;
  
        /* Record references of the future statement initializing the constant
  	 argument.  */
!       ref_node = symtab_get_node (var);
!       gcc_checking_assert (ref_node);
!       ipa_record_reference ((symtab_node)new_node, (symtab_node)ref_node,
! 			    IPA_REF_ADDR, NULL);
      }
    if (!args_to_skip)
      new_node->clone.combined_args_to_skip = old_node->clone.combined_args_to_skip;
*************** cgraph_for_node_thunks_and_aliases (stru
*** 2249,2258 ****
        if (cgraph_for_node_thunks_and_aliases (e->caller, callback, data,
  					      include_overwritable))
  	return true;
!   for (i = 0; ipa_ref_list_refering_iterate (&node->symbol.ref_list, i, ref); i++)
      if (ref->use == IPA_REF_ALIAS)
        {
! 	struct cgraph_node *alias = ipa_ref_refering_node (ref);
  	if (include_overwritable
  	    || cgraph_function_body_availability (alias) > AVAIL_OVERWRITABLE)
  	  if (cgraph_for_node_thunks_and_aliases (alias, callback, data,
--- 2247,2256 ----
        if (cgraph_for_node_thunks_and_aliases (e->caller, callback, data,
  					      include_overwritable))
  	return true;
!   for (i = 0; ipa_ref_list_referring_iterate (&node->symbol.ref_list, i, ref); i++)
      if (ref->use == IPA_REF_ALIAS)
        {
! 	struct cgraph_node *alias = ipa_ref_referring_node (ref);
  	if (include_overwritable
  	    || cgraph_function_body_availability (alias) > AVAIL_OVERWRITABLE)
  	  if (cgraph_for_node_thunks_and_aliases (alias, callback, data,
*************** cgraph_for_node_and_aliases (struct cgra
*** 2277,2286 ****
  
    if (callback (node, data))
      return true;
!   for (i = 0; ipa_ref_list_refering_iterate (&node->symbol.ref_list, i, ref); i++)
      if (ref->use == IPA_REF_ALIAS)
        {
! 	struct cgraph_node *alias = ipa_ref_refering_node (ref);
  	if (include_overwritable
  	    || cgraph_function_body_availability (alias) > AVAIL_OVERWRITABLE)
            if (cgraph_for_node_and_aliases (alias, callback, data,
--- 2275,2284 ----
  
    if (callback (node, data))
      return true;
!   for (i = 0; ipa_ref_list_referring_iterate (&node->symbol.ref_list, i, ref); i++)
      if (ref->use == IPA_REF_ALIAS)
        {
! 	struct cgraph_node *alias = ipa_ref_referring_node (ref);
  	if (include_overwritable
  	    || cgraph_function_body_availability (alias) > AVAIL_OVERWRITABLE)
            if (cgraph_for_node_and_aliases (alias, callback, data,
Index: cgraph.h
===================================================================
*** cgraph.h	(revision 186559)
--- cgraph.h	(working copy)
*************** enum symtab_type
*** 38,47 ****
    SYMTAB_VARIABLE
  };
  
- union symtab_node_def;
- typedef union symtab_node_def *symtab_node;
- typedef const union symtab_node_def *const_symtab_node;
- 
  /* Base of all entries in the symbol table.
     The symtab_node is inherited by cgraph and varpol nodes.  */
  struct GTY(()) symtab_node_base
--- 38,43 ----
*************** cgraph_alias_aliased_node (struct cgraph
*** 1166,1172 ****
  
    ipa_ref_list_reference_iterate (&n->symbol.ref_list, 0, ref);
    gcc_checking_assert (ref->use == IPA_REF_ALIAS);
!   if (ref->refered_type == IPA_REF_CGRAPH)
      return ipa_ref_node (ref);
    return NULL;
  }
--- 1162,1168 ----
  
    ipa_ref_list_reference_iterate (&n->symbol.ref_list, 0, ref);
    gcc_checking_assert (ref->use == IPA_REF_ALIAS);
!   if (symtab_function_p (ref->referred))
      return ipa_ref_node (ref);
    return NULL;
  }
*************** varpool_alias_aliased_node (struct varpo
*** 1180,1186 ****
  
    ipa_ref_list_reference_iterate (&n->symbol.ref_list, 0, ref);
    gcc_checking_assert (ref->use == IPA_REF_ALIAS);
!   if (ref->refered_type == IPA_REF_VARPOOL)
      return ipa_ref_varpool_node (ref);
    return NULL;
  }
--- 1176,1182 ----
  
    ipa_ref_list_reference_iterate (&n->symbol.ref_list, 0, ref);
    gcc_checking_assert (ref->use == IPA_REF_ALIAS);
!   if (symtab_variable_p (ref->referred))
      return ipa_ref_varpool_node (ref);
    return NULL;
  }
Index: reload.c
===================================================================
*** reload.c	(revision 186558)
--- reload.c	(working copy)
*************** operands_match_p (rtx x, rtx y)
*** 2258,2264 ****
    if (GET_MODE (x) != GET_MODE (y))
      return 0;
  
!   /* MEMs refering to different address space are not equivalent.  */
    if (code == MEM && MEM_ADDR_SPACE (x) != MEM_ADDR_SPACE (y))
      return 0;
  
--- 2258,2264 ----
    if (GET_MODE (x) != GET_MODE (y))
      return 0;
  
!   /* MEMs referring to different address space are not equivalent.  */
    if (code == MEM && MEM_ADDR_SPACE (x) != MEM_ADDR_SPACE (y))
      return 0;
  
Index: rtlanal.c
===================================================================
*** rtlanal.c	(revision 186558)
--- rtlanal.c	(working copy)
*************** nonzero_bits1 (const_rtx x, enum machine
*** 3981,3987 ****
  #if defined(POINTERS_EXTEND_UNSIGNED) && !defined(HAVE_ptr_extend)
        /* If pointers extend unsigned and this is a pointer in Pmode, say that
  	 all the bits above ptr_mode are known to be zero.  */
!       /* As we do not know which address space the pointer is refering to,
  	 we can do this only if the target does not support different pointer
  	 or address modes depending on the address space.  */
        if (target_default_pointer_address_modes_p ()
--- 3981,3987 ----
  #if defined(POINTERS_EXTEND_UNSIGNED) && !defined(HAVE_ptr_extend)
        /* If pointers extend unsigned and this is a pointer in Pmode, say that
  	 all the bits above ptr_mode are known to be zero.  */
!       /* As we do not know which address space the pointer is referring to,
  	 we can do this only if the target does not support different pointer
  	 or address modes depending on the address space.  */
        if (target_default_pointer_address_modes_p ()
*************** num_sign_bit_copies1 (const_rtx x, enum 
*** 4491,4497 ****
  #if defined(POINTERS_EXTEND_UNSIGNED) && !defined(HAVE_ptr_extend)
        /* If pointers extend signed and this is a pointer in Pmode, say that
  	 all the bits above ptr_mode are known to be sign bit copies.  */
!       /* As we do not know which address space the pointer is refering to,
  	 we can do this only if the target does not support different pointer
  	 or address modes depending on the address space.  */
        if (target_default_pointer_address_modes_p ()
--- 4491,4497 ----
  #if defined(POINTERS_EXTEND_UNSIGNED) && !defined(HAVE_ptr_extend)
        /* If pointers extend signed and this is a pointer in Pmode, say that
  	 all the bits above ptr_mode are known to be sign bit copies.  */
!       /* As we do not know which address space the pointer is referring to,
  	 we can do this only if the target does not support different pointer
  	 or address modes depending on the address space.  */
        if (target_default_pointer_address_modes_p ()
Index: tree-emutls.c
===================================================================
*** tree-emutls.c	(revision 186558)
--- tree-emutls.c	(working copy)
*************** gen_emutls_addr (tree decl, struct lower
*** 446,452 ****
  
        /* We may be adding a new reference to a new variable to the function.
           This means we have to play with the ipa-reference web.  */
!       ipa_record_reference (d->cfun_node, NULL, NULL, cvar, IPA_REF_ADDR, x);
  
        /* Record this ssa_name for possible use later in the basic block.  */
        VEC_replace (tree, access_vars, index, addr);
--- 446,452 ----
  
        /* We may be adding a new reference to a new variable to the function.
           This means we have to play with the ipa-reference web.  */
!       ipa_record_reference ((symtab_node)d->cfun_node, (symtab_node)cvar, IPA_REF_ADDR, x);
  
        /* Record this ssa_name for possible use later in the basic block.  */
        VEC_replace (tree, access_vars, index, addr);
Index: ipa-reference.c
===================================================================
*** ipa-reference.c	(revision 186559)
--- ipa-reference.c	(working copy)
*************** analyze_function (struct cgraph_node *fn
*** 435,441 ****
    local = init_function_info (fn);
    for (i = 0; ipa_ref_list_reference_iterate (&fn->symbol.ref_list, i, ref); i++)
      {
!       if (ref->refered_type != IPA_REF_VARPOOL)
  	continue;
        var = ipa_ref_varpool_node (ref)->symbol.decl;
        if (ipa_ref_varpool_node (ref)->symbol.externally_visible
--- 435,441 ----
    local = init_function_info (fn);
    for (i = 0; ipa_ref_list_reference_iterate (&fn->symbol.ref_list, i, ref); i++)
      {
!       if (!symtab_variable_p (ref->referred))
  	continue;
        var = ipa_ref_varpool_node (ref)->symbol.decl;
        if (ipa_ref_varpool_node (ref)->symbol.externally_visible
Index: cgraphunit.c
===================================================================
*** cgraphunit.c	(revision 186559)
--- cgraphunit.c	(working copy)
*************** cgraph_analyze_function (struct cgraph_n
*** 930,936 ****
  	    return;
  	  }
        if (!VEC_length (ipa_ref_t, node->symbol.ref_list.references))
!         ipa_record_reference (node, NULL, tgt, NULL, IPA_REF_ALIAS, NULL);
        if (node->same_body_alias)
  	{ 
  	  DECL_VIRTUAL_P (node->symbol.decl) = DECL_VIRTUAL_P (node->thunk.alias);
--- 930,937 ----
  	    return;
  	  }
        if (!VEC_length (ipa_ref_t, node->symbol.ref_list.references))
!         ipa_record_reference ((symtab_node)node, (symtab_node)tgt,
! 			      IPA_REF_ALIAS, NULL);
        if (node->same_body_alias)
  	{ 
  	  DECL_VIRTUAL_P (node->symbol.decl) = DECL_VIRTUAL_P (node->thunk.alias);
*************** cgraph_process_same_body_aliases (void)
*** 1031,1037 ****
  	&& !VEC_length (ipa_ref_t, node->symbol.ref_list.references))
        {
          struct cgraph_node *tgt = cgraph_get_node (node->thunk.alias);
!         ipa_record_reference (node, NULL, tgt, NULL, IPA_REF_ALIAS, NULL);
        }
    same_body_aliases_done = true;
  }
--- 1032,1039 ----
  	&& !VEC_length (ipa_ref_t, node->symbol.ref_list.references))
        {
          struct cgraph_node *tgt = cgraph_get_node (node->thunk.alias);
!         ipa_record_reference ((symtab_node)node, (symtab_node)tgt,
! 			      IPA_REF_ALIAS, NULL);
        }
    same_body_aliases_done = true;
  }
*************** assemble_thunks_and_aliases (struct cgra
*** 1848,1858 ****
        }
      else
        e = e->next_caller;
!   for (i = 0; ipa_ref_list_refering_iterate (&node->symbol.ref_list,
  					     i, ref); i++)
      if (ref->use == IPA_REF_ALIAS)
        {
! 	struct cgraph_node *alias = ipa_ref_refering_node (ref);
          bool saved_written = TREE_ASM_WRITTEN (alias->thunk.alias);
  
  	/* Force assemble_alias to really output the alias this time instead
--- 1850,1860 ----
        }
      else
        e = e->next_caller;
!   for (i = 0; ipa_ref_list_referring_iterate (&node->symbol.ref_list,
  					     i, ref); i++)
      if (ref->use == IPA_REF_ALIAS)
        {
! 	struct cgraph_node *alias = ipa_ref_referring_node (ref);
          bool saved_written = TREE_ASM_WRITTEN (alias->thunk.alias);
  
  	/* Force assemble_alias to really output the alias this time instead
Index: ipa-ref.c
===================================================================
*** ipa-ref.c	(revision 186559)
--- ipa-ref.c	(working copy)
***************
*** 1,5 ****
  /* Interprocedural reference lists.
!    Copyright (C) 2010
     Free Software Foundation, Inc.
     Contributed by Jan Hubicka
  
--- 1,5 ----
  /* Interprocedural reference lists.
!    Copyright (C) 2010, 2011, 2012
     Free Software Foundation, Inc.
     Contributed by Jan Hubicka
  
*************** static const char *ipa_ref_use_name[] = 
*** 34,87 ****
     of the use and STMT the statement (if it exists).  */
  
  struct ipa_ref *
! ipa_record_reference (struct cgraph_node *refering_node,
! 		      struct varpool_node *refering_varpool_node,
! 		      struct cgraph_node *refered_node,
! 		      struct varpool_node *refered_varpool_node,
  		      enum ipa_ref_use use_type, gimple stmt)
  {
    struct ipa_ref *ref;
    struct ipa_ref_list *list, *list2;
    VEC(ipa_ref_t,gc) *old_references;
-   gcc_assert ((!refering_node) ^ (!refering_varpool_node));
-   gcc_assert ((!refered_node) ^ (!refered_varpool_node));
-   gcc_assert (!stmt || refering_node);
-   gcc_assert (use_type != IPA_REF_ALIAS || !stmt);
  
!   list = (refering_node ? &refering_node->symbol.ref_list
! 	  : &refering_varpool_node->symbol.ref_list);
    old_references = list->references;
    VEC_safe_grow (ipa_ref_t, gc, list->references,
  		 VEC_length (ipa_ref_t, list->references) + 1);
    ref = VEC_last (ipa_ref_t, list->references);
  
!   list2 = (refered_node ? &refered_node->symbol.ref_list
! 	   : &refered_varpool_node->symbol.ref_list);
!   VEC_safe_push (ipa_ref_ptr, heap, list2->refering, ref);
!   ref->refered_index = VEC_length (ipa_ref_ptr, list2->refering) - 1;
!   if (refering_node)
!     {
!       ref->refering.cgraph_node = refering_node;
!       ref->refering_type = IPA_REF_CGRAPH;
!     }
!   else
!     {
!       ref->refering.varpool_node = refering_varpool_node;
!       ref->refering_type = IPA_REF_VARPOOL;
!       gcc_assert (use_type == IPA_REF_ADDR || use_type == IPA_REF_ALIAS);
!     }
!   if (refered_node)
!     {
!       ref->refered.cgraph_node = refered_node;
!       ref->refered_type = IPA_REF_CGRAPH;
!       gcc_assert (use_type == IPA_REF_ADDR || use_type == IPA_REF_ALIAS);
!     }
!   else
!     {
!       varpool_mark_needed_node (refered_varpool_node);
!       ref->refered.varpool_node = refered_varpool_node;
!       ref->refered_type = IPA_REF_VARPOOL;
!     }
    ref->stmt = stmt;
    ref->use = use_type;
  
--- 34,61 ----
     of the use and STMT the statement (if it exists).  */
  
  struct ipa_ref *
! ipa_record_reference (symtab_node referring_node,
! 		      symtab_node referred_node,
  		      enum ipa_ref_use use_type, gimple stmt)
  {
    struct ipa_ref *ref;
    struct ipa_ref_list *list, *list2;
    VEC(ipa_ref_t,gc) *old_references;
  
!   gcc_checking_assert (!stmt || symtab_function_p (referring_node));
!   gcc_checking_assert (use_type != IPA_REF_ALIAS || !stmt);
! 
!   list = &referring_node->symbol.ref_list;
    old_references = list->references;
    VEC_safe_grow (ipa_ref_t, gc, list->references,
  		 VEC_length (ipa_ref_t, list->references) + 1);
    ref = VEC_last (ipa_ref_t, list->references);
  
!   list2 = &referred_node->symbol.ref_list;
!   VEC_safe_push (ipa_ref_ptr, heap, list2->referring, ref);
!   ref->referred_index = VEC_length (ipa_ref_ptr, list2->referring) - 1;
!   ref->referring = referring_node;
!   ref->referred = referred_node;
    ref->stmt = stmt;
    ref->use = use_type;
  
*************** ipa_record_reference (struct cgraph_node
*** 91,98 ****
        int i;
        for (i = 0; ipa_ref_list_reference_iterate (list, i, ref); i++)
  	VEC_replace (ipa_ref_ptr,
! 		     ipa_ref_refered_ref_list (ref)->refering,
! 		     ref->refered_index, ref);
      }
    return ref;
  }
--- 65,72 ----
        int i;
        for (i = 0; ipa_ref_list_reference_iterate (list, i, ref); i++)
  	VEC_replace (ipa_ref_ptr,
! 		     ipa_ref_referred_ref_list (ref)->referring,
! 		     ref->referred_index, ref);
      }
    return ref;
  }
*************** ipa_record_reference (struct cgraph_node
*** 102,131 ****
  void
  ipa_remove_reference (struct ipa_ref *ref)
  {
!   struct ipa_ref_list *list = ipa_ref_refered_ref_list (ref);
!   struct ipa_ref_list *list2 = ipa_ref_refering_ref_list (ref);
    VEC(ipa_ref_t,gc) *old_references = list2->references;
    struct ipa_ref *last;
  
!   gcc_assert (VEC_index (ipa_ref_ptr, list->refering, ref->refered_index) == ref);
!   last = VEC_last (ipa_ref_ptr, list->refering);
    if (ref != last)
      {
!       VEC_replace (ipa_ref_ptr, list->refering,
! 		   ref->refered_index,
! 		   VEC_last (ipa_ref_ptr, list->refering));
!       VEC_index (ipa_ref_ptr, list->refering,
! 		 ref->refered_index)->refered_index = ref->refered_index;
      }
!   VEC_pop (ipa_ref_ptr, list->refering);
  
    last = VEC_last (ipa_ref_t, list2->references);
    if (ref != last)
      {
        *ref = *last;
        VEC_replace (ipa_ref_ptr,
! 		   ipa_ref_refered_ref_list (ref)->refering,
! 		   ref->refered_index, ref);
      }
    VEC_pop (ipa_ref_t, list2->references);
    gcc_assert (list2->references == old_references);
--- 76,105 ----
  void
  ipa_remove_reference (struct ipa_ref *ref)
  {
!   struct ipa_ref_list *list = ipa_ref_referred_ref_list (ref);
!   struct ipa_ref_list *list2 = ipa_ref_referring_ref_list (ref);
    VEC(ipa_ref_t,gc) *old_references = list2->references;
    struct ipa_ref *last;
  
!   gcc_assert (VEC_index (ipa_ref_ptr, list->referring, ref->referred_index) == ref);
!   last = VEC_last (ipa_ref_ptr, list->referring);
    if (ref != last)
      {
!       VEC_replace (ipa_ref_ptr, list->referring,
! 		   ref->referred_index,
! 		   VEC_last (ipa_ref_ptr, list->referring));
!       VEC_index (ipa_ref_ptr, list->referring,
! 		 ref->referred_index)->referred_index = ref->referred_index;
      }
!   VEC_pop (ipa_ref_ptr, list->referring);
  
    last = VEC_last (ipa_ref_t, list2->references);
    if (ref != last)
      {
        *ref = *last;
        VEC_replace (ipa_ref_ptr,
! 		   ipa_ref_referred_ref_list (ref)->referring,
! 		   ref->referred_index, ref);
      }
    VEC_pop (ipa_ref_t, list2->references);
    gcc_assert (list2->references == old_references);
*************** ipa_remove_all_references (struct ipa_re
*** 145,156 ****
  /* Remove all references in ref list LIST.  */
  
  void
! ipa_remove_all_refering (struct ipa_ref_list *list)
  {
!   while (VEC_length (ipa_ref_ptr, list->refering))
!     ipa_remove_reference (VEC_last (ipa_ref_ptr, list->refering));
!   VEC_free (ipa_ref_ptr, heap, list->refering);
!   list->refering = NULL;
  }
  
  /* Dump references in LIST to FILE.  */
--- 119,130 ----
  /* Remove all references in ref list LIST.  */
  
  void
! ipa_remove_all_referring (struct ipa_ref_list *list)
  {
!   while (VEC_length (ipa_ref_ptr, list->referring))
!     ipa_remove_reference (VEC_last (ipa_ref_ptr, list->referring));
!   VEC_free (ipa_ref_ptr, heap, list->referring);
!   list->referring = NULL;
  }
  
  /* Dump references in LIST to FILE.  */
*************** ipa_dump_references (FILE * file, struct
*** 162,199 ****
    int i;
    for (i = 0; ipa_ref_list_reference_iterate (list, i, ref); i++)
      {
!       if (ref->refered_type == IPA_REF_CGRAPH)
! 	{
! 	  fprintf (file, " fn:%s/%i (%s)", cgraph_node_asm_name (ipa_ref_node (ref)),
! 		   ipa_ref_node (ref)->symbol.order,
! 		   ipa_ref_use_name [ref->use]);
! 	}
!       else
! 	fprintf (file, " var:%s (%s)",
! 		 varpool_node_asm_name (ipa_ref_varpool_node (ref)),
! 		 ipa_ref_use_name [ref->use]);
      }
    fprintf (file, "\n");
  }
  
! /* Dump refering in LIST to FILE.  */
  
  void
! ipa_dump_refering (FILE * file, struct ipa_ref_list *list)
  {
    struct ipa_ref *ref;
    int i;
!   for (i = 0; ipa_ref_list_refering_iterate (list, i, ref); i++)
      {
!       if (ref->refering_type == IPA_REF_CGRAPH)
! 	fprintf (file, " fn:%s/%i (%s)",
! 		 cgraph_node_asm_name (ipa_ref_refering_node (ref)),
! 		 ipa_ref_refering_node (ref)->symbol.order,
! 		 ipa_ref_use_name [ref->use]);
!       else
! 	fprintf (file, " var:%s (%s)",
! 		 varpool_node_asm_name (ipa_ref_refering_varpool_node (ref)),
! 		 ipa_ref_use_name [ref->use]);
      }
    fprintf (file, "\n");
  }
--- 136,162 ----
    int i;
    for (i = 0; ipa_ref_list_reference_iterate (list, i, ref); i++)
      {
!       fprintf (file, "%s/%i (%s)",
!                symtab_node_asm_name (ref->referred),
!                ref->referred->symbol.order,
! 	       ipa_ref_use_name [ref->use]);
      }
    fprintf (file, "\n");
  }
  
! /* Dump referring in LIST to FILE.  */
  
  void
! ipa_dump_referring (FILE * file, struct ipa_ref_list *list)
  {
    struct ipa_ref *ref;
    int i;
!   for (i = 0; ipa_ref_list_referring_iterate (list, i, ref); i++)
      {
!       fprintf (file, "%s/%i (%s)",
!                symtab_node_asm_name (ref->referring),
!                ref->referring->symbol.order,
! 	       ipa_ref_use_name [ref->use]);
      }
    fprintf (file, "\n");
  }
*************** ipa_dump_refering (FILE * file, struct i
*** 201,246 ****
  /* Clone all references from SRC to DEST_NODE or DEST_VARPOOL_NODE.  */
  
  void
! ipa_clone_references (struct cgraph_node *dest_node,
! 		      struct varpool_node *dest_varpool_node,
  		      struct ipa_ref_list *src)
  {
    struct ipa_ref *ref;
    int i;
    for (i = 0; ipa_ref_list_reference_iterate (src, i, ref); i++)
!     ipa_record_reference (dest_node, dest_varpool_node,
! 			  ref->refered_type == IPA_REF_CGRAPH
! 			  ? ipa_ref_node (ref) : NULL,
! 			  ref->refered_type == IPA_REF_VARPOOL
! 			  ? ipa_ref_varpool_node (ref) : NULL,
  			  ref->use, ref->stmt);
  }
  
! /* Clone all refering from SRC to DEST_NODE or DEST_VARPOOL_NODE.  */
  
  void
! ipa_clone_refering (struct cgraph_node *dest_node,
! 		    struct varpool_node *dest_varpool_node,
  		    struct ipa_ref_list *src)
  {
    struct ipa_ref *ref;
    int i;
!   for (i = 0; ipa_ref_list_refering_iterate (src, i, ref); i++)
!     ipa_record_reference (
! 			  ref->refering_type == IPA_REF_CGRAPH
! 			  ? ipa_ref_refering_node (ref) : NULL,
! 			  ref->refering_type == IPA_REF_VARPOOL
! 			  ? ipa_ref_refering_varpool_node (ref) : NULL,
! 			  dest_node, dest_varpool_node,
  			  ref->use, ref->stmt);
  }
  
! /* Return true when execution of REF can load to return from
     function. */
  bool
  ipa_ref_cannot_lead_to_return (struct ipa_ref *ref)
  {
!   return cgraph_node_cannot_return (ipa_ref_refering_node (ref));
  }
  
  /* Return true if list contains an alias.  */
--- 164,200 ----
  /* Clone all references from SRC to DEST_NODE or DEST_VARPOOL_NODE.  */
  
  void
! ipa_clone_references (symtab_node dest_node,
  		      struct ipa_ref_list *src)
  {
    struct ipa_ref *ref;
    int i;
    for (i = 0; ipa_ref_list_reference_iterate (src, i, ref); i++)
!     ipa_record_reference (dest_node,
! 			  ref->referred,
  			  ref->use, ref->stmt);
  }
  
! /* Clone all referring from SRC to DEST_NODE or DEST_VARPOOL_NODE.  */
  
  void
! ipa_clone_referring (symtab_node dest_node,
  		    struct ipa_ref_list *src)
  {
    struct ipa_ref *ref;
    int i;
!   for (i = 0; ipa_ref_list_referring_iterate (src, i, ref); i++)
!     ipa_record_reference (ref->referring,
! 			  dest_node,
  			  ref->use, ref->stmt);
  }
  
! /* Return true when execution of REF can lead to return from
     function. */
  bool
  ipa_ref_cannot_lead_to_return (struct ipa_ref *ref)
  {
!   return cgraph_node_cannot_return (ipa_ref_referring_node (ref));
  }
  
  /* Return true if list contains an alias.  */
*************** ipa_ref_has_aliases_p (struct ipa_ref_li
*** 249,255 ****
  {
    struct ipa_ref *ref;
    int i;
!   for (i = 0; ipa_ref_list_refering_iterate (ref_list, i, ref); i++)
      if (ref->use == IPA_REF_ALIAS)
        return true;
    return false;
--- 203,209 ----
  {
    struct ipa_ref *ref;
    int i;
!   for (i = 0; ipa_ref_list_referring_iterate (ref_list, i, ref); i++)
      if (ref->use == IPA_REF_ALIAS)
        return true;
    return false;
Index: ipa-ref.h
===================================================================
*** ipa-ref.h	(revision 186558)
--- ipa-ref.h	(working copy)
*************** along with GCC; see the file COPYING3.  
*** 21,26 ****
--- 21,30 ----
  
  struct cgraph_node;
  struct varpool_node;
+ union symtab_node_def;
+ typedef union symtab_node_def *symtab_node;
+ typedef const union symtab_node_def *const_symtab_node;
+ 
  
  /* How the reference is done.  */
  enum GTY(()) ipa_ref_use
*************** enum GTY(()) ipa_ref_use
*** 31,60 ****
    IPA_REF_ALIAS
  };
  
- /* Type of refering or refered type.  */
- enum GTY(()) ipa_ref_type
- {
-   IPA_REF_CGRAPH,
-   IPA_REF_VARPOOL
- };
- 
- /* We can have references spanning both callgraph and varpool,
-    so all pointers needs to be of both types.  */
- union GTY(()) ipa_ref_ptr_u
- {
-   struct cgraph_node * GTY((tag ("IPA_REF_CGRAPH"))) cgraph_node;
-   struct varpool_node * GTY((tag ("IPA_REF_VARPOOL"))) varpool_node;
- };
- 
  /* Record of reference in callgraph or varpool.  */
  struct GTY(()) ipa_ref
  {
!   union ipa_ref_ptr_u GTY ((desc ("%1.refering_type"))) refering;
!   union ipa_ref_ptr_u GTY ((desc ("%1.refered_type"))) refered;
    gimple stmt;
!   unsigned int refered_index;
!   ENUM_BITFIELD (ipa_ref_type) refering_type:1;
!   ENUM_BITFIELD (ipa_ref_type) refered_type:1;
    ENUM_BITFIELD (ipa_ref_use) use:2;
  };
  
--- 35,47 ----
    IPA_REF_ALIAS
  };
  
  /* Record of reference in callgraph or varpool.  */
  struct GTY(()) ipa_ref
  {
!   symtab_node referring;
!   symtab_node referred;
    gimple stmt;
!   unsigned int referred_index;
    ENUM_BITFIELD (ipa_ref_use) use:2;
  };
  
*************** struct GTY(()) ipa_ref_list
*** 73,93 ****
    VEC(ipa_ref_t,gc) *references;
    /* Refering is vector of pointers to references.  It must not live in GGC space
       or GGC will try to mark middle of references vectors.  */
!   VEC(ipa_ref_ptr,heap) * GTY((skip)) refering;
  };
  
! struct ipa_ref * ipa_record_reference (struct cgraph_node *,
! 				       struct varpool_node *,
! 				       struct cgraph_node *,
! 				       struct varpool_node *,
  				       enum ipa_ref_use, gimple);
  
  void ipa_remove_reference (struct ipa_ref *);
  void ipa_remove_all_references (struct ipa_ref_list *);
! void ipa_remove_all_refering (struct ipa_ref_list *);
  void ipa_dump_references (FILE *, struct ipa_ref_list *);
! void ipa_dump_refering (FILE *, struct ipa_ref_list *);
! void ipa_clone_references (struct cgraph_node *, struct varpool_node *, struct ipa_ref_list *);
! void ipa_clone_refering (struct cgraph_node *, struct varpool_node *, struct ipa_ref_list *);
  bool ipa_ref_cannot_lead_to_return (struct ipa_ref *);
  bool ipa_ref_has_aliases_p (struct ipa_ref_list *);
--- 60,78 ----
    VEC(ipa_ref_t,gc) *references;
    /* Refering is vector of pointers to references.  It must not live in GGC space
       or GGC will try to mark middle of references vectors.  */
!   VEC(ipa_ref_ptr,heap) * GTY((skip)) referring;
  };
  
! struct ipa_ref * ipa_record_reference (symtab_node,
! 				       symtab_node,
  				       enum ipa_ref_use, gimple);
  
  void ipa_remove_reference (struct ipa_ref *);
  void ipa_remove_all_references (struct ipa_ref_list *);
! void ipa_remove_all_referring (struct ipa_ref_list *);
  void ipa_dump_references (FILE *, struct ipa_ref_list *);
! void ipa_dump_referring (FILE *, struct ipa_ref_list *);
! void ipa_clone_references (symtab_node, struct ipa_ref_list *);
! void ipa_clone_referring (symtab_node, struct ipa_ref_list *);
  bool ipa_ref_cannot_lead_to_return (struct ipa_ref *);
  bool ipa_ref_has_aliases_p (struct ipa_ref_list *);
Index: lto-cgraph.c
===================================================================
*** lto-cgraph.c	(revision 186558)
--- lto-cgraph.c	(working copy)
*************** referenced_from_other_partition_p (struc
*** 326,343 ****
  {
    int i;
    struct ipa_ref *ref;
!   for (i = 0; ipa_ref_list_refering_iterate (list, i, ref); i++)
      {
!       if (ref->refering_type == IPA_REF_CGRAPH)
  	{
! 	  if (ipa_ref_refering_node (ref)->symbol.in_other_partition
! 	      || !cgraph_node_in_set_p (ipa_ref_refering_node (ref), set))
  	    return true;
  	}
        else
  	{
! 	  if (ipa_ref_refering_varpool_node (ref)->symbol.in_other_partition
! 	      || !varpool_node_in_set_p (ipa_ref_refering_varpool_node (ref),
  				         vset))
  	    return true;
  	}
--- 326,343 ----
  {
    int i;
    struct ipa_ref *ref;
!   for (i = 0; ipa_ref_list_referring_iterate (list, i, ref); i++)
      {
!       if (symtab_function_p (ref->referring))
  	{
! 	  if (ipa_ref_referring_node (ref)->symbol.in_other_partition
! 	      || !cgraph_node_in_set_p (ipa_ref_referring_node (ref), set))
  	    return true;
  	}
        else
  	{
! 	  if (ipa_ref_referring_varpool_node (ref)->symbol.in_other_partition
! 	      || !varpool_node_in_set_p (ipa_ref_referring_varpool_node (ref),
  				         vset))
  	    return true;
  	}
*************** referenced_from_this_partition_p (struct
*** 370,385 ****
  {
    int i;
    struct ipa_ref *ref;
!   for (i = 0; ipa_ref_list_refering_iterate (list, i, ref); i++)
      {
!       if (ref->refering_type == IPA_REF_CGRAPH)
  	{
! 	  if (cgraph_node_in_set_p (ipa_ref_refering_node (ref), set))
  	    return true;
  	}
        else
  	{
! 	  if (varpool_node_in_set_p (ipa_ref_refering_varpool_node (ref),
  				     vset))
  	    return true;
  	}
--- 370,385 ----
  {
    int i;
    struct ipa_ref *ref;
!   for (i = 0; ipa_ref_list_referring_iterate (list, i, ref); i++)
      {
!       if (symtab_function_p (ref->referring))
  	{
! 	  if (cgraph_node_in_set_p (ipa_ref_referring_node (ref), set))
  	    return true;
  	}
        else
  	{
! 	  if (varpool_node_in_set_p (ipa_ref_referring_varpool_node (ref),
  				     vset))
  	    return true;
  	}
*************** lto_output_ref (struct lto_simple_output
*** 614,623 ****
  {
    struct bitpack_d bp;
    bp = bitpack_create (ob->main_stream);
!   bp_pack_value (&bp, ref->refered_type, 1);
    bp_pack_value (&bp, ref->use, 2);
    streamer_write_bitpack (&bp);
!   if (ref->refered_type == IPA_REF_CGRAPH)
      {
        int nref = lto_cgraph_encoder_lookup (encoder, ipa_ref_node (ref));
        gcc_assert (nref != LCC_NOT_FOUND);
--- 614,623 ----
  {
    struct bitpack_d bp;
    bp = bitpack_create (ob->main_stream);
!   bp_pack_value (&bp, symtab_function_p (ref->referred), 1);
    bp_pack_value (&bp, ref->use, 2);
    streamer_write_bitpack (&bp);
!   if (symtab_function_p (ref->referred))
      {
        int nref = lto_cgraph_encoder_lookup (encoder, ipa_ref_node (ref));
        gcc_assert (nref != LCC_NOT_FOUND);
*************** add_references (lto_cgraph_encoder_t enc
*** 674,680 ****
    int i;
    struct ipa_ref *ref;
    for (i = 0; ipa_ref_list_reference_iterate (list, i, ref); i++)
!     if (ref->refered_type == IPA_REF_CGRAPH)
        add_node_to (encoder, ipa_ref_node (ref), false);
      else
        {
--- 674,680 ----
    int i;
    struct ipa_ref *ref;
    for (i = 0; ipa_ref_list_reference_iterate (list, i, ref); i++)
!     if (symtab_function_p (ref->referred))
        add_node_to (encoder, ipa_ref_node (ref), false);
      else
        {
*************** input_varpool_node (struct lto_file_decl
*** 1108,1134 ****
  
  static void
  input_ref (struct lto_input_block *ib,
! 	   struct cgraph_node *refering_node,
! 	   struct varpool_node *refering_varpool_node,
  	   VEC(cgraph_node_ptr, heap) *nodes,
  	   VEC(varpool_node_ptr, heap) *varpool_nodes_vec)
  {
    struct cgraph_node *node = NULL;
    struct varpool_node *varpool_node = NULL;
    struct bitpack_d bp;
!   enum ipa_ref_type type;
    enum ipa_ref_use use;
  
    bp = streamer_read_bitpack (ib);
!   type = (enum ipa_ref_type) bp_unpack_value (&bp, 1);
    use = (enum ipa_ref_use) bp_unpack_value (&bp, 2);
!   if (type == IPA_REF_CGRAPH)
      node = VEC_index (cgraph_node_ptr, nodes, streamer_read_hwi (ib));
    else
      varpool_node = VEC_index (varpool_node_ptr, varpool_nodes_vec,
  			      streamer_read_hwi (ib));
!   ipa_record_reference (refering_node, refering_varpool_node,
! 		        node, varpool_node, use, NULL);
  }
  
  /* Read an edge from IB.  NODES points to a vector of previously read nodes for
--- 1108,1133 ----
  
  static void
  input_ref (struct lto_input_block *ib,
! 	   symtab_node referring_node,
  	   VEC(cgraph_node_ptr, heap) *nodes,
  	   VEC(varpool_node_ptr, heap) *varpool_nodes_vec)
  {
    struct cgraph_node *node = NULL;
    struct varpool_node *varpool_node = NULL;
    struct bitpack_d bp;
!   int type;
    enum ipa_ref_use use;
  
    bp = streamer_read_bitpack (ib);
!   type = bp_unpack_value (&bp, 1);
    use = (enum ipa_ref_use) bp_unpack_value (&bp, 2);
!   if (type)
      node = VEC_index (cgraph_node_ptr, nodes, streamer_read_hwi (ib));
    else
      varpool_node = VEC_index (varpool_node_ptr, varpool_nodes_vec,
  			      streamer_read_hwi (ib));
!   ipa_record_reference (referring_node,
! 		        node ? (symtab_node) node : (symtab_node) varpool_node, use, NULL);
  }
  
  /* Read an edge from IB.  NODES points to a vector of previously read nodes for
*************** input_refs (struct lto_input_block *ib,
*** 1324,1330 ****
        node = VEC_index (cgraph_node_ptr, nodes, idx);
        while (count)
  	{
! 	  input_ref (ib, node, NULL, nodes, varpool);
  	  count--;
  	}
      }
--- 1323,1329 ----
        node = VEC_index (cgraph_node_ptr, nodes, idx);
        while (count)
  	{
! 	  input_ref (ib, (symtab_node) node, nodes, varpool);
  	  count--;
  	}
      }
*************** input_refs (struct lto_input_block *ib,
*** 1338,1344 ****
  			streamer_read_uhwi (ib));
        while (count)
  	{
! 	  input_ref (ib, NULL, node, nodes, varpool);
  	  count--;
  	}
      }
--- 1337,1343 ----
  			streamer_read_uhwi (ib));
        while (count)
  	{
! 	  input_ref (ib, (symtab_node) node, nodes, varpool);
  	  count--;
  	}
      }
Index: ipa-ref-inline.h
===================================================================
*** ipa-ref-inline.h	(revision 186558)
--- ipa-ref-inline.h	(working copy)
*************** You should have received a copy of the G
*** 19,79 ****
  along with GCC; see the file COPYING3.  If not see
  <http://www.gnu.org/licenses/>.  */
  
! /* Return callgraph node REF is refering.  */
  static inline struct cgraph_node *
  ipa_ref_node (struct ipa_ref *ref)
  {
!   gcc_assert (ref->refered_type == IPA_REF_CGRAPH);
!   return ref->refered.cgraph_node;
  }
  
! /* Return varpool node REF is refering.  */
  
  static inline struct varpool_node *
  ipa_ref_varpool_node (struct ipa_ref *ref)
  {
!   gcc_assert (ref->refered_type == IPA_REF_VARPOOL);
!   return ref->refered.varpool_node;
  }
  
  /* Return cgraph node REF is in.  */
  
  static inline struct cgraph_node *
! ipa_ref_refering_node (struct ipa_ref *ref)
  {
!   gcc_assert (ref->refering_type == IPA_REF_CGRAPH);
!   return ref->refering.cgraph_node;
  }
  
  /* Return varpool node REF is in.  */
  
  static inline struct varpool_node *
! ipa_ref_refering_varpool_node (struct ipa_ref *ref)
  {
!   gcc_assert (ref->refering_type == IPA_REF_VARPOOL);
!   return ref->refering.varpool_node;
  }
  
  /* Return reference list REF is in.  */
  
  static inline struct ipa_ref_list *
! ipa_ref_refering_ref_list (struct ipa_ref *ref)
  {
!   if (ref->refering_type == IPA_REF_CGRAPH)
!     return &ipa_ref_refering_node (ref)->symbol.ref_list;
!   else
!     return &ipa_ref_refering_varpool_node (ref)->symbol.ref_list;
  }
  
  /* Return reference list REF is in.  */
  
  static inline struct ipa_ref_list *
! ipa_ref_refered_ref_list (struct ipa_ref *ref)
  {
!   if (ref->refered_type == IPA_REF_CGRAPH)
!     return &ipa_ref_node (ref)->symbol.ref_list;
!   else
!     return &ipa_ref_varpool_node (ref)->symbol.ref_list;
  }
  
  /* Return first reference in LIST or NULL if empty.  */
--- 19,69 ----
  along with GCC; see the file COPYING3.  If not see
  <http://www.gnu.org/licenses/>.  */
  
! /* Return callgraph node REF is referring.  */
  static inline struct cgraph_node *
  ipa_ref_node (struct ipa_ref *ref)
  {
!   return cgraph (ref->referred);
  }
  
! /* Return varpool node REF is referring.  */
  
  static inline struct varpool_node *
  ipa_ref_varpool_node (struct ipa_ref *ref)
  {
!   return varpool (ref->referred);
  }
  
  /* Return cgraph node REF is in.  */
  
  static inline struct cgraph_node *
! ipa_ref_referring_node (struct ipa_ref *ref)
  {
!   return cgraph (ref->referring);
  }
  
  /* Return varpool node REF is in.  */
  
  static inline struct varpool_node *
! ipa_ref_referring_varpool_node (struct ipa_ref *ref)
  {
!   return varpool (ref->referring);
  }
  
  /* Return reference list REF is in.  */
  
  static inline struct ipa_ref_list *
! ipa_ref_referring_ref_list (struct ipa_ref *ref)
  {
!   return &ref->referring->symbol.ref_list;
  }
  
  /* Return reference list REF is in.  */
  
  static inline struct ipa_ref_list *
! ipa_ref_referred_ref_list (struct ipa_ref *ref)
  {
!   return &ref->referred->symbol.ref_list;
  }
  
  /* Return first reference in LIST or NULL if empty.  */
*************** ipa_ref_list_first_reference (struct ipa
*** 86,99 ****
    return VEC_index (ipa_ref_t, list->references, 0);
  }
  
! /* Return first refering ref in LIST or NULL if empty.  */
  
  static inline struct ipa_ref *
! ipa_ref_list_first_refering (struct ipa_ref_list *list)
  {
!   if (!VEC_length (ipa_ref_ptr, list->refering))
      return NULL;
!   return VEC_index (ipa_ref_ptr, list->refering, 0);
  }
  
  /* Clear reference list.  */
--- 76,89 ----
    return VEC_index (ipa_ref_t, list->references, 0);
  }
  
! /* Return first referring ref in LIST or NULL if empty.  */
  
  static inline struct ipa_ref *
! ipa_ref_list_first_referring (struct ipa_ref_list *list)
  {
!   if (!VEC_length (ipa_ref_ptr, list->referring))
      return NULL;
!   return VEC_index (ipa_ref_ptr, list->referring, 0);
  }
  
  /* Clear reference list.  */
*************** ipa_ref_list_first_refering (struct ipa_
*** 101,107 ****
  static inline void
  ipa_empty_ref_list (struct ipa_ref_list *list)
  {
!   list->refering = NULL;
    list->references = NULL;
  }
  
--- 91,97 ----
  static inline void
  ipa_empty_ref_list (struct ipa_ref_list *list)
  {
!   list->referring = NULL;
    list->references = NULL;
  }
  
*************** ipa_ref_list_nreferences (struct ipa_ref
*** 115,119 ****
  
  #define ipa_ref_list_reference_iterate(L,I,P) \
     VEC_iterate(ipa_ref_t, (L)->references, (I), (P))
! #define ipa_ref_list_refering_iterate(L,I,P) \
!    VEC_iterate(ipa_ref_ptr, (L)->refering, (I), (P))
--- 105,109 ----
  
  #define ipa_ref_list_reference_iterate(L,I,P) \
     VEC_iterate(ipa_ref_t, (L)->references, (I), (P))
! #define ipa_ref_list_referring_iterate(L,I,P) \
!    VEC_iterate(ipa_ref_ptr, (L)->referring, (I), (P))
Index: cse.c
===================================================================
*** cse.c	(revision 186558)
--- cse.c	(working copy)
*************** exp_equiv_p (const_rtx x, const_rtx y, i
*** 2622,2628 ****
    if (GET_MODE (x) != GET_MODE (y))
      return 0;
  
!   /* MEMs refering to different address space are not equivalent.  */
    if (code == MEM && MEM_ADDR_SPACE (x) != MEM_ADDR_SPACE (y))
      return 0;
  
--- 2622,2628 ----
    if (GET_MODE (x) != GET_MODE (y))
      return 0;
  
!   /* MEMs referring to different address space are not equivalent.  */
    if (code == MEM && MEM_ADDR_SPACE (x) != MEM_ADDR_SPACE (y))
      return 0;
  
Index: ipa-utils.c
===================================================================
*** ipa-utils.c	(revision 186558)
--- ipa-utils.c	(working copy)
*************** ipa_reverse_postorder (struct cgraph_nod
*** 295,307 ****
  			    (cgraph_function_node (edge->callee, NULL)->symbol.decl))
  			node2 = NULL;
  		    }
! 		  for (;ipa_ref_list_refering_iterate (&stack[stack_size].node->symbol.ref_list,
  						       stack[stack_size].ref,
  						       ref) && !node2;
  		       stack[stack_size].ref++)
  		    {
  		      if (ref->use == IPA_REF_ALIAS)
! 			node2 = ipa_ref_refering_node (ref);
  		    }
  		  if (!node2)
  		    break;
--- 295,307 ----
  			    (cgraph_function_node (edge->callee, NULL)->symbol.decl))
  			node2 = NULL;
  		    }
! 		  for (;ipa_ref_list_referring_iterate (&stack[stack_size].node->symbol.ref_list,
  						       stack[stack_size].ref,
  						       ref) && !node2;
  		       stack[stack_size].ref++)
  		    {
  		      if (ref->use == IPA_REF_ALIAS)
! 			node2 = ipa_ref_referring_node (ref);
  		    }
  		  if (!node2)
  		    break;
Index: tree-ssa-alias.c
===================================================================
*** tree-ssa-alias.c	(revision 186558)
--- tree-ssa-alias.c	(working copy)
*************** refs_may_alias_p_1 (ao_ref *ref1, ao_ref
*** 1010,1016 ****
        || CONSTANT_CLASS_P (base2))
      return false;
  
!   /* We can end up refering to code via function and label decls.
       As we likely do not properly track code aliases conservatively
       bail out.  */
    if (TREE_CODE (base1) == FUNCTION_DECL
--- 1010,1016 ----
        || CONSTANT_CLASS_P (base2))
      return false;
  
!   /* We can end up referring to code via function and label decls.
       As we likely do not properly track code aliases conservatively
       bail out.  */
    if (TREE_CODE (base1) == FUNCTION_DECL
Index: ipa-inline.c
===================================================================
*** ipa-inline.c	(revision 186559)
--- ipa-inline.c	(working copy)
*************** reset_edge_caches (struct cgraph_node *n
*** 957,966 ****
    for (edge = where->callers; edge; edge = edge->next_caller)
      if (edge->inline_failed)
        reset_edge_growth_cache (edge);
!   for (i = 0; ipa_ref_list_refering_iterate (&where->symbol.ref_list,
  					      i, ref); i++)
      if (ref->use == IPA_REF_ALIAS)
!       reset_edge_caches (ipa_ref_refering_node (ref));
  
    if (!e)
      return;
--- 957,966 ----
    for (edge = where->callers; edge; edge = edge->next_caller)
      if (edge->inline_failed)
        reset_edge_growth_cache (edge);
!   for (i = 0; ipa_ref_list_referring_iterate (&where->symbol.ref_list,
  					      i, ref); i++)
      if (ref->use == IPA_REF_ALIAS)
!       reset_edge_caches (ipa_ref_referring_node (ref));
  
    if (!e)
      return;
*************** update_caller_keys (fibheap_t heap, stru
*** 1009,1019 ****
    if (!bitmap_set_bit (updated_nodes, node->uid))
      return;
  
!   for (i = 0; ipa_ref_list_refering_iterate (&node->symbol.ref_list,
  					      i, ref); i++)
      if (ref->use == IPA_REF_ALIAS)
        {
! 	struct cgraph_node *alias = ipa_ref_refering_node (ref);
          update_caller_keys (heap, alias, updated_nodes, check_inlinablity_for);
        }
  
--- 1009,1019 ----
    if (!bitmap_set_bit (updated_nodes, node->uid))
      return;
  
!   for (i = 0; ipa_ref_list_referring_iterate (&node->symbol.ref_list,
  					      i, ref); i++)
      if (ref->use == IPA_REF_ALIAS)
        {
! 	struct cgraph_node *alias = ipa_ref_referring_node (ref);
          update_caller_keys (heap, alias, updated_nodes, check_inlinablity_for);
        }
  
Index: ipa-inline.h
===================================================================
*** ipa-inline.h	(revision 186558)
--- ipa-inline.h	(working copy)
*************** along with GCC; see the file COPYING3.  
*** 24,30 ****
  
     Conditions that are interesting for function body are collected into CONDS
     vector.  They are of simple for  function_param OP VAL, where VAL is
!    IPA invariant.  The conditions are then refered by predicates.  */
  
  typedef struct GTY(()) condition
    {
--- 24,30 ----
  
     Conditions that are interesting for function body are collected into CONDS
     vector.  They are of simple for  function_param OP VAL, where VAL is
!    IPA invariant.  The conditions are then referred by predicates.  */
  
  typedef struct GTY(()) condition
    {
Index: jump.c
===================================================================
*** jump.c	(revision 186558)
--- jump.c	(working copy)
*************** rtx_renumbered_equal_p (const_rtx x, con
*** 1764,1770 ****
    if (GET_MODE (x) != GET_MODE (y))
      return 0;
  
!   /* MEMs refering to different address space are not equivalent.  */
    if (code == MEM && MEM_ADDR_SPACE (x) != MEM_ADDR_SPACE (y))
      return 0;
  
--- 1764,1770 ----
    if (GET_MODE (x) != GET_MODE (y))
      return 0;
  
!   /* MEMs referring to different address space are not equivalent.  */
    if (code == MEM && MEM_ADDR_SPACE (x) != MEM_ADDR_SPACE (y))
      return 0;
  
Index: alias.c
===================================================================
*** alias.c	(revision 186558)
--- alias.c	(working copy)
*************** find_base_value (rtx src)
*** 1178,1184 ****
        return 0;
  
      case TRUNCATE:
!       /* As we do not know which address space the pointer is refering to, we can
  	 handle this only if the target does not support different pointer or
  	 address modes depending on the address space.  */
        if (!target_default_pointer_address_modes_p ())
--- 1178,1184 ----
        return 0;
  
      case TRUNCATE:
!       /* As we do not know which address space the pointer is referring to, we can
  	 handle this only if the target does not support different pointer or
  	 address modes depending on the address space.  */
        if (!target_default_pointer_address_modes_p ())
*************** find_base_value (rtx src)
*** 1197,1203 ****
  
      case ZERO_EXTEND:
      case SIGN_EXTEND:	/* used for NT/Alpha pointers */
!       /* As we do not know which address space the pointer is refering to, we can
  	 handle this only if the target does not support different pointer or
  	 address modes depending on the address space.  */
        if (!target_default_pointer_address_modes_p ())
--- 1197,1203 ----
  
      case ZERO_EXTEND:
      case SIGN_EXTEND:	/* used for NT/Alpha pointers */
!       /* As we do not know which address space the pointer is referring to, we can
  	 handle this only if the target does not support different pointer or
  	 address modes depending on the address space.  */
        if (!target_default_pointer_address_modes_p ())
*************** find_base_term (rtx x)
*** 1602,1608 ****
        return REG_BASE_VALUE (x);
  
      case TRUNCATE:
!       /* As we do not know which address space the pointer is refering to, we can
  	 handle this only if the target does not support different pointer or
  	 address modes depending on the address space.  */
        if (!target_default_pointer_address_modes_p ())
--- 1602,1608 ----
        return REG_BASE_VALUE (x);
  
      case TRUNCATE:
!       /* As we do not know which address space the pointer is referring to, we can
  	 handle this only if the target does not support different pointer or
  	 address modes depending on the address space.  */
        if (!target_default_pointer_address_modes_p ())
*************** find_base_term (rtx x)
*** 1621,1627 ****
  
      case ZERO_EXTEND:
      case SIGN_EXTEND:	/* Used for Alpha/NT pointers */
!       /* As we do not know which address space the pointer is refering to, we can
  	 handle this only if the target does not support different pointer or
  	 address modes depending on the address space.  */
        if (!target_default_pointer_address_modes_p ())
--- 1621,1627 ----
  
      case ZERO_EXTEND:
      case SIGN_EXTEND:	/* Used for Alpha/NT pointers */
!       /* As we do not know which address space the pointer is referring to, we can
  	 handle this only if the target does not support different pointer or
  	 address modes depending on the address space.  */
        if (!target_default_pointer_address_modes_p ())
*************** nonoverlapping_memrefs_p (const_rtx x, c
*** 2363,2369 ****
        && ! rtx_equal_p (rtlx, rtly))
      return 1;
  
!   /* If we have MEMs refering to different address spaces (which can
       potentially overlap), we cannot easily tell from the addresses
       whether the references overlap.  */
    if (MEM_P (rtlx) && MEM_P (rtly)
--- 2363,2369 ----
        && ! rtx_equal_p (rtlx, rtly))
      return 1;
  
!   /* If we have MEMs referring to different address spaces (which can
       potentially overlap), we cannot easily tell from the addresses
       whether the references overlap.  */
    if (MEM_P (rtlx) && MEM_P (rtly)
*************** true_dependence_1 (const_rtx mem, enum m
*** 2471,2477 ****
    if (MEM_READONLY_P (x))
      return 0;
  
!   /* If we have MEMs refering to different address spaces (which can
       potentially overlap), we cannot easily tell from the addresses
       whether the references overlap.  */
    if (MEM_ADDR_SPACE (mem) != MEM_ADDR_SPACE (x))
--- 2471,2477 ----
    if (MEM_READONLY_P (x))
      return 0;
  
!   /* If we have MEMs referring to different address spaces (which can
       potentially overlap), we cannot easily tell from the addresses
       whether the references overlap.  */
    if (MEM_ADDR_SPACE (mem) != MEM_ADDR_SPACE (x))
*************** write_dependence_p (const_rtx mem, const
*** 2589,2595 ****
    if (!writep && MEM_READONLY_P (mem))
      return 0;
  
!   /* If we have MEMs refering to different address spaces (which can
       potentially overlap), we cannot easily tell from the addresses
       whether the references overlap.  */
    if (MEM_ADDR_SPACE (mem) != MEM_ADDR_SPACE (x))
--- 2589,2595 ----
    if (!writep && MEM_READONLY_P (mem))
      return 0;
  
!   /* If we have MEMs referring to different address spaces (which can
       potentially overlap), we cannot easily tell from the addresses
       whether the references overlap.  */
    if (MEM_ADDR_SPACE (mem) != MEM_ADDR_SPACE (x))
*************** may_alias_p (const_rtx mem, const_rtx x)
*** 2676,2682 ****
    if (MEM_READONLY_P (x))
      return 0;
  
!   /* If we have MEMs refering to different address spaces (which can
       potentially overlap), we cannot easily tell from the addresses
       whether the references overlap.  */
    if (MEM_ADDR_SPACE (mem) != MEM_ADDR_SPACE (x))
--- 2676,2682 ----
    if (MEM_READONLY_P (x))
      return 0;
  
!   /* If we have MEMs referring to different address spaces (which can
       potentially overlap), we cannot easily tell from the addresses
       whether the references overlap.  */
    if (MEM_ADDR_SPACE (mem) != MEM_ADDR_SPACE (x))
Index: ipa.c
===================================================================
*** ipa.c	(revision 186559)
--- ipa.c	(working copy)
*************** process_references (struct ipa_ref_list 
*** 91,97 ****
    struct ipa_ref *ref;
    for (i = 0; ipa_ref_list_reference_iterate (list, i, ref); i++)
      {
!       if (ref->refered_type == IPA_REF_CGRAPH)
  	{
  	  struct cgraph_node *node = ipa_ref_node (ref);
  	  if (!node->reachable
--- 91,97 ----
    struct ipa_ref *ref;
    for (i = 0; ipa_ref_list_reference_iterate (list, i, ref); i++)
      {
!       if (symtab_function_p (ref->referred))
  	{
  	  struct cgraph_node *node = ipa_ref_node (ref);
  	  if (!node->reachable
*************** has_addr_references_p (struct cgraph_nod
*** 154,160 ****
    int i;
    struct ipa_ref *ref;
  
!   for (i = 0; ipa_ref_list_refering_iterate (&node->symbol.ref_list,
  					     i, ref); i++)
      if (ref->use == IPA_REF_ADDR)
        return true;
--- 154,160 ----
    int i;
    struct ipa_ref *ref;
  
!   for (i = 0; ipa_ref_list_referring_iterate (&node->symbol.ref_list,
  					     i, ref); i++)
      if (ref->use == IPA_REF_ADDR)
        return true;
*************** cgraph_remove_unreachable_nodes (bool be
*** 352,365 ****
  	  for (e = node->callers; e && !found; e = e->next_caller)
  	    if (e->caller->reachable)
  	      found = true;
! 	  for (i = 0; (ipa_ref_list_refering_iterate (&node->symbol.ref_list,
  						      i, ref)
  		       && !found); i++)
! 	    if (ref->refering_type == IPA_REF_CGRAPH
! 		&& ipa_ref_refering_node (ref)->reachable)
  	      found = true;
! 	    else if (ref->refering_type == IPA_REF_VARPOOL
! 		     && ipa_ref_refering_varpool_node (ref)->needed)
  	      found = true;
  
  	  /* If so, we need to keep node in the callgraph.  */
--- 352,365 ----
  	  for (e = node->callers; e && !found; e = e->next_caller)
  	    if (e->caller->reachable)
  	      found = true;
! 	  for (i = 0; (ipa_ref_list_referring_iterate (&node->symbol.ref_list,
  						      i, ref)
  		       && !found); i++)
! 	    if (symtab_function_p (ref->referring)
! 		&& ipa_ref_referring_node (ref)->reachable)
  	      found = true;
! 	    else if (symtab_variable_p (ref->referring)
! 		     && ipa_ref_referring_varpool_node (ref)->needed)
  	      found = true;
  
  	  /* If so, we need to keep node in the callgraph.  */
*************** ipa_discover_readonly_nonaddressable_var
*** 501,507 ****
  	bool address_taken = false;
  	int i;
          struct ipa_ref *ref;
!         for (i = 0; ipa_ref_list_refering_iterate (&vnode->symbol.ref_list,
  						   i, ref)
  		    && (!written || !address_taken); i++)
  	  switch (ref->use)
--- 501,507 ----
  	bool address_taken = false;
  	int i;
          struct ipa_ref *ref;
!         for (i = 0; ipa_ref_list_referring_iterate (&vnode->symbol.ref_list,
  						   i, ref)
  		    && (!written || !address_taken); i++)
  	  switch (ref->use)
*************** cgraph_address_taken_from_non_vtable_p (
*** 542,555 ****
  {
    int i;
    struct ipa_ref *ref;
!   for (i = 0; ipa_ref_list_refering_iterate (&node->symbol.ref_list,
  					     i, ref); i++)
      if (ref->use == IPA_REF_ADDR)
        {
  	struct varpool_node *node;
! 	if (ref->refering_type == IPA_REF_CGRAPH)
  	  return true;
! 	node = ipa_ref_refering_varpool_node (ref);
  	if (!DECL_VIRTUAL_P (node->symbol.decl))
  	  return true;
        }
--- 542,555 ----
  {
    int i;
    struct ipa_ref *ref;
!   for (i = 0; ipa_ref_list_referring_iterate (&node->symbol.ref_list,
  					     i, ref); i++)
      if (ref->use == IPA_REF_ADDR)
        {
  	struct varpool_node *node;
! 	if (symtab_function_p (ref->referring))
  	  return true;
! 	node = ipa_ref_referring_varpool_node (ref);
  	if (!DECL_VIRTUAL_P (node->symbol.decl))
  	  return true;
        }
Index: trans-mem.c
===================================================================
*** trans-mem.c	(revision 186558)
--- trans-mem.c	(working copy)
*************** ipa_tm_execute (void)
*** 4931,4939 ****
  	}
  
        /* Propagate back to referring aliases as well.  */
!       for (j = 0; ipa_ref_list_refering_iterate (&node->symbol.ref_list, j, ref); j++)
  	{
! 	  caller = ref->refering.cgraph_node;
  	  if (ref->use == IPA_REF_ALIAS
  	      && !caller->local.tm_may_enter_irr)
  	    {
--- 4931,4939 ----
  	}
  
        /* Propagate back to referring aliases as well.  */
!       for (j = 0; ipa_ref_list_referring_iterate (&node->symbol.ref_list, j, ref); j++)
  	{
! 	  caller = cgraph (ref->referring);
  	  if (ref->use == IPA_REF_ALIAS
  	      && !caller->local.tm_may_enter_irr)
  	    {
Index: simplify-rtx.c
===================================================================
*** simplify-rtx.c	(revision 186558)
--- simplify-rtx.c	(working copy)
*************** simplify_unary_operation_1 (enum rtx_cod
*** 1140,1146 ****
  	}
  
  #if defined(POINTERS_EXTEND_UNSIGNED) && !defined(HAVE_ptr_extend)
!       /* As we do not know which address space the pointer is refering to,
  	 we can do this only if the target does not support different pointer
  	 or address modes depending on the address space.  */
        if (target_default_pointer_address_modes_p ()
--- 1140,1146 ----
  	}
  
  #if defined(POINTERS_EXTEND_UNSIGNED) && !defined(HAVE_ptr_extend)
!       /* As we do not know which address space the pointer is referring to,
  	 we can do this only if the target does not support different pointer
  	 or address modes depending on the address space.  */
        if (target_default_pointer_address_modes_p ()
*************** simplify_unary_operation_1 (enum rtx_cod
*** 1233,1239 ****
  	}
  
  #if defined(POINTERS_EXTEND_UNSIGNED) && !defined(HAVE_ptr_extend)
!       /* As we do not know which address space the pointer is refering to,
  	 we can do this only if the target does not support different pointer
  	 or address modes depending on the address space.  */
        if (target_default_pointer_address_modes_p ()
--- 1233,1239 ----
  	}
  
  #if defined(POINTERS_EXTEND_UNSIGNED) && !defined(HAVE_ptr_extend)
!       /* As we do not know which address space the pointer is referring to,
  	 we can do this only if the target does not support different pointer
  	 or address modes depending on the address space.  */
        if (target_default_pointer_address_modes_p ()
Index: lto/lto-partition.c
===================================================================
*** lto/lto-partition.c	(revision 186558)
--- lto/lto-partition.c	(working copy)
*************** add_references_to_partition (ltrans_part
*** 72,78 ****
    struct ipa_ref *ref;
    for (i = 0; ipa_ref_list_reference_iterate (refs, i, ref); i++)
      {
!       if (ref->refered_type == IPA_REF_CGRAPH
  	  && (DECL_COMDAT (cgraph_function_node (ipa_ref_node (ref),
  			   NULL)->symbol.decl)
  	      || (ref->use == IPA_REF_ALIAS
--- 72,78 ----
    struct ipa_ref *ref;
    for (i = 0; ipa_ref_list_reference_iterate (refs, i, ref); i++)
      {
!       if (symtab_function_p (ref->referred)
  	  && (DECL_COMDAT (cgraph_function_node (ipa_ref_node (ref),
  			   NULL)->symbol.decl)
  	      || (ref->use == IPA_REF_ALIAS
*************** add_references_to_partition (ltrans_part
*** 81,87 ****
  	  && !cgraph_node_in_set_p (ipa_ref_node (ref), part->cgraph_set))
  	add_cgraph_node_to_partition (part, ipa_ref_node (ref));
        else
! 	if (ref->refered_type == IPA_REF_VARPOOL
  	    && (DECL_COMDAT (ipa_ref_varpool_node (ref)->symbol.decl)
  	        || (ref->use == IPA_REF_ALIAS
  		    && lookup_attribute
--- 81,87 ----
  	  && !cgraph_node_in_set_p (ipa_ref_node (ref), part->cgraph_set))
  	add_cgraph_node_to_partition (part, ipa_ref_node (ref));
        else
!         if (symtab_variable_p (ref->referred)
  	    && (DECL_COMDAT (ipa_ref_varpool_node (ref)->symbol.decl)
  	        || (ref->use == IPA_REF_ALIAS
  		    && lookup_attribute
*************** add_references_to_partition (ltrans_part
*** 91,116 ****
  				       part->varpool_set))
  	  add_varpool_node_to_partition (part, ipa_ref_varpool_node (ref));
      }
!   for (i = 0; ipa_ref_list_refering_iterate (refs, i, ref); i++)
      {
!       if (ref->refering_type == IPA_REF_CGRAPH
  	  && ref->use == IPA_REF_ALIAS
! 	  && !cgraph_node_in_set_p (ipa_ref_refering_node (ref),
  				    part->cgraph_set)
  	  && !lookup_attribute ("weakref",
  				DECL_ATTRIBUTES
! 				  (ipa_ref_refering_node (ref)->symbol.decl)))
! 	add_cgraph_node_to_partition (part, ipa_ref_refering_node (ref));
        else
! 	if (ref->refering_type == IPA_REF_VARPOOL
  	    && ref->use == IPA_REF_ALIAS
! 	    && !varpool_node_in_set_p (ipa_ref_refering_varpool_node (ref),
  				       part->varpool_set)
  	    && !lookup_attribute ("weakref",
  				  DECL_ATTRIBUTES
! 				    (ipa_ref_refering_varpool_node (ref)->symbol.decl)))
  	  add_varpool_node_to_partition (part,
! 					 ipa_ref_refering_varpool_node (ref));
      }
  }
  
--- 91,116 ----
  				       part->varpool_set))
  	  add_varpool_node_to_partition (part, ipa_ref_varpool_node (ref));
      }
!   for (i = 0; ipa_ref_list_referring_iterate (refs, i, ref); i++)
      {
!       if (symtab_function_p (ref->referring)
  	  && ref->use == IPA_REF_ALIAS
! 	  && !cgraph_node_in_set_p (ipa_ref_referring_node (ref),
  				    part->cgraph_set)
  	  && !lookup_attribute ("weakref",
  				DECL_ATTRIBUTES
! 				  (ipa_ref_referring_node (ref)->symbol.decl)))
! 	add_cgraph_node_to_partition (part, ipa_ref_referring_node (ref));
        else
!         if (symtab_variable_p (ref->referring)
  	    && ref->use == IPA_REF_ALIAS
! 	    && !varpool_node_in_set_p (ipa_ref_referring_varpool_node (ref),
  				       part->varpool_set)
  	    && !lookup_attribute ("weakref",
  				  DECL_ATTRIBUTES
! 				    (ipa_ref_referring_varpool_node (ref)->symbol.decl)))
  	  add_varpool_node_to_partition (part,
! 					 ipa_ref_referring_varpool_node (ref));
      }
  }
  
*************** lto_balanced_map (void)
*** 612,618 ****
  	  /* Compute boundary cost of IPA REF edges and at the same time look into
  	     variables referenced from current partition and try to add them.  */
  	  for (j = 0; ipa_ref_list_reference_iterate (refs, j, ref); j++)
! 	    if (ref->refered_type == IPA_REF_VARPOOL)
  	      {
  		varpool_node_set_iterator vsi;
  
--- 612,618 ----
  	  /* Compute boundary cost of IPA REF edges and at the same time look into
  	     variables referenced from current partition and try to add them.  */
  	  for (j = 0; ipa_ref_list_reference_iterate (refs, j, ref); j++)
! 	    if (symtab_variable_p (ref->referred))
  	      {
  		varpool_node_set_iterator vsi;
  
*************** lto_balanced_map (void)
*** 643,654 ****
  		else
  		  cost++;
  	      }
! 	  for (j = 0; ipa_ref_list_refering_iterate (refs, j, ref); j++)
! 	    if (ref->refering_type == IPA_REF_VARPOOL)
  	      {
  		varpool_node_set_iterator vsi;
  
! 		vnode = ipa_ref_refering_varpool_node (ref);
  		gcc_assert (vnode->finalized);
  		if (!vnode->symbol.aux && flag_toplevel_reorder
  		    && partition_varpool_node_p (vnode))
--- 643,654 ----
  		else
  		  cost++;
  	      }
! 	  for (j = 0; ipa_ref_list_referring_iterate (refs, j, ref); j++)
! 	    if (symtab_variable_p (ref->referring))
  	      {
  		varpool_node_set_iterator vsi;
  
! 		vnode = ipa_ref_referring_varpool_node (ref);
  		gcc_assert (vnode->finalized);
  		if (!vnode->symbol.aux && flag_toplevel_reorder
  		    && partition_varpool_node_p (vnode))
*************** lto_balanced_map (void)
*** 664,670 ****
  	      {
  		cgraph_node_set_iterator csi;
  
! 		node = ipa_ref_refering_node (ref);
  		gcc_assert (node->analyzed);
  		csi = cgraph_node_set_find (partition->cgraph_set, node);
  		if (!csi_end_p (csi)
--- 664,670 ----
  	      {
  		cgraph_node_set_iterator csi;
  
! 		node = ipa_ref_referring_node (ref);
  		gcc_assert (node->analyzed);
  		csi = cgraph_node_set_find (partition->cgraph_set, node);
  		if (!csi_end_p (csi)
*************** lto_promote_cross_file_statics (void)
*** 876,882 ****
  	       ipa_ref_list_reference_iterate (&vnode->symbol.ref_list, i, ref);
  	       i++)
  	    {
! 	      if (ref->refered_type == IPA_REF_CGRAPH)
  		{
  		  struct cgraph_node *n = ipa_ref_node (ref);
  		  gcc_assert (!n->global.inlined_to);
--- 876,882 ----
  	       ipa_ref_list_reference_iterate (&vnode->symbol.ref_list, i, ref);
  	       i++)
  	    {
! 	      if (symtab_function_p (ref->referred))
  		{
  		  struct cgraph_node *n = ipa_ref_node (ref);
  		  gcc_assert (!n->global.inlined_to);
Index: rtl.c
===================================================================
*** rtl.c	(revision 186558)
--- rtl.c	(working copy)
*************** rtx_equal_p_cb (const_rtx x, const_rtx y
*** 381,387 ****
    if (GET_MODE (x) != GET_MODE (y))
      return 0;
  
!   /* MEMs refering to different address space are not equivalent.  */
    if (code == MEM && MEM_ADDR_SPACE (x) != MEM_ADDR_SPACE (y))
      return 0;
  
--- 381,387 ----
    if (GET_MODE (x) != GET_MODE (y))
      return 0;
  
!   /* MEMs referring to different address space are not equivalent.  */
    if (code == MEM && MEM_ADDR_SPACE (x) != MEM_ADDR_SPACE (y))
      return 0;
  
*************** rtx_equal_p (const_rtx x, const_rtx y)
*** 520,526 ****
    if (GET_MODE (x) != GET_MODE (y))
      return 0;
  
!   /* MEMs refering to different address space are not equivalent.  */
    if (code == MEM && MEM_ADDR_SPACE (x) != MEM_ADDR_SPACE (y))
      return 0;
  
--- 520,526 ----
    if (GET_MODE (x) != GET_MODE (y))
      return 0;
  
!   /* MEMs referring to different address space are not equivalent.  */
    if (code == MEM && MEM_ADDR_SPACE (x) != MEM_ADDR_SPACE (y))
      return 0;
  
Index: symtab.c
===================================================================
*** symtab.c	(revision 186559)
--- symtab.c	(working copy)
*************** symtab_unregister_node (symtab_node node
*** 191,197 ****
  {
    void **slot;
    ipa_remove_all_references (&node->symbol.ref_list);
!   ipa_remove_all_refering (&node->symbol.ref_list);
  
    if (node->symbol.same_comdat_group)
      {
--- 191,197 ----
  {
    void **slot;
    ipa_remove_all_references (&node->symbol.ref_list);
!   ipa_remove_all_referring (&node->symbol.ref_list);
  
    if (node->symbol.same_comdat_group)
      {
*************** dump_symtab_base (FILE *f, symtab_node n
*** 429,436 ****
  
    fprintf (f, "  References: ");
    ipa_dump_references (f, &node->symbol.ref_list);
!   fprintf (f, "  Refering: ");
!   ipa_dump_refering (f, &node->symbol.ref_list);
  }
  
  /* Dump symtab node.  */
--- 429,436 ----
  
    fprintf (f, "  References: ");
    ipa_dump_references (f, &node->symbol.ref_list);
!   fprintf (f, "  Referring: ");
!   ipa_dump_referring (f, &node->symbol.ref_list);
  }
  
  /* Dump symtab node.  */
Index: varpool.c
===================================================================
*** varpool.c	(revision 186559)
--- varpool.c	(working copy)
*************** varpool_analyze_pending_decls (void)
*** 380,386 ****
  		continue;
  	      }
  	  if (!VEC_length (ipa_ref_t, node->symbol.ref_list.references))
! 	    ipa_record_reference (NULL, node, NULL, tgt, IPA_REF_ALIAS, NULL);
  	  /* C++ FE sometimes change linkage flags after producing same body aliases.  */
  	  if (node->extra_name_alias)
  	    {
--- 380,386 ----
  		continue;
  	      }
  	  if (!VEC_length (ipa_ref_t, node->symbol.ref_list.references))
! 	    ipa_record_reference ((symtab_node)node, (symtab_node)tgt, IPA_REF_ALIAS, NULL);
  	  /* C++ FE sometimes change linkage flags after producing same body aliases.  */
  	  if (node->extra_name_alias)
  	    {
*************** assemble_aliases (struct varpool_node *n
*** 433,442 ****
  {
    int i;
    struct ipa_ref *ref;
!   for (i = 0; ipa_ref_list_refering_iterate (&node->symbol.ref_list, i, ref); i++)
      if (ref->use == IPA_REF_ALIAS)
        {
! 	struct varpool_node *alias = ipa_ref_refering_varpool_node (ref);
  	assemble_alias (alias->symbol.decl,
  			DECL_ASSEMBLER_NAME (alias->alias_of));
  	assemble_aliases (alias);
--- 433,442 ----
  {
    int i;
    struct ipa_ref *ref;
!   for (i = 0; ipa_ref_list_referring_iterate (&node->symbol.ref_list, i, ref); i++)
      if (ref->use == IPA_REF_ALIAS)
        {
! 	struct varpool_node *alias = ipa_ref_referring_varpool_node (ref);
  	assemble_alias (alias->symbol.decl,
  			DECL_ASSEMBLER_NAME (alias->alias_of));
  	assemble_aliases (alias);
*************** varpool_for_node_and_aliases (struct var
*** 676,685 ****
  
    if (callback (node, data))
      return true;
!   for (i = 0; ipa_ref_list_refering_iterate (&node->symbol.ref_list, i, ref); i++)
      if (ref->use == IPA_REF_ALIAS)
        {
! 	struct varpool_node *alias = ipa_ref_refering_varpool_node (ref);
  	if (include_overwritable
  	    || cgraph_variable_initializer_availability (alias) > AVAIL_OVERWRITABLE)
            if (varpool_for_node_and_aliases (alias, callback, data,
--- 676,685 ----
  
    if (callback (node, data))
      return true;
!   for (i = 0; ipa_ref_list_referring_iterate (&node->symbol.ref_list, i, ref); i++)
      if (ref->use == IPA_REF_ALIAS)
        {
! 	struct varpool_node *alias = ipa_ref_referring_varpool_node (ref);
  	if (include_overwritable
  	    || cgraph_variable_initializer_availability (alias) > AVAIL_OVERWRITABLE)
            if (varpool_for_node_and_aliases (alias, callback, data,

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-04-18  8:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-18  8:23 Symbol table 8/many: ipa-ref API reorg Jan Hubicka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).