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]

Re: [lto][patch] Remove more dead code. Fix bootstrap


2009/1/20 Rafael Espindola <espindola@google.com>:
> This fixes the "defined static but not used" warnings.
>
> 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, input_local_tree):
>        Remove.
>        * lto-function-out.c (field_decl_is_local, type_decl_is_local,
> output_type_ref_1):
>        Remove STREAM_LOCAL_TYPES ifdef.
>        (output_local_tree, type_function_context): Remove.
>
> Cheers,
> --
> Rafael Avila de Espindola
>
> Google | Gordon House | Barrow Street | Dublin 4 | Ireland
> Registered in Dublin, Ireland | Registration Number: 368047
>



-- 
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 1ddeedc..9bfae17 100644
--- a/gcc/lto-function-in.c
+++ b/gcc/lto-function-in.c
@@ -113,27 +113,10 @@ input_expr_operand (struct lto_input_block *, struct data_in *,
                     struct function *, enum LTO_tags);
 
 static tree
-input_local_tree (struct lto_input_block *, struct data_in *,
-                  struct function *);
-
-static tree
 input_local_var_decl (struct lto_input_block *, struct data_in *,
                       struct function *, unsigned int, enum LTO_tags);
 
 static tree
-input_local_field_decl (struct lto_input_block *, struct data_in *,
-                        struct function *, unsigned int);
-
-static tree
-input_local_type_decl (struct lto_input_block *, struct data_in *,
-                       struct function *, unsigned int);
-
-static tree
-input_local_type (struct lto_input_block *, struct data_in *,
-                  struct function *, unsigned int, enum tree_code code);
-
-
-static tree
 input_local_decl (struct lto_input_block *, struct data_in *,
                   struct function *, unsigned int);
 
@@ -1131,77 +1114,6 @@ input_local_vars_index (struct lto_input_block *ib, struct data_in *data_in,
     }
 }
 
-
-static tree
-input_local_tree (struct lto_input_block *ib, struct data_in *data_in,
-                  struct function *fn)
-{
-  int index;
-  tree result;
-  enum LTO_tags tag;
-
-  tag = input_record_start (ib);
-
-  if (tag == 0)
-    return NULL_TREE;
-  else if (tag == LTO_global_type_ref)
-    {
-      index = lto_input_uleb128 (ib);
-      result = lto_file_decl_data_get_type (data_in->file_data, index);
-    }
-  else if (tag == LTO_local_type_ref)
-    {
-      /* FIXME: Refactor to avoid all the cut/paste of
-         code cribbed from the VAR_DECL handler, here
-         and elsewhere.  */
-      int lv_index = lto_input_uleb128 (ib);
-      result = data_in->local_decls[lv_index];
-      if (result == NULL)
-      {
-        /* Create a context to read the local variable so that
-           it does not disturb the position of the code that is
-           calling for the local variable.  This allows locals
-           to refer to other locals.  */
-        struct lto_input_block lib;
-
-#ifdef LTO_STREAM_DEBUGGING
-        struct lto_input_block *current
-	  = (struct lto_input_block *) lto_debug_context.current_data;
-        struct lto_input_block debug;
-        int current_indent = lto_debug_context.indent;
-
-        debug.data = current->data;
-        debug.len = current->len;
-        debug.p = data_in->local_decls_index_d[lv_index];
-
-        lto_debug_context.indent = 0;
-        lto_debug_context.current_data = &debug;
-        lto_debug_context.tag_names = LTO_tree_tag_names;
-#endif
-        lib.data = ib->data;
-        lib.len = ib->len;
-        lib.p = data_in->local_decls_index[lv_index];
-
-        /* The TYPE_DECL case doesn't care about the FN argument.  */
-        result = input_local_decl (&lib, data_in, NULL, lv_index);
-        gcc_assert (TYPE_P (result));
-        data_in->local_decls[lv_index] = result;
-
-#ifdef LTO_STREAM_DEBUGGING
-        lto_debug_context.indent = current_indent;
-        lto_debug_context.current_data = current;
-        lto_debug_context.tag_names = LTO_tree_tag_names;
-#endif
-      }
-    }
-  else
-    /* Not a type_ref.  */
-    return input_expr_operand (ib, data_in, fn, tag);
-
-  LTO_DEBUG_UNDENT();
-  return result;
-}
-
 /* Input local var I for FN from IB.  */
 
 static tree
