示例#1
0
/* Output one variable, if necessary.  Return whether we output it.  */
bool
varpool_assemble_decl (struct varpool_node *node)
{
  tree decl = node->decl;

  if (!TREE_ASM_WRITTEN (decl)
      && !node->alias
      && !node->in_other_partition
      && !DECL_EXTERNAL (decl)
      && (TREE_CODE (decl) != VAR_DECL || !DECL_HAS_VALUE_EXPR_P (decl)))
    {
      assemble_variable (decl, 0, 1, 0);
      if (TREE_ASM_WRITTEN (decl))
	{
	  node->next_needed = varpool_assembled_nodes_queue;
	  node->prev_needed = NULL;
	  if (varpool_assembled_nodes_queue)
	    varpool_assembled_nodes_queue->prev_needed = node;
	  varpool_assembled_nodes_queue = node;
	  node->finalized = 1;
	  assemble_aliases (node);
	  return true;
	}
    }

  return false;
}
示例#2
0
文件: varpool.c 项目: davidlee80/gcc
static void
assemble_aliases (varpool_node *node)
{
  struct ipa_ref *ref;

  FOR_EACH_ALIAS (node, ref)
    {
      varpool_node *alias = dyn_cast <varpool_node *> (ref->referring);
      do_assemble_alias (alias->decl,
			 DECL_ASSEMBLER_NAME (node->decl));
      assemble_aliases (alias);
    }
示例#3
0
文件: varpool.c 项目: palves/gcc
static void
assemble_aliases (varpool_node *node)
{
  int i;
  struct ipa_ref *ref;
  for (i = 0; ipa_ref_list_referring_iterate (&node->ref_list, i, ref); i++)
    if (ref->use == IPA_REF_ALIAS)
      {
	varpool_node *alias = ipa_ref_referring_varpool_node (ref);
	do_assemble_alias (alias->decl,
			   DECL_ASSEMBLER_NAME (node->decl));
	assemble_aliases (alias);
      }
}
示例#4
0
文件: varpool.c 项目: palves/gcc
bool
varpool_assemble_decl (varpool_node *node)
{
  tree decl = node->decl;

  /* Aliases are outout when their target is produced or by
     output_weakrefs.  */
  if (node->alias)
    return false;

  /* Constant pool is output from RTL land when the reference
     survive till this level.  */
  if (DECL_IN_CONSTANT_POOL (decl) && TREE_ASM_WRITTEN (decl))
    return false;

  /* Decls with VALUE_EXPR should not be in the varpool at all.  They
     are not real variables, but just info for debugging and codegen.
     Unfortunately at the moment emutls is not updating varpool correctly
     after turning real vars into value_expr vars.  */
  if (DECL_HAS_VALUE_EXPR_P (decl)
      && !targetm.have_tls)
    return false;

  /* Hard register vars do not need to be output.  */
  if (DECL_HARD_REGISTER (decl))
    return false;

  gcc_checking_assert (!TREE_ASM_WRITTEN (decl)
		       && TREE_CODE (decl) == VAR_DECL
		       && !DECL_HAS_VALUE_EXPR_P (decl));

  if (!node->in_other_partition
      && !DECL_EXTERNAL (decl))
    {
      assemble_variable (decl, 0, 1, 0);
      gcc_assert (TREE_ASM_WRITTEN (decl));
      node->definition = true;
      assemble_aliases (node);
      return true;
    }

  return false;
}