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]

[mudflap] fix alpha failures


The largest problem here is that in mudflap_enqueue_decl and 
mudflap_enqueue_constant we were not using the original decl
or constant object, but rather fooling around with labels and
creating new fake decls.  Which means we lost track of the
proper DECL_EXTERNAL/PUBLIC etc bits, which means that we got
the wrong answer from encode_section_info, which means we got
link errors at runtime.

There was no discernable reason for that label indirection.
Removing it all Just Works.

Also cleaned up some more C tree bits in favour of GENERIC trees.

Tested on alphaev67-linux.


r~



        * c-mudflap.c (mflang_register_call): Remove.
        (mflang_flush_calls): Use start_function/finish_function.
        * tree-mudflap.c (mf_init_extern_trees): Tidy.
        (mf_decl_cache_locals): Fix chaining for empty body.
        (deferred_static_decl_labels): Remove.
        (deferred_static_decls_init): Remove.
        (mudflap_register_call): New.
        (mudflap_enqueue_decl): Use it.  Remove label argument.
        (mudflap_enqueue_constant): Likewise.
        (mudflap_finish_file): Update to match.
        * tree-mudflap.h (mudflap_enqueue_decl): Remove label argument.
        (mudflap_enqueue_constant): Likewise.
        (mflang_register_call): Remove.
        * tree-nomudflap.c (mudflap_enqueue_decl): Remove label argument.
        (mudflap_enqueue_constant): Likewise.
        * tree-optimize.c (tree_ssa_finish): Don't create NULL bodies.
        * varasm.c (make_decl_rtl): Update mudflap_enqueue_decl call.
        (output_constant_def_contents): Similarly for mudflap_enqueue_constant.
cp/
        * cp-mudflap.c (mflang_register_call): Remove.

Index: c-mudflap.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/c-mudflap.c,v
retrieving revision 1.1.2.8
diff -c -p -d -r1.1.2.8 c-mudflap.c
*** c-mudflap.c	25 Jul 2003 12:28:21 -0000	1.1.2.8
--- c-mudflap.c	1 Jan 2004 03:12:38 -0000
*************** mflang_lookup_decl (const char* name)
*** 61,193 ****
  }
  
  