diff --git a/gcc/lto-function-out.c b/gcc/lto-function-out.c
index e64b10a..ed3ff77 100644
--- a/gcc/lto-function-out.c
+++ b/gcc/lto-function-out.c
@@ -545,28 +545,6 @@ output_tree_flags (struct output_block *ob, enum tree_code code, tree expr,
     }
 }
 
-
-/* Return innermost enclosing FUNCTION_DECL for a type,
-   or NULL_TREE if there is none.  */
-/* FIXME: Move this to tree.c alongside DECL_FUNCTION_CONTEXT.  */
-/* FIXME: Can type be ERROR_MARK?  See DECL_FUNCTION_CONTEXT.  */
-
-static tree
-type_function_context (const_tree type)
-{
-  tree context = TYPE_CONTEXT (type);
-
-  while (context && TREE_CODE (context) != FUNCTION_DECL)
-    {
-      if (TREE_CODE (context) == BLOCK)
-        context = BLOCK_SUPERCONTEXT (context);
-      else
-        context = get_containing_scope (context);
-    }
-  
-  return context;
-}
-
 /* Return true if a FIELD_DECL depends on a function context,
    i.e., makes reference to a function body and should be serialized
    with the function body, not the file scope.  */
@@ -574,13 +552,7 @@ type_function_context (const_tree type)
 static bool
 field_decl_is_local (tree decl ATTRIBUTE_UNUSED)
 {
-#ifdef STREAM_LOCAL_TYPES
-  return (decl_function_context (decl)
-          || variably_modified_type_p (TREE_TYPE(decl), NULL)
-          || type_function_context (TREE_TYPE (decl)));
-#else
   return false;
-#endif
 }
 
 /* Return true if a TYPE__DECL depends on a function context,
@@ -590,12 +562,7 @@ field_decl_is_local (tree decl ATTRIBUTE_UNUSED)
 static bool
 type_decl_is_local (tree decl ATTRIBUTE_UNUSED)
 {
-#ifdef STREAM_LOCAL_TYPES
-  return (decl_function_context (decl)
-          || variably_modified_type_p (TREE_TYPE(decl), NULL));
-#else
   return false;
-#endif
 }
 
 
@@ -604,18 +571,8 @@ type_decl_is_local (tree decl ATTRIBUTE_UNUSED)
 static void
 output_type_ref_1 (struct output_block *ob, tree node)
 {
-#ifdef STREAM_LOCAL_TYPES
-  if (variably_modified_type_p (node, NULL) || type_function_context (node))
-    {
-      output_record_start (ob, NULL, NULL, LTO_local_type_ref);
-      output_local_decl_ref (ob, node, true);
-    }
-  else
-#endif
-    {
-      output_record_start (ob, NULL, NULL, LTO_global_type_ref);
-      lto_output_type_ref_index (ob->decl_state, ob->main_stream, node);
-    }
+  output_record_start (ob, NULL, NULL, LTO_global_type_ref);
+  lto_output_type_ref_index (ob->decl_state, ob->main_stream, node);
 
   LTO_DEBUG_UNDENT();
 }
@@ -1382,20 +1339,6 @@ output_local_var_decl (struct output_block *ob, int index)
   LTO_DEBUG_UNDENT();
 }
 
-
-/* Emit tree node EXPR to output block OB.  */
-
-static void
-output_local_tree (struct output_block *ob, tree expr)
-{
-  if (expr == NULL_TREE)
-    output_zero (ob);
-  else if (TYPE_P (expr))
-    output_type_ref_1 (ob, expr);
-  else
-    output_expr_operand (ob, expr);
-}
-
 /* Output the local declaration or type at INDEX to OB.  */
 
 static void

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