This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[lto][patch] Remove dead code


Finishing the regression testing any time now.

2009-01-20  Rafael Avila de Espindola  <espindola@google.com>

	* lto-function-in.c (input_local_field_decl, input_local_type_decl,
input_local_type): Remove.
	(input_local_decl): Don't call the removed functions.
	* lto-function-out.c (output_local_field_decl,
output_local_type_decl, output_local_type): Remove.
	(output_local_decl): Don't call the removed functions.

Cheers,
-- 
Rafael Avila de Espindola

Google | Gordon House | Barrow Street | Dublin 4 | Ireland
Registered in Dublin, Ireland | Registration Number: 368047
diff --git a/gcc/lto-function-in.c b/gcc/lto-function-in.c
index afe27f0..1ddeedc 100644
--- a/gcc/lto-function-in.c
+++ b/gcc/lto-function-in.c
@@ -1327,184 +1327,6 @@ input_local_var_decl (struct lto_input_block *ib, struct data_in *data_in,
   return result;
 }
 
-
-static tree
-input_local_field_decl (struct lto_input_block *ib, struct data_in *data_in, 
-                        struct function *fn, unsigned int i)
-{
-  lto_flags_type flags;
-  tree decl;
-
-  decl = make_node (FIELD_DECL);
-
-  flags = input_tree_flags (ib, FIELD_DECL, true);
-  if (input_line_info (ib, data_in, flags))
-    set_line_info (data_in, decl);
-  process_tree_flags (decl, flags);
-
-  data_in->local_decls[i] = decl;
-
-  /* omit locus, uid */
-  decl->decl_minimal.name = input_local_tree (ib, data_in, fn);
-  decl->decl_minimal.context = input_local_tree (ib, data_in, fn);
-
-  decl->common.type = input_local_tree (ib, data_in, fn);
-
-  decl->decl_common.attributes = input_local_tree (ib, data_in, fn);
-  decl->decl_common.abstract_origin = input_local_tree (ib, data_in, fn);
-
-  decl->decl_common.mode = lto_input_uleb128 (ib);
-  decl->decl_common.align = lto_input_uleb128 (ib);
-  decl->decl_common.off_align = lto_input_uleb128 (ib);
-
-  decl->decl_common.size = input_local_tree (ib, data_in, fn);
-  decl->decl_common.size_unit = input_local_tree (ib, data_in, fn);
-
-  decl->field_decl.offset = input_local_tree (ib, data_in, fn);
-  decl->field_decl.bit_field_type = input_local_tree (ib, data_in, fn);
-  decl->field_decl.qualifier = input_local_tree (ib, data_in, fn);
-  decl->field_decl.bit_offset = input_local_tree (ib, data_in, fn);
-  decl->field_decl.fcontext = input_local_tree (ib, data_in, fn);
-
-  decl->decl_common.initial = input_local_tree (ib, data_in, fn);
-
-  /* lang_specific */
-
-  decl->common.chain = input_local_tree (ib, data_in, fn);
-
-  return decl;
-}
-
-
-static tree
-input_local_type_decl (struct lto_input_block *ib, struct data_in *data_in, 
-                       struct function *fn, unsigned int i)
-{
-  lto_flags_type flags;
-  tree decl;
-
-  decl = make_node (TYPE_DECL);
-
-  flags = input_tree_flags (ib, TYPE_DECL, true);
-  if (input_line_info (ib, data_in, flags))
-    set_line_info (data_in, decl);
-  process_tree_flags (decl, flags);
-
-  data_in->local_decls[i] = decl;
-
-  /* omit locus, uid */
-  /* Must output name before type.  */
-  decl->decl_minimal.name = input_local_tree (ib, data_in, fn);
-  decl->decl_minimal.context = input_local_tree (ib, data_in, fn);
-
-  decl->decl_with_vis.assembler_name = input_local_tree (ib, data_in, fn);
-  decl->decl_with_vis.section_name = input_local_tree (ib, data_in, fn);
-
-  decl->common.type = input_local_tree (ib, data_in, fn);
-
-  decl->decl_common.attributes = input_local_tree (ib, data_in, fn);
-  decl->decl_common.abstract_origin = input_local_tree (ib, data_in, fn);
-
-  decl->decl_common.mode = lto_input_uleb128 (ib);
-  decl->decl_common.align = lto_input_uleb128 (ib);
-
-  decl->decl_common.size = input_local_tree (ib, data_in, fn);
-  decl->decl_common.size_unit = input_local_tree (ib, data_in, fn);
-
-  /* lang_specific */
-  /* omit rtl */
-
-  decl->decl_common.initial = input_local_tree (ib, data_in, fn);
-
-  decl->decl_non_common.saved_tree = input_local_tree (ib, data_in, fn);
-  decl->decl_non_common.arguments = input_local_tree (ib, data_in, fn);
-  decl->decl_non_common.result = input_local_tree (ib, data_in, fn);
-  decl->decl_non_common.vindex = input_local_tree (ib, data_in, fn);
-
-  LTO_DEBUG_UNDENT();
-
-  return decl;
-}
-
-
-static tree
-input_local_type (struct lto_input_block *ib, struct data_in *data_in, 
-                  struct function *fn, unsigned int i, enum tree_code code)
-{
-  tree type;
-
-  type = make_node (code);
-  gcc_assert (TYPE_P (type));
-
-  process_tree_flags (type, input_tree_flags (ib, code, true));
-  /* Clear this flag, since we didn't stream the values cache. */
-  TYPE_CACHED_VALUES_P (type) = 0;
-
-  data_in->local_decls[i] = type;
-
-  LTO_DEBUG_TOKEN ("type");
-  type->common.type = input_local_tree (ib, data_in, fn);
-
-  LTO_DEBUG_TOKEN ("size");
-  type->type.size = input_local_tree (ib, data_in, fn);
-  LTO_DEBUG_TOKEN ("size_unit");
-  type->type.size_unit = input_local_tree (ib, data_in, fn);
-  LTO_DEBUG_TOKEN ("attributes");
-  type->type.attributes = input_local_tree (ib, data_in, fn);
-  LTO_DEBUG_TOKEN ("uid");
-  type->type.uid = lto_input_uleb128 (ib);
-  LTO_DEBUG_TOKEN ("precision");
-  type->type.precision = lto_input_uleb128 (ib);
-  LTO_DEBUG_TOKEN ("mode");
-  type->type.mode = lto_input_uleb128 (ib);
-  LTO_DEBUG_TOKEN ("align");
-  type->type.align = lto_input_uleb128 (ib);
-  LTO_DEBUG_TOKEN ("pointer_to");
-  /* FIXME: I think this is a cache that should not be streamed.  */
-  type->type.pointer_to = input_local_tree (ib, data_in, fn);
-  LTO_DEBUG_TOKEN ("reference_to");
-  type->type.reference_to = input_local_tree (ib, data_in, fn);
-  /* FIXME: Read symtab here, if required.  */
-  LTO_DEBUG_TOKEN ("name");
-  type->type.name = input_local_tree (ib, data_in, fn);
-  LTO_DEBUG_TOKEN ("minval");
-  type->type.minval = input_local_tree (ib, data_in, fn);
-  LTO_DEBUG_TOKEN ("maxval");
-  type->type.maxval = input_local_tree (ib, data_in, fn);
-  LTO_DEBUG_TOKEN ("next_variant");
-  type->type.next_variant = input_local_tree (ib, data_in, fn);
-  LTO_DEBUG_TOKEN ("main_variant");
-  type->type.main_variant = input_local_tree (ib, data_in, fn);
-  /* FIXME:  Handle BINFO.  */
-  /*
-    LTO_DEBUG_TOKEN ("binfo");
-    type->type.binfo = input_local_tree (ib, data_in, fn);
-  */
-  LTO_DEBUG_TOKEN ("context");
-  type->type.context = input_local_tree (ib, data_in, fn);
-  LTO_DEBUG_TOKEN ("canonical");
-  type->type.canonical = input_local_tree (ib, data_in, fn);
-
-  /* Do components last */
-  LTO_DEBUG_TOKEN ("values");
-  {
-    tree values = input_local_tree (ib, data_in, fn);
-    /* If using values cache, creation of integer
-       literals above may have allocated a new cache.
-       In this case, don't clobber it.  */
-    if (!type->type.values)
-      type->type.values = values;
-  }
-
-  LTO_DEBUG_TOKEN ("chain");
-  type->common.chain = input_local_tree (ib, data_in, fn);  /* TYPE_STUB_DECL */
-
-  LTO_DEBUG_UNDENT();
-
-  return type;
-}
-
-
 static tree
 input_local_decl (struct lto_input_block *ib, struct data_in *data_in, 
                   struct function *fn, unsigned int i)