! 
! /* Build and return EXPR_STMT for calling __mf_register on the object
!    given by the parameters.  One odd thing: the object's address is
!    given by the given assembler label string (since that's all we may
!    know about a string literal, or the static data thingie may be out
!    of the future scope).  To turn that into a validish C tree, we
!    create a weird synthetic VAR_DECL node.
! */
! 
! tree
! mflang_register_call (const char* label, tree regsize, tree regtype,
! 		      tree regname)
! {
!   tree decltype, decl;
!   tree call_params;
!   tree call_stmt;
! 
!   /* XXX: would be nicer not to duplicate this. */
!   tree mf_register_fndecl = mflang_lookup_decl ("__mf_register");
! 
!   /* See gcc-checker's c-bounds.c (declare_private_statics)  */
!   decltype = build_array_type (char_type_node, 0);
!   decl = mf_mark (build_decl (VAR_DECL, get_identifier (label), decltype));
! 
!   TREE_STATIC (decl) = 1;
!   TREE_READONLY (decl) = 1;
!   TREE_ASM_WRITTEN (decl) = 1;
!   DECL_IGNORED_P (decl) = 1;
!   DECL_INITIAL (decl) = NULL_TREE;
!   layout_decl (decl, 0);
!   TREE_USED (decl) = 1;
!   SET_DECL_ASSEMBLER_NAME (decl, get_identifier (label));
!   DECL_DEFER_OUTPUT (decl) = 1;
!   /* XXX: what else? */
!   /* rest_of_decl_compilation (decl, build_string (strlen (label) + 1, label), 1, 0); */
!   /* make_decl_rtl (decl,  build_string (strlen (label) + 1, label)); */
! 
!   call_params = tree_cons (NULL_TREE,
! 			   convert (ptr_type_node,
! 				    mf_mark (build1 (ADDR_EXPR,
! 						     build_pointer_type (TREE_TYPE (decl)),
! 						     decl))),
! 			   tree_cons (NULL_TREE,
! 				      convert (size_type_node, regsize),
! 				      tree_cons (NULL_TREE,
! 						 regtype,
! 						 tree_cons (NULL_TREE,
! 							    regname,
! 							    NULL_TREE))));
! 
!   call_stmt = build1 (EXPR_STMT, void_type_node,
! 		      build_function_call (mf_register_fndecl,
! 					   call_params));
! 
!   return call_stmt;
! }
! 
! 
! 
! /* Emit a synthetic CTOR function for the current file.  Populate it
!    from the enqueued __mf_register calls.  Call the RTL expanders
!    inline.  */
  
  void
  mflang_flush_calls (tree enqueued_call_stmt_chain)
  {
!   /* See profile.c (output_func_start_profiler) */
!   tree fnname;
!   char *nmplus;
!   tree fndecl;
!   tree body;
  
    /* Short-circuit!  */
    if (enqueued_call_stmt_chain == NULL_TREE)
      return;
  
!   /* Create the COMPOUND_STMT that becomes the new function's body.  */
!   body = make_node (COMPOUND_STMT);
!   COMPOUND_BODY (body) = enqueued_call_stmt_chain;
!   enqueued_call_stmt_chain = NULL_TREE;
! 
!   /* Create a ctor function declaration.  */
!   nmplus = concat (IDENTIFIER_POINTER (get_file_function_name ('I')), "_mudflap", NULL);
!   fnname = get_identifier (nmplus);
!   free (nmplus);
!   fndecl = build_decl (FUNCTION_DECL, fnname,
! 		       build_function_type (void_type_node, NULL_TREE));
!   DECL_EXTERNAL (fndecl) = 0;
!   TREE_PUBLIC (fndecl) = ! targetm.have_ctors_dtors;
!   TREE_USED (fndecl) = 1;
!   DECL_RESULT (fndecl) = build_decl (RESULT_DECL, NULL_TREE, void_type_node);
  
!   /* Now compile the sucker as we go.  This is a weird semi-inlined
!   form of the guts of the c-parse.y `fndef' production, and a hybrid
!   with c_expand_body. */
  
!   /* start_function */
!   fndecl = pushdecl (fndecl);
    pushlevel (0);
!   rest_of_decl_compilation (fndecl, 0, 1, 0);
!   announce_function (fndecl);
!   current_function_decl = fndecl;
!   DECL_INITIAL (fndecl) = error_mark_node;
!   DECL_SAVED_TREE (fndecl) = body;
!   make_decl_rtl (fndecl, NULL);
! 
!   /* store_parm_decls */
!   init_function_start (fndecl);
!   cfun->x_whole_function_mode_p = 1;
  
!   /* finish_function */
!   poplevel (1, 0, 1);
!   BLOCK_SUPERCONTEXT (DECL_INITIAL (fndecl)) = fndecl;
  
!   /* c_expand_body */
!   expand_function_start (fndecl, 0);
!   expand_stmt (DECL_SAVED_TREE (fndecl));
!   if (lang_expand_function_end)
!     (*lang_expand_function_end) ();
!   expand_function_end ();
!   rest_of_compilation (fndecl);
!   if (! quiet_flag)
!     fflush (asm_out_file);
!   current_function_decl = NULL_TREE;
!   if (targetm.have_ctors_dtors)
!     (* targetm.asm_out.constructor) (XEXP (DECL_RTL (fndecl), 0),
!                                      DEFAULT_INIT_PRIORITY);
!   else
!     static_ctors = tree_cons (NULL_TREE, fndecl, static_ctors);
  }
--- 61,98 ----
  }
  
  
