Exemple #1
0
/* Dump given cgraph node.  */
void
dump_varpool_node (FILE *f, varpool_node *node)
{
  dump_symtab_base (f, node);
  fprintf (f, "  Availability: %s\n",
	   cgraph_function_flags_ready
	   ? cgraph_availability_names[cgraph_variable_initializer_availability (node)]
	   : "not-ready");
  fprintf (f, "  Varpool flags:");
  if (DECL_INITIAL (node->decl))
    fprintf (f, " initialized");
  if (node->output)
    fprintf (f, " output");
  if (node->used_by_single_function)
    fprintf (f, " used-by-single-function");
  if (TREE_READONLY (node->decl))
    fprintf (f, " read-only");
  if (ctor_for_folding (node->decl) != error_mark_node)
    fprintf (f, " const-value-known");
  if (node->writeonly)
    fprintf (f, " write-only");
  if (node->tls_model)
    fprintf (f, " %s", tls_model_names [node->tls_model]);
  fprintf (f, "\n");
}
Exemple #2
0
/* Remove node from the varpool.  */
void
varpool_remove_node (varpool_node *node)
{
  tree init;
  varpool_call_node_removal_hooks (node);
  symtab_unregister_node (node);

  /* Because we remove references from external functions before final compilation,
     we may end up removing useful constructors.
     FIXME: We probably want to trace boundaries better.  */
  if (cgraph_state == CGRAPH_LTO_STREAMING)
    ;
  else if ((init = ctor_for_folding (node->decl)) == error_mark_node)
    varpool_remove_initializer (node);
  else
    DECL_INITIAL (node->decl) = init;
  ggc_free (node);
}
Exemple #3
0
static bool
constant_after_peeling (tree op, gimple *stmt, struct loop *loop)
{
  affine_iv iv;

  if (is_gimple_min_invariant (op))
    return true;

  /* We can still fold accesses to constant arrays when index is known.  */
  if (TREE_CODE (op) != SSA_NAME)
    {
      tree base = op;

      /* First make fast look if we see constant array inside.  */
      while (handled_component_p (base))
	base = TREE_OPERAND (base, 0);
      if ((DECL_P (base)
	   && ctor_for_folding (base) != error_mark_node)
	  || CONSTANT_CLASS_P (base))
	{
	  /* If so, see if we understand all the indices.  */
	  base = op;
	  while (handled_component_p (base))
	    {
	      if (TREE_CODE (base) == ARRAY_REF
		  && !constant_after_peeling (TREE_OPERAND (base, 1), stmt, loop))
		return false;
	      base = TREE_OPERAND (base, 0);
	    }
	  return true;
	}
      return false;
    }

  /* Induction variables are constants.  */
  if (!simple_iv (loop, loop_containing_stmt (stmt), op, &iv, false))
    return false;
  if (!is_gimple_min_invariant (iv.base))
    return false;
  if (!is_gimple_min_invariant (iv.step))
    return false;
  return true;
}