@@ -1525,26 +1347,8 @@ input_local_decl (struct lto_input_block *ib, struct data_in *data_in,
   if ((tag & 0xFFF0) == LTO_parm_decl_body0
       || (tag & 0xFFF0) == LTO_local_var_decl_body0)
     result = input_local_var_decl (ib, data_in, fn, i, tag);
-  else if (tag == LTO_type_decl0)
-    result = input_local_type_decl (ib, data_in, fn, i);
-  else if (tag == LTO_field_decl0)
-    result = input_local_field_decl (ib, data_in, fn, i);
   else
-    {
-      enum tree_code code = tag_to_expr[tag];
-
-      gcc_assert (code);
-      gcc_assert (TREE_CODE_CLASS (code) == tcc_type);
-      
-      result = input_local_type (ib, data_in, fn, i, code);
-    }
-
-  /* DEBUG */
-  /*
-    fprintf (stderr, "LOCAL: ");
-    print_generic_expr (stderr, result, 0);
-    fprintf (stderr, "\n");
-  */
+    gcc_unreachable ();
 
   return result;
 }
diff --git a/gcc/lto-function-out.c b/gcc/lto-function-out.c
index 5885bb9..e64b10a 100644
--- a/gcc/lto-function-out.c
+++ b/gcc/lto-function-out.c
@@ -1396,185 +1396,6 @@ output_local_tree (struct output_block *ob, tree expr)
     output_expr_operand (ob, expr);
 }
 