! /* Emit a synthetic CTOR function for the current file.  Populate it from
!    the enqueued __mf_register calls.  Compile the function.  */
  
  void
  mflang_flush_calls (tree enqueued_call_stmt_chain)
  {
!   tree fnname, t1, t2, body, block, scope;
  
    /* Short-circuit!  */
    if (enqueued_call_stmt_chain == NULL_TREE)
      return;
  
!   fnname = get_identifier ("__mudflap_static_initializer");
!   t1 = build_tree_list (NULL_TREE, void_type_node);
!   t2 = tree_cons (NULL, NULL, t1);
!   start_function (t1, build_nt (CALL_EXPR, fnname, t2, NULL), NULL);
!   store_parm_decls ();
  
!   DECL_STATIC_CONSTRUCTOR (current_function_decl) = 1;
!   TREE_PUBLIC (current_function_decl) = 0;
  
!   body = c_begin_compound_stmt ();
    pushlevel (0);
!   clear_last_expr ();
!   add_scope_stmt (/*begin_p=*/1, /*partial_p=*/0);
  
!   c_expand_expr_stmt (enqueued_call_stmt_chain);
  
!   scope = add_scope_stmt (/*begin_p=*/0, /*partial_p=*/0);
!   block = poplevel (0, 0, 0);
!   SCOPE_STMT_BLOCK (TREE_PURPOSE (scope)) = block;
!   SCOPE_STMT_BLOCK (TREE_VALUE (scope)) = block;
!   RECHAIN_STMTS (body, COMPOUND_BODY (body));
!   finish_function ();
  }
Index: tree-mudflap.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-mudflap.c,v
retrieving revision 1.1.2.60
diff -c -p -d -r1.1.2.60 tree-mudflap.c
*** tree-mudflap.c	19 Dec 2003 07:01:36 -0000	1.1.2.60
--- tree-mudflap.c	1 Jan 2004 03:12:38 -0000
*************** static GTY (()) tree mf_unregister_fndec
*** 171,179 ****
  static void
  mf_init_extern_trees (void)
  {
!   static int done = 0;
  
!   if (done) return;
  
    mf_uintptr_type = TREE_TYPE (mflang_lookup_decl ("uintptr_t"));
    mf_cache_array_decl = mf_mark (mflang_lookup_decl ("__mf_lookup_cache"));
--- 171,181 ----
  static void
  mf_init_extern_trees (void)
  {
!   static bool done = false;
  
!   if (done)
!     return;
!   done = true;
  
    mf_uintptr_type = TREE_TYPE (mflang_lookup_decl ("uintptr_t"));
    mf_cache_array_decl = mf_mark (mflang_lookup_decl ("__mf_lookup_cache"));
*************** mf_init_extern_trees (void)
*** 184,191 ****
    mf_check_fndecl = mflang_lookup_decl ("__mf_check");
    mf_register_fndecl = mflang_lookup_decl ("__mf_register");
    mf_unregister_fndecl = mflang_lookup_decl ("__mf_unregister");
- 
-   done = 1;
  }
  
  
--- 186,191 ----
*************** mf_decl_cache_locals (tree* body)
*** 213,225 ****
               mf_cache_shift_decl_l, mf_cache_shift_decl);
    annotate_with_locus (t, DECL_SOURCE_LOCATION (current_function_decl));
    gimplify_stmt (&t);
!   tsi_link_before (&i, t, TSI_SAME_STMT);
  
    t = build (MODIFY_EXPR, TREE_TYPE (mf_cache_mask_decl_l),
               mf_cache_mask_decl_l, mf_cache_mask_decl);
    annotate_with_locus (t, DECL_SOURCE_LOCATION (current_function_decl));
    gimplify_stmt (&t);
!   tsi_link_before (&i, t, TSI_SAME_STMT);
  }
  
  
