Ejemplo n.º 1
0
/* Given an assembler name, lookup node.  */
struct varpool_node *
varpool_node_for_asm (tree asmname)
{
  symtab_node node = symtab_node_for_asm (asmname);
  if (node && symtab_variable_p (node))
    return varpool (node);
  return NULL;
}
Ejemplo n.º 2
0
Archivo: varpool.c Proyecto: palves/gcc
/* Given an assembler name, lookup node.  */
varpool_node *
varpool_node_for_asm (tree asmname)
{
  if (symtab_node *node = symtab_node_for_asm (asmname))
    return dyn_cast <varpool_node *> (node);
  else
    return NULL;
}
Ejemplo n.º 3
0
Archivo: varpool.c Proyecto: Lao16/gcc
/* Given an assembler name, lookup node.  */
struct varpool_node *
varpool_node_for_asm (tree asmname)
{
  if (symtab_node node = symtab_node_for_asm (asmname))
    if (varpool_node *vnode = dyn_cast <varpool_node> (node))
      return vnode;
  return NULL;
}
Ejemplo n.º 4
0
void
lto_symtab_merge_symbols (void)
{
  symtab_node node;

  if (!flag_ltrans)
    {
      symtab_initialize_asm_name_hash ();

      /* Do the actual merging.  
         At this point we invalidate hash translating decls into symtab nodes
	 because after removing one of duplicate decls the hash is not correcly
	 updated to the ohter dupliate.  */
      FOR_EACH_SYMBOL (node)
	if (lto_symtab_symbol_p (node)
	    && node->symbol.next_sharing_asm_name
	    && !node->symbol.previous_sharing_asm_name)
	  lto_symtab_merge_symbols_1 (node);

      /* Resolve weakref aliases whose target are now in the compilation unit.  
	 also re-populate the hash translating decls into symtab nodes*/
      FOR_EACH_SYMBOL (node)
	{
	  cgraph_node *cnode, *cnode2;
	  if (!node->symbol.analyzed && node->symbol.alias_target)
	    {
	      symtab_node tgt = symtab_node_for_asm (node->symbol.alias_target);
	      gcc_assert (node->symbol.weakref);
	      if (tgt)
		symtab_resolve_alias (node, tgt);
	    }
	  node->symbol.aux = NULL;
	  
	  if (!(cnode = dyn_cast <cgraph_node> (node))
	      || !cnode->clone_of
	      || cnode->clone_of->symbol.decl != cnode->symbol.decl)
	    {
	      if (cnode && DECL_BUILT_IN (node->symbol.decl)
		  && (cnode2 = cgraph_get_node (node->symbol.decl))
		  && cnode2 != cnode)
		lto_cgraph_replace_node (cnode2, cnode);
	      symtab_insert_node_to_hashtable ((symtab_node)node);
	    }
	}
    }
Ejemplo n.º 5
0
DEBUG_FUNCTION bool
verify_symtab_base (symtab_node node)
{
  bool error_found = false;
  symtab_node hashed_node;

  if (symtab_function_p (node))
    {
      if (TREE_CODE (node->symbol.decl) != FUNCTION_DECL)
	{
          error ("function symbol is not function");
          error_found = true;
	}
    }
  else if (symtab_variable_p (node))
    {
      if (TREE_CODE (node->symbol.decl) != VAR_DECL)
	{
          error ("variable symbol is not variable");
          error_found = true;
	}
    }
  else
    {
      error ("node has unknown type");
      error_found = true;
    }
   
  hashed_node = symtab_get_node (node->symbol.decl);
  if (!hashed_node)
    {
      error ("node not found in symtab decl hashtable");
      error_found = true;
    }
  if (assembler_name_hash)
    {
      hashed_node = symtab_node_for_asm (DECL_ASSEMBLER_NAME (node->symbol.decl));
      if (hashed_node && hashed_node->symbol.previous_sharing_asm_name)
	{
          error ("assembler name hash list corrupted");
          error_found = true;
	}
      while (hashed_node)
	{
	  if (hashed_node == node)
	    break;
	  hashed_node = hashed_node->symbol.next_sharing_asm_name;
	}
      if (!hashed_node)
	{
          error ("node not found in symtab assembler name hash");
          error_found = true;
	}
    }
  if (node->symbol.previous_sharing_asm_name
      && node->symbol.previous_sharing_asm_name->symbol.next_sharing_asm_name != node)
    {
      error ("double linked list of assembler names corrupted");
    }
  if (node->symbol.same_comdat_group)
    {
      symtab_node n = node->symbol.same_comdat_group;

      if (!DECL_ONE_ONLY (n->symbol.decl))
	{
	  error ("non-DECL_ONE_ONLY node in a same_comdat_group list");
	  error_found = true;
	}
      if (n->symbol.type != node->symbol.type)
	{
	  error ("mixing different types of symbol in same comdat groups is not supported");
	  error_found = true;
	}
      if (n == node)
	{
	  error ("node is alone in a comdat group");
	  error_found = true;
	}
      do
	{
	  if (!n->symbol.same_comdat_group)
	    {
	      error ("same_comdat_group is not a circular list");
	      error_found = true;
	      break;
	    }
	  n = n->symbol.same_comdat_group;
	}
      while (n != node);
    }
  return error_found;
}
Ejemplo n.º 6
0
Archivo: symtab.c Proyecto: Roffi/gcc
DEBUG_FUNCTION bool
verify_symtab_base (symtab_node node)
{
  bool error_found = false;
  symtab_node hashed_node;

  if (is_a <cgraph_node> (node))
    {
      if (TREE_CODE (node->symbol.decl) != FUNCTION_DECL)
	{
          error ("function symbol is not function");
          error_found = true;
	}
    }
  else if (is_a <varpool_node> (node))
    {
      if (TREE_CODE (node->symbol.decl) != VAR_DECL)
	{
          error ("variable symbol is not variable");
          error_found = true;
	}
    }
  else
    {
      error ("node has unknown type");
      error_found = true;
    }
   
  if (cgraph_state != CGRAPH_LTO_STREAMING)
    {
      hashed_node = symtab_get_node (node->symbol.decl);
      if (!hashed_node)
	{
	  error ("node not found in symtab decl hashtable");
	  error_found = true;
	}
      if (hashed_node != node
	  && (!is_a <cgraph_node> (node)
	      || !dyn_cast <cgraph_node> (node)->clone_of
	      || dyn_cast <cgraph_node> (node)->clone_of->symbol.decl
		 != node->symbol.decl))
	{
	  error ("node differs from symtab decl hashtable");
	  error_found = true;
	}
    }
  if (assembler_name_hash)
    {
      hashed_node = symtab_node_for_asm (DECL_ASSEMBLER_NAME (node->symbol.decl));
      if (hashed_node && hashed_node->symbol.previous_sharing_asm_name)
	{
          error ("assembler name hash list corrupted");
          error_found = true;
	}
      while (hashed_node)
	{
	  if (hashed_node == node)
	    break;
	  hashed_node = hashed_node->symbol.next_sharing_asm_name;
	}
      if (!hashed_node
          && !(is_a <varpool_node> (node)
	       || DECL_HARD_REGISTER (node->symbol.decl)))
	{
          error ("node not found in symtab assembler name hash");
          error_found = true;
	}
    }
  if (node->symbol.previous_sharing_asm_name
      && node->symbol.previous_sharing_asm_name->symbol.next_sharing_asm_name != node)
    {
      error ("double linked list of assembler names corrupted");
      error_found = true;
    }
  if (node->symbol.analyzed && !node->symbol.definition)
    {
      error ("node is analyzed byt it is not a definition");
      error_found = true;
    }
  if (node->symbol.cpp_implicit_alias && !node->symbol.alias)
    {
      error ("node is alias but not implicit alias");
      error_found = true;
    }
  if (node->symbol.alias && !node->symbol.definition
      && !node->symbol.weakref)
    {
      error ("node is alias but not definition");
      error_found = true;
    }
  if (node->symbol.weakref && !node->symbol.alias)
    {
      error ("node is weakref but not an alias");
      error_found = true;
    }
  if (node->symbol.same_comdat_group)
    {
      symtab_node n = node->symbol.same_comdat_group;

      if (!DECL_ONE_ONLY (n->symbol.decl))
	{
	  error ("non-DECL_ONE_ONLY node in a same_comdat_group list");
	  error_found = true;
	}
      if (n->symbol.type != node->symbol.type)
	{
	  error ("mixing different types of symbol in same comdat groups is not supported");
	  error_found = true;
	}
      if (n == node)
	{
	  error ("node is alone in a comdat group");
	  error_found = true;
	}
      do
	{
	  if (!n->symbol.same_comdat_group)
	    {
	      error ("same_comdat_group is not a circular list");
	      error_found = true;
	      break;
	    }
	  n = n->symbol.same_comdat_group;
	}
      while (n != node);
    }
  return error_found;
}
Ejemplo n.º 7
0
DEBUG_FUNCTION bool
verify_symtab_base (symtab_node *node)
{
  bool error_found = false;
  symtab_node *hashed_node;

  if (is_a <cgraph_node> (node))
    {
      if (TREE_CODE (node->decl) != FUNCTION_DECL)
	{
          error ("function symbol is not function");
          error_found = true;
	}
    }
  else if (is_a <varpool_node> (node))
    {
      if (TREE_CODE (node->decl) != VAR_DECL)
	{
          error ("variable symbol is not variable");
          error_found = true;
	}
    }
  else
    {
      error ("node has unknown type");
      error_found = true;
    }
   
  if (cgraph_state != CGRAPH_LTO_STREAMING)
    {
      hashed_node = symtab_get_node (node->decl);
      if (!hashed_node)
	{
	  error ("node not found in symtab decl hashtable");
	  error_found = true;
	}
      if (hashed_node != node
	  && (!is_a <cgraph_node> (node)
	      || !dyn_cast <cgraph_node> (node)->clone_of
	      || dyn_cast <cgraph_node> (node)->clone_of->decl
		 != node->decl))
	{
	  error ("node differs from symtab decl hashtable");
	  error_found = true;
	}
    }
  if (assembler_name_hash)
    {
      hashed_node = symtab_node_for_asm (DECL_ASSEMBLER_NAME (node->decl));
      if (hashed_node && hashed_node->previous_sharing_asm_name)
	{
          error ("assembler name hash list corrupted");
          error_found = true;
	}
      while (hashed_node)
	{
	  if (hashed_node == node)
	    break;
	  hashed_node = hashed_node->next_sharing_asm_name;
	}
      if (!hashed_node
          && !(is_a <varpool_node> (node)
	       || DECL_HARD_REGISTER (node->decl)))
	{
          error ("node not found in symtab assembler name hash");
          error_found = true;
	}
    }
  if (node->previous_sharing_asm_name
      && node->previous_sharing_asm_name->next_sharing_asm_name != node)
    {
      error ("double linked list of assembler names corrupted");
      error_found = true;
    }
  if (node->analyzed && !node->definition)
    {
      error ("node is analyzed byt it is not a definition");
      error_found = true;
    }
  if (node->cpp_implicit_alias && !node->alias)
    {
      error ("node is alias but not implicit alias");
      error_found = true;
    }
  if (node->alias && !node->definition
      && !node->weakref)
    {
      error ("node is alias but not definition");
      error_found = true;
    }
  if (node->weakref && !node->alias)
    {
      error ("node is weakref but not an alias");
      error_found = true;
    }
  if (node->same_comdat_group)
    {
      symtab_node *n = node->same_comdat_group;

      if (!DECL_ONE_ONLY (n->decl))
	{
	  error ("non-DECL_ONE_ONLY node in a same_comdat_group list");
	  error_found = true;
	}
      if (n->type != node->type)
	{
	  error ("mixing different types of symbol in same comdat groups is not supported");
	  error_found = true;
	}
      if (n == node)
	{
	  error ("node is alone in a comdat group");
	  error_found = true;
	}
      do
	{
	  if (!n->same_comdat_group)
	    {
	      error ("same_comdat_group is not a circular list");
	      error_found = true;
	      break;
	    }
	  n = n->same_comdat_group;
	}
      while (n != node);
      if (symtab_comdat_local_p (node))
	{
	  struct ipa_ref_list *refs = &node->ref_list;
	  struct ipa_ref *ref;
	  for (int i = 0; ipa_ref_list_referring_iterate (refs, i, ref); ++i)
	    {
	      if (!symtab_in_same_comdat_p (ref->referring, node))
		{
		  error ("comdat-local symbol referred to by %s outside its "
			 "comdat",
			 identifier_to_locale (ref->referring->name()));
		  error_found = true;
		}
	    }
	}
    }
  return error_found;
}