-
-/* Output the local field declaration DECL to OB.
-   A "local" field declaration is one that that has a
-   dependency on a function context, and should always
-   have been declared within a function.  */
-
-static void
-output_local_field_decl (struct output_block *ob, tree decl)
-{
-  /* tag and flags */
-  output_record_start (ob, NULL, NULL, LTO_field_decl0);
-  output_tree_flags (ob, 0, decl, true);
-
-  /* uid and locus are handled specially */
-  output_local_tree (ob, decl->decl_minimal.name);
-  output_local_tree (ob, decl->decl_minimal.context);
-
-  output_local_tree (ob, decl->common.type);
-
-  output_local_tree (ob, decl->decl_common.attributes);
-  output_local_tree (ob, decl->decl_common.abstract_origin);
-
-  output_uleb128 (ob, decl->decl_common.mode);
-  output_uleb128 (ob, decl->decl_common.align);
-  output_uleb128 (ob, decl->decl_common.off_align);
-
-  output_local_tree (ob, decl->decl_common.size);
-  output_local_tree (ob, decl->decl_common.size_unit);
-
-  output_local_tree (ob, decl->field_decl.offset);
-  output_local_tree (ob, decl->field_decl.bit_field_type);
-  output_local_tree (ob, decl->field_decl.qualifier);
-  output_local_tree (ob, decl->field_decl.bit_offset);
-  output_local_tree (ob, decl->field_decl.fcontext);
-
-  /* lang_specific */
-  output_local_tree (ob, decl->decl_common.initial);
-
-  /* Write out current field before its siblings,
-     so follow the chain last.  */
-  output_local_tree (ob, decl->common.chain);
-
-  LTO_DEBUG_UNDENT();
-}
-
-
-/* Output the local type declaration DECL to OB.
-   A "local" type declaration  is one that that has a
-   dependency on a function context, and should always
-   have been declared within a function.  */
-
-static void
-output_local_type_decl (struct output_block *ob, tree decl)
-{
-  /* tag and flags */
-  output_record_start (ob, NULL, NULL, LTO_type_decl0);
-  output_tree_flags (ob, 0, decl, true);
-
-  /* uid and locus are handled specially */
-  /* Must output name before type.  */
-  output_local_tree (ob, decl->decl_minimal.name);
-  output_local_tree (ob, decl->decl_minimal.context);
-
-  output_local_tree (ob, decl->decl_with_vis.assembler_name);
-  output_local_tree (ob, decl->decl_with_vis.section_name);
-
-  output_local_tree (ob, decl->common.type);
-
-  output_local_tree (ob, decl->decl_common.attributes);
-  output_local_tree (ob, decl->decl_common.abstract_origin);
-
-  output_uleb128 (ob, decl->decl_common.mode);
-  output_uleb128 (ob, decl->decl_common.align);
-
-  output_local_tree (ob, decl->decl_common.size);		/* ??? */
-  output_local_tree (ob, decl->decl_common.size_unit);		/* ??? */
-
-  /* lang_specific */
-
-  gcc_assert (decl->decl_with_rtl.rtl == NULL);
-
-  output_local_tree (ob, decl->decl_common.initial);		/* ??? */
-
-  output_local_tree (ob, decl->decl_non_common.saved_tree);	/* ??? */
-  output_local_tree (ob, decl->decl_non_common.arguments);	/* ??? */
-  output_local_tree (ob, decl->decl_non_common.result);
-  output_local_tree (ob, decl->decl_non_common.vindex);		/* ??? */
-
-  LTO_DEBUG_UNDENT();
-}
-
-
-/* Output the local type TYPE to OB.
-   A "local" type is one that that has a dependency on a
-   function context, as the type of local var decl or
-   type decl, or a type that is variably-modified with a
-   dependency on a local variable or parameter.  */
-
-static void
-output_local_type (struct output_block *ob, tree type, enum LTO_tags tag)
-{
-  /* FIXME lto:  Support for local types is not used, and has not kept
-     up with changes to the global type streamer.  Make sure we take
-     another look if we start using it again.  */
-  gcc_unreachable ();
-
-  /* tag and flags */
-  output_record_start (ob, NULL, NULL, tag);
-  output_tree_flags (ob, 0, type, false);
-
-  LTO_DEBUG_TOKEN ("type");
-  output_local_tree (ob, type->common.type);
-  LTO_DEBUG_TOKEN ("size");
-  output_local_tree (ob, type->type.size);
-  LTO_DEBUG_TOKEN ("size_unit");
-  output_local_tree (ob, type->type.size_unit);
-  LTO_DEBUG_TOKEN ("attributes");
-  output_local_tree (ob, type->type.attributes);
-  LTO_DEBUG_TOKEN ("uid");
-  output_uleb128 (ob, type->type.uid);
-  LTO_DEBUG_TOKEN ("precision");
-  output_uleb128 (ob, type->type.precision);
-  LTO_DEBUG_TOKEN ("mode");
-  output_uleb128 (ob, type->type.mode);
-  LTO_DEBUG_TOKEN ("align");
-  output_uleb128 (ob, type->type.align);
-  LTO_DEBUG_TOKEN ("pointer_to");
-  output_local_tree (ob, type->type.pointer_to);
-  LTO_DEBUG_TOKEN ("reference_to");
-  output_local_tree (ob, type->type.reference_to);
-  /* FIXME: Output symtab here.  Do we need it?  */
-  LTO_DEBUG_TOKEN ("name");
-  output_local_tree (ob, type->type.name);	/* may be a TYPE_DECL */
-  LTO_DEBUG_TOKEN ("minval");
-  output_local_tree (ob, type->type.minval);
-  LTO_DEBUG_TOKEN ("maxval");
-  output_local_tree (ob, type->type.maxval);
-  LTO_DEBUG_TOKEN ("next_variant");
-  output_local_tree (ob, type->type.next_variant);
-  LTO_DEBUG_TOKEN ("main_variant");
-  output_local_tree (ob, type->type.main_variant);
-  /* FIXME: Handle BINFO.  */
-  /*
-    LTO_DEBUG_TOKEN ("binfo");
-    output_local_tree (ob, type->type.binfo);
-  */
-  LTO_DEBUG_TOKEN ("context");
-  /* FIXME: We don't emit BLOCKs, so context must be a
-     function or toplevel.  We probably break debugging.  */
-  /*output_tree (ob, type->type.context);*/
-  output_local_tree (ob, type_function_context (type));
-  LTO_DEBUG_TOKEN ("canonical");
-  output_local_tree (ob, type->type.canonical);
-
-  /* Slot 'values' may be the structures fields, so do them last,
-     after other slots of the structure type have been filled in.  */
-  LTO_DEBUG_TOKEN ("values");
-  if (TYPE_CACHED_VALUES_P (type))
-    {
-      gcc_assert (tag != RECORD_TYPE
-                  && tag != UNION_TYPE
-                  && tag != ARRAY_TYPE);
-      /* Don't stream the values cache.  We must clear flag
-         TYPE_CACHED_VALUES_P on input.  We don't do it here
-         because we don't want to clobber the tree as we write
-         it, and there is no infrastructure for modifying
-         flags as we serialize them.  */
-      output_zero (ob);
-    }
-  else
-    output_local_tree (ob, type->type.values);	/* should be a TREE_VEC */
-
-  LTO_DEBUG_TOKEN ("chain");
-  output_local_tree (ob, type->common.chain);	/* overloaded as TYPE_STUB_DECL */
-
-  LTO_DEBUG_UNDENT();
-}
-
-
 /* Output the local declaration or type at INDEX to OB.  */
 
 static void