--- 213,225 ----
               mf_cache_shift_decl_l, mf_cache_shift_decl);
    annotate_with_locus (t, DECL_SOURCE_LOCATION (current_function_decl));
    gimplify_stmt (&t);
!   tsi_link_before (&i, t, TSI_NEW_STMT);
  
    t = build (MODIFY_EXPR, TREE_TYPE (mf_cache_mask_decl_l),
               mf_cache_mask_decl_l, mf_cache_mask_decl);
    annotate_with_locus (t, DECL_SOURCE_LOCATION (current_function_decl));
    gimplify_stmt (&t);
!   tsi_link_before (&i, t, TSI_NEW_STMT);
  }
  
  
*************** mf_xform_decls (tree fnbody, tree fnpara
*** 792,809 ****
     then, warnings are emitted.  */
  
  static GTY (()) varray_type deferred_static_decls;
- static GTY (()) varray_type deferred_static_decl_labels;
- static int deferred_static_decls_init;
- 
- /* What I really want is a std::map<union tree_node,std::string> .. :-(  */
  
! /* A chain of EXPR_STMTs for calling __mf_register() at initialization
!    time.  */
  static GTY (()) tree enqueued_call_stmt_chain;
  
  
  void
! mudflap_enqueue_decl (tree obj, const char *label)
  {
    if (mf_marked_p (obj))
      return;
--- 792,826 ----
     then, warnings are emitted.  */
  
  static GTY (()) varray_type deferred_static_decls;
  
! /* A list of statements for calling __mf_register() at startup time.  */
  static GTY (()) tree enqueued_call_stmt_chain;
  
+ static void
+ mudflap_register_call (tree obj, tree object_size, tree varname)
+ {
+   tree arg, args, call_stmt;
+ 
+   args = tree_cons (NULL_TREE, varname, NULL_TREE);
+ 
+   arg = build_int_2 (4, 0); /* __MF_TYPE_STATIC */
+   args = tree_cons (NULL_TREE, arg, args);
+ 
+   arg = convert (size_type_node, object_size);
+   args = tree_cons (NULL_TREE, arg, args);
+ 
+   arg = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (obj)), obj);
+   arg = convert (ptr_type_node, arg);
+   args = tree_cons (NULL_TREE, arg, args);
+ 
+   mf_init_extern_trees ();
+   call_stmt = build_function_call_expr (mf_register_fndecl, args);
+ 
+   append_to_statement_list (call_stmt, &enqueued_call_stmt_chain);
+ }
  
  void
