Exemplo n.º 1
0
/* Return varpool node assigned to DECL.  Create new one when needed.  */
struct varpool_node *
varpool_node (tree decl)
{
  struct varpool_node key, *node, **slot;

  gcc_assert (TREE_CODE (decl) == VAR_DECL
	      && (TREE_STATIC (decl) || DECL_EXTERNAL (decl) || in_lto_p));

  if (!varpool_hash)
    varpool_hash = htab_create_ggc (10, hash_varpool_node,
					   eq_varpool_node, NULL);
  key.decl = decl;
  slot = (struct varpool_node **)
    htab_find_slot (varpool_hash, &key, INSERT);
  if (*slot)
    return *slot;
  node = ggc_alloc_cleared_varpool_node ();
  node->decl = decl;
  node->order = cgraph_order++;
  node->next = varpool_nodes;
  ipa_empty_ref_list (&node->ref_list);
  if (varpool_nodes)
    varpool_nodes->prev = node;
  varpool_nodes = node;
  *slot = node;
  return node;
}
Exemplo n.º 2
0
Arquivo: symtab.c Projeto: Roffi/gcc
void
symtab_register_node (symtab_node node)
{
  struct symtab_node_base key;
  symtab_node *slot;

  node->symbol.next = symtab_nodes;
  node->symbol.previous = NULL;
  if (symtab_nodes)
    symtab_nodes->symbol.previous = node;
  symtab_nodes = node;

  if (!symtab_hash)
    symtab_hash = htab_create_ggc (10, hash_node, eq_node, NULL);
  key.decl = node->symbol.decl;
  slot = (symtab_node *) htab_find_slot (symtab_hash, &key, INSERT);
  if (*slot == NULL)
    *slot = node;

  ipa_empty_ref_list (&node->symbol.ref_list);

  node->symbol.order = symtab_order++;

  /* Be sure to do this last; C++ FE might create new nodes via
     DECL_ASSEMBLER_NAME langhook!  */
  insert_to_assembler_name_hash (node, false);
}
Exemplo n.º 3
0
void
symtab_register_node (symtab_node node)
{
  struct symtab_node_base key;
  symtab_node *slot;

  node->symbol.next = symtab_nodes;
  node->symbol.previous = NULL;
  if (symtab_nodes)
    symtab_nodes->symbol.previous = node;
  symtab_nodes = node;

  if (!symtab_hash)
    symtab_hash = htab_create_ggc (10, hash_node, eq_node, NULL);
  key.decl = node->symbol.decl;
  slot = (symtab_node *) htab_find_slot (symtab_hash, &key, INSERT);
  if (*slot == NULL)
    *slot = node;

  insert_to_assembler_name_hash (node);

  node->symbol.order = symtab_order++;

  ipa_empty_ref_list (&node->symbol.ref_list);
}
Exemplo n.º 4
0
struct varpool_node *
varpool_extra_name_alias (tree alias, tree decl)
{
  struct varpool_node key, *alias_node, *decl_node, **slot;

#ifndef ASM_OUTPUT_DEF
  /* If aliases aren't supported by the assembler, fail.  */
  return false;
#endif

  gcc_assert (TREE_CODE (decl) == VAR_DECL);
  gcc_assert (TREE_CODE (alias) == VAR_DECL);
  /* Make sure the hash table has been created.  */
  decl_node = varpool_node (decl);

  key.decl = alias;

  slot = (struct varpool_node **) htab_find_slot (varpool_hash, &key, INSERT);

  /* If the varpool_node has been already created, fail.  */
  if (*slot)
    return NULL;

  alias_node = ggc_alloc_cleared_varpool_node ();
  alias_node->decl = alias;
  alias_node->alias = 1;
  alias_node->extra_name = decl_node;
  alias_node->next = decl_node->extra_name;
  ipa_empty_ref_list (&alias_node->ref_list);
  if (decl_node->extra_name)
    decl_node->extra_name->prev = alias_node;
  decl_node->extra_name = alias_node;
  *slot = alias_node;
  return alias_node;
}