@@ -1582,31 +1403,16 @@ output_local_decl (struct output_block *ob, int index)
 {
   tree decl = lto_tree_ref_encoder_get_tree (&ob->local_decl_encoder, index);
 
-  /* DEBUG */
-  /*
-    fprintf (stderr, "LOCAL: ");
-    print_generic_expr (stderr, decl, 0);
-    fprintf (stderr, "\n");
-  */
-
   VEC_replace (int, ob->local_decls_index, index, ob->main_stream->total_size);
 #ifdef LTO_STREAM_DEBUGGING
   VEC_replace (int, ob->local_decls_index_d, index, ob->debug_decl_stream->total_size);
 #endif
 
-  if (TREE_CODE (decl) == FIELD_DECL)
-    output_local_field_decl (ob, decl);
-  else if (TREE_CODE (decl) == VAR_DECL
-           || TREE_CODE (decl) == PARM_DECL)
+  if (TREE_CODE (decl) == VAR_DECL
+      || TREE_CODE (decl) == PARM_DECL)
     output_local_var_decl (ob, index);
-  else if (TREE_CODE (decl) == TYPE_DECL)
-    output_local_type_decl (ob, decl);
   else
-    {
-      gcc_assert (TYPE_P (decl));
-
-      output_local_type (ob, decl, expr_to_tag [TREE_CODE (decl)]);
-    }
+    gcc_unreachable ();
 }
 
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]