! mudflap_enqueue_decl (tree obj)
  {
    if (mf_marked_p (obj))
      return;
*************** mudflap_enqueue_decl (tree obj, const ch
*** 812,830 ****
       generated extern.  If we did, we'd end up with warnings for them
       during mudflap_finish_file ().  That would confuse the user,
       since the text would refer to variables that don't show up in the
!      user's source code.
!   */
    if (DECL_P (obj) && DECL_EXTERNAL (obj) && DECL_ARTIFICIAL (obj))
!     {
!       return;
!     }
  
    if (COMPLETE_TYPE_P (TREE_TYPE (obj)))
      {
        FILE *dump_file;
        int dump_flags;
        tree object_size;
-       tree call_stmt;
  
        mf_mark (obj);
  
--- 829,843 ----
       generated extern.  If we did, we'd end up with warnings for them
       during mudflap_finish_file ().  That would confuse the user,
       since the text would refer to variables that don't show up in the
!      user's source code.  */
    if (DECL_P (obj) && DECL_EXTERNAL (obj) && DECL_ARTIFICIAL (obj))
!     return;
  
    if (COMPLETE_TYPE_P (TREE_TYPE (obj)))
      {
        FILE *dump_file;
        int dump_flags;
        tree object_size;
  
        mf_mark (obj);
  
*************** mudflap_enqueue_decl (tree obj, const ch
*** 835,841 ****
          {
            fprintf (dump_file, "enqueue_decl obj=`");
            print_generic_expr (dump_file, obj, 0);
!           fprintf (dump_file, "' label=`%s' size=", label);
            print_generic_expr (dump_file, object_size, 0);
            fprintf (dump_file, "\n");
            dump_end (TDI_mudflap1, dump_file);
--- 848,854 ----
          {
            fprintf (dump_file, "enqueue_decl obj=`");
            print_generic_expr (dump_file, obj, 0);
!           fprintf (dump_file, "' size=");
            print_generic_expr (dump_file, object_size, 0);
            fprintf (dump_file, "\n");
            dump_end (TDI_mudflap1, dump_file);
*************** mudflap_enqueue_decl (tree obj, const ch
*** 845,902 ****
           TREE_ADDRESSABLE.  That's because this object may be a global
           only used from other compilation units.  XXX: Maybe static
           objects could require those attributes being set.  */
-       call_stmt =
-         mflang_register_call (label,
-                               object_size,
-                               build_int_2 (4, 0), /* __MF_TYPE_STATIC */
-                               mf_varname_tree (obj));
  
!       /* Link this call into the chain. */
!       TREE_CHAIN (call_stmt) = enqueued_call_stmt_chain;
!       enqueued_call_stmt_chain = call_stmt;
      }
    else
      {
!       unsigned i;
!       int found_p;
  
!       if (! deferred_static_decls_init)
!         {
!           deferred_static_decls_init = 1;
!           VARRAY_TREE_INIT (deferred_static_decls, 10, "deferred static list");
!           VARRAY_CHAR_PTR_INIT (deferred_static_decl_labels, 10, "label list");
!         }
  
        /* Ugh, linear search... */
!       found_p = 0;
!       for (i=0; i < VARRAY_ACTIVE_SIZE (deferred_static_decls); i++)
          if (VARRAY_TREE (deferred_static_decls, i) == obj)
!           found_p = 1;
  
!       if (found_p)
!         warning ("mudflap cannot track lifetime of `%s'",
!                  IDENTIFIER_POINTER (DECL_NAME (obj)));
!       else
!         {
!           VARRAY_PUSH_TREE (deferred_static_decls, obj);
!           VARRAY_PUSH_CHAR_PTR (deferred_static_decl_labels, (char *) label);
!         }
      }
  }
  
- 
  void
! mudflap_enqueue_constant (tree obj, const char *label)
  {
!   tree call_stmt;
!   tree object_size;
  
    if (mf_marked_p (obj))
      return;
  
!   object_size = (TREE_CODE (obj) == STRING_CST)
!     ? build_int_2 (TREE_STRING_LENGTH (obj), 0)
!     : size_in_bytes (TREE_TYPE (obj));
  
    {
      FILE *dump_file;
--- 858,898 ----
           TREE_ADDRESSABLE.  That's because this object may be a global
           only used from other compilation units.  XXX: Maybe static
           objects could require those attributes being set.  */
  
!       mudflap_register_call (obj, object_size, mf_varname_tree (obj));
      }
    else
      {
!       size_t i;
  
!       if (! deferred_static_decls)
!         VARRAY_TREE_INIT (deferred_static_decls, 10, "deferred static list");
  
        /* Ugh, linear search... */
!       for (i = 0; i < VARRAY_ACTIVE_SIZE (deferred_static_decls); i++)
          if (VARRAY_TREE (deferred_static_decls, i) == obj)
! 	  {
! 	    warning ("mudflap cannot track lifetime of `%s'",
! 		     IDENTIFIER_POINTER (DECL_NAME (obj)));
! 	    return;
! 	  }
  
!       VARRAY_PUSH_TREE (deferred_static_decls, obj);
      }
  }
  
  void
! mudflap_enqueue_constant (tree obj)
  {
!   tree object_size, varname;
  
    if (mf_marked_p (obj))
      return;
  
!   if (TREE_CODE (obj) == STRING_CST)
!     object_size = build_int_2 (TREE_STRING_LENGTH (obj), 0);
!   else
!     object_size = size_in_bytes (TREE_TYPE (obj));
  
    {
      FILE *dump_file;
*************** mudflap_enqueue_constant (tree obj, cons
*** 907,931 ****
        {
          fprintf (dump_file, "enqueue_constant obj=`");
          print_generic_expr (dump_file, obj, 0);
!         fprintf (dump_file, "' label=`%s' size=", label);
          print_generic_expr (dump_file, object_size, 0);
          fprintf (dump_file, "\n");
          dump_end (TDI_mudflap1, dump_file);
        }
    }
  
!   call_stmt =
!     (TREE_CODE (obj) == STRING_CST)
!     ? mflang_register_call (label, object_size,
!                             build_int_2 (4, 0), /* __MF_TYPE_STATIC */
!                             mf_build_string ("string literal"))
!     : mflang_register_call (label, object_size,
!                             build_int_2 (4, 0), /* __MF_TYPE_STATIC */
!                             mf_build_string ("constant"));
  
!   /* Link this call into the chain. */
!   TREE_CHAIN (call_stmt) = enqueued_call_stmt_chain;
!   enqueued_call_stmt_chain = call_stmt;
  }
  
  
--- 903,921 ----
        {
          fprintf (dump_file, "enqueue_constant obj=`");
          print_generic_expr (dump_file, obj, 0);
!         fprintf (dump_file, "' size=");
          print_generic_expr (dump_file, object_size, 0);
          fprintf (dump_file, "\n");
          dump_end (TDI_mudflap1, dump_file);
        }
    }
  
!   if (TREE_CODE (obj) == STRING_CST)
!     varname = mf_build_string ("string literal");
!   else
!     varname = mf_build_string ("constant");
  
!   mudflap_register_call (obj, object_size, varname);
  }
  
  
*************** void
*** 935,957 ****
  mudflap_finish_file (void)
  {
    /* Try to give the deferred objects one final try.  */
!   if (deferred_static_decls_init)
      {
!       unsigned i;
  
        for (i = 0; i < VARRAY_ACTIVE_SIZE (deferred_static_decls); i++)
          {
            tree obj = VARRAY_TREE (deferred_static_decls, i);
-           const char *label = VARRAY_CHAR_PTR (deferred_static_decl_labels, i);
  
            /* Call enqueue_decl again on the same object it has previously
               put into the table.  (It won't modify the table this time, so
               infinite iteration is not a problem.)  */
!           mudflap_enqueue_decl (obj, label);
          }
  
        VARRAY_CLEAR (deferred_static_decls);
-       VARRAY_CLEAR (deferred_static_decl_labels);
      }
  
    mflang_flush_calls (enqueued_call_stmt_chain);
--- 925,945 ----
  mudflap_finish_file (void)
  {
    /* Try to give the deferred objects one final try.  */
!   if (deferred_static_decls)
      {
!       size_t i;
  
        for (i = 0; i < VARRAY_ACTIVE_SIZE (deferred_static_decls); i++)
          {
            tree obj = VARRAY_TREE (deferred_static_decls, i);
  
            /* Call enqueue_decl again on the same object it has previously
               put into the table.  (It won't modify the table this time, so
               infinite iteration is not a problem.)  */
!           mudflap_enqueue_decl (obj);
          }
  
        VARRAY_CLEAR (deferred_static_decls);
      }
  
    mflang_flush_calls (enqueued_call_stmt_chain);
Index: tree-mudflap.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-mudflap.h,v
retrieving revision 1.1.2.7
diff -c -p -d -r1.1.2.7 tree-mudflap.h
*** tree-mudflap.h	20 Nov 2003 21:21:44 -0000	1.1.2.7
--- tree-mudflap.h	1 Jan 2004 03:12:38 -0000
*************** Software Foundation, 59 Temple Place - S
*** 25,32 ****
  /* Instrumentation. */
  extern void mudflap_c_function_decls (tree);
  extern void mudflap_c_function_ops (tree);
! extern void mudflap_enqueue_decl (tree, const char *);
! extern void mudflap_enqueue_constant (tree, const char *);
  extern void mudflap_finish_file (void);
  
  /* Tree node marking. */
--- 25,32 ----
  /* Instrumentation. */
  extern void mudflap_c_function_decls (tree);
  extern void mudflap_c_function_ops (tree);
! extern void mudflap_enqueue_decl (tree);
! extern void mudflap_enqueue_constant (tree);
  extern void mudflap_finish_file (void);
  
  /* Tree node marking. */
*************** extern tree mf_mark (tree);
*** 35,41 ****
  
  /* To be provided by a front-end interface module. */
  extern tree mflang_lookup_decl (const char *);
- extern tree mflang_register_call (const char*, tree, tree, tree);
  extern void mflang_flush_calls (tree);
  
  
--- 35,40 ----
Index: tree-nomudflap.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-nomudflap.c,v
retrieving revision 1.1.2.11
diff -c -p -d -r1.1.2.11 tree-nomudflap.c
*** tree-nomudflap.c	21 Nov 2003 01:08:31 -0000	1.1.2.11
--- tree-nomudflap.c	1 Jan 2004 03:12:38 -0000
*************** mudflap_c_function_ops (tree t ATTRIBUTE
*** 67,82 ****
  
  
  void
! mudflap_enqueue_decl (tree obj ATTRIBUTE_UNUSED,
! 		      const char *label ATTRIBUTE_UNUSED)
  {
    nogo ();
  }
  
  
  void
! mudflap_enqueue_constant (tree obj ATTRIBUTE_UNUSED,
! 			  const char *label ATTRIBUTE_UNUSED)
  {
    nogo ();
  }
--- 67,80 ----
  
  
  void
! mudflap_enqueue_decl (tree obj ATTRIBUTE_UNUSED)
  {
    nogo ();
  }
  
  
  void
! mudflap_enqueue_constant (tree obj ATTRIBUTE_UNUSED)
  {
    nogo ();
  }
Index: tree-optimize.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-optimize.c,v
retrieving revision 1.1.4.98
diff -c -p -d -r1.1.4.98 tree-optimize.c
*** tree-optimize.c	19 Dec 2003 07:01:36 -0000	1.1.4.98
--- tree-optimize.c	1 Jan 2004 03:12:38 -0000
*************** tree_ssa_finish (tree *chain)
*** 280,286 ****
    delete_tree_ssa ();
  
    /* Re-chain the statements from the blocks.  */
!   *chain = NULL;
    FOR_EACH_BB (bb)
      {
        append_to_statement_list_force (bb->stmt_list, chain);
--- 280,286 ----
    delete_tree_ssa ();
  
    /* Re-chain the statements from the blocks.  */
!   *chain = alloc_stmt_list ();
    FOR_EACH_BB (bb)
      {
        append_to_statement_list_force (bb->stmt_list, chain);
Index: varasm.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/varasm.c,v
retrieving revision 1.295.2.40
diff -c -p -d -r1.295.2.40 varasm.c
*** varasm.c	10 Dec 2003 21:43:52 -0000	1.295.2.40
--- varasm.c	1 Jan 2004 03:12:38 -0000
*************** make_decl_rtl (tree decl, const char *as
*** 784,790 ****
  
        /* Make this function static known to the mudflap runtime.  */
        if (flag_mudflap && TREE_CODE (decl) == VAR_DECL)
! 	mudflap_enqueue_decl (decl, name);
  
        return;
      }
--- 784,790 ----
  
        /* Make this function static known to the mudflap runtime.  */
        if (flag_mudflap && TREE_CODE (decl) == VAR_DECL)
! 	mudflap_enqueue_decl (decl);
  
        return;
      }
*************** make_decl_rtl (tree decl, const char *as
*** 889,895 ****
  
    /* Make this function static known to the mudflap runtime.  */
    if (flag_mudflap && TREE_CODE (decl) == VAR_DECL)
!     mudflap_enqueue_decl (decl, name);
  }
  
  /* Make the rtl for variable VAR be volatile.
--- 889,895 ----
  
    /* Make this function static known to the mudflap runtime.  */
    if (flag_mudflap && TREE_CODE (decl) == VAR_DECL)
!     mudflap_enqueue_decl (decl);
  }
  
  /* Make the rtl for variable VAR be volatile.
*************** output_constant_def_contents (rtx symbol
*** 2570,2576 ****
    /* Output the value of EXP.  */
    output_constant (exp, size, align);
    if (flag_mudflap)
!     mudflap_enqueue_constant (exp, ggc_strdup (label));
  }
  
  /* A constant which was deferred in its original location has been
--- 2570,2576 ----
    /* Output the value of EXP.  */
    output_constant (exp, size, align);
    if (flag_mudflap)
!     mudflap_enqueue_constant (exp);
  }
  
  /* A constant which was deferred in its original location has been
Index: cp/cp-mudflap.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/Attic/cp-mudflap.c,v
retrieving revision 1.1.2.10
diff -c -p -d -r1.1.2.10 cp-mudflap.c
*** cp/cp-mudflap.c	20 Nov 2003 21:21:45 -0000	1.1.2.10
--- cp/cp-mudflap.c	1 Jan 2004 03:12:38 -0000
*************** mflang_lookup_decl (const char* name)
*** 56,110 ****
  }
  
  
- 
- /* Build and return an EXPR for calling __mf_register on the object
-    given by the parameters.  One odd thing: the object's address is
-    given by the given assembler label string (since that's all we may
-    know about a string literal, or the static data thingie may be out
-    of the future scope).  To turn that into a validish C tree, we
-    create a weird synthetic VAR_DECL node.  */
- 
- tree
- mflang_register_call (const char* label, tree regsize, tree regtype,
- 		      tree regname)
- {
-   tree decltype, decl, params, call, t;
- 
-   /* XXX: would be nicer not to duplicate these. */
-   tree mf_register_fndecl = mflang_lookup_decl ("__mf_register");
- 
-   /* See gcc-checker's c-bounds.c (declare_private_statics)  */
-   decltype = build_array_type (char_type_node, 0);
-   decl = mf_mark (build_decl (VAR_DECL, get_identifier (label), decltype));
- 
-   TREE_STATIC (decl) = 1;
-   TREE_READONLY (decl) = 1;
-   TREE_ASM_WRITTEN (decl) = 1;
-   DECL_IGNORED_P (decl) = 1;
-   DECL_INITIAL (decl) = NULL_TREE;
-   layout_decl (decl, 0);
-   TREE_USED (decl) = 1;
-   SET_DECL_ASSEMBLER_NAME (decl, get_identifier (label));
-   DECL_DEFER_OUTPUT (decl) = 1;
- 
-   params = tree_cons (NULL_TREE, regname, NULL_TREE);
-   params = tree_cons (NULL_TREE, regtype, params);
- 
-   t = convert (size_type_node, regsize);
-   params = tree_cons (NULL_TREE, t, params);
- 
-   t = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (decl)), decl);
-   t = mf_mark (t);
-   t = convert (ptr_type_node, t);
-   params = tree_cons (NULL_TREE, t, params);
- 
-   call = build_function_call (mf_register_fndecl, params);
- 
-   return call;
- }
- 
- 
- 
  /* Emit a synthetic CTOR function for the current file.  Populate it from
     the enqueued __mf_register calls.  Register it with the constructors.  */
  
--- 56,61 ----


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