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]

[objc] turn into unit-at-a-time


Hi,
this patch adds unit-at-a-time support to objective C.
As a next step, I would love to kill the old function deffering algorithm.

Honza

Tue Feb 18 21:58:17 CET 2003  Jan Hubicka  <jh@suse.cz>
	* c-decl.c (finish_function): Honor can_defer_p even in unit-at-a-time
	mode.

	* objc-act.c: Include cgraph.h
	(mark_referenced_methods): New function.
	(objc_init): Call it.
	* objc-lang.c (LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION): Set.
	* cgraph.c (cgraph_mark_needed_function): New function.
	* cgraph.h (cgraph_mark_needed_function): Declare.
Index: c-decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-decl.c,v
retrieving revision 1.363
diff -c -3 -p -r1.363 c-decl.c
*** c-decl.c	12 Feb 2003 21:48:56 -0000	1.363
--- c-decl.c	18 Feb 2003 20:55:08 -0000
*************** finish_function (nested, can_defer_p)
*** 6412,6418 ****
    free_after_compilation (cfun);
    cfun = NULL;
  
!   if (flag_unit_at_a_time)
      {
        cgraph_finalize_function (fndecl, DECL_SAVED_TREE (fndecl));
        current_function_decl = NULL;
--- 6413,6419 ----
    free_after_compilation (cfun);
    cfun = NULL;
  
!   if (flag_unit_at_a_time && can_defer_p)
      {
        cgraph_finalize_function (fndecl, DECL_SAVED_TREE (fndecl));
        current_function_decl = NULL;
Index: objc/objc-act.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/objc/objc-act.c,v
retrieving revision 1.164
diff -c -3 -p -r1.164 objc-act.c
*** objc/objc-act.c	31 Jan 2003 14:46:55 -0000	1.164
--- objc/objc-act.c	18 Feb 2003 20:55:12 -0000
*************** Boston, MA 02111-1307, USA.  */
*** 60,65 ****
--- 60,66 ----
  #include "debug.h"
  #include "target.h"
  #include "diagnostic.h"
+ #include "cgraph.h"
  
  /* This is the default way of generating a method name.  */
  /* I am not sure it is really correct.
*************** static void handle_class_ref			PARAMS ((
*** 294,299 ****
--- 295,301 ----
  static void generate_struct_by_value_array	PARAMS ((void))
       ATTRIBUTE_NORETURN;
  static void encode_complete_bitfield		PARAMS ((int, tree, int));
+ static void mark_referenced_methods		PARAMS ((void));
  
  /*** Private Interface (data) ***/
  
*************** objc_init (filename)
*** 486,491 ****
--- 488,494 ----
  void
  finish_file ()
  {
+   mark_referenced_methods ();
    c_objc_common_finish_file ();
  
    /* Finalize Objective-C runtime data.  No need to generate tables
*************** generate_dispatch_table (type, name, siz
*** 4025,4030 ****
--- 4028,4056 ----
  	       NULL_TREE);
  
    return decl;
+ }
+ 
+ static void
+ mark_referenced_methods ()
+ {
+   struct imp_entry *impent;
+   tree chain;
+ 
+   for (impent = imp_list; impent; impent = impent->next)
+     {
+       chain = CLASS_CLS_METHODS (impent->imp_context);
+       while (chain)
+ 	{
+ 	  cgraph_mark_needed_function (METHOD_DEFINITION (chain));
+ 	  chain = TREE_CHAIN (chain);
+ 	}
+       chain = CLASS_NST_METHODS (impent->imp_context);
+       while (chain)
+ 	{
+ 	  cgraph_mark_needed_function (METHOD_DEFINITION (chain));
+ 	  chain = TREE_CHAIN (chain);
+ 	}
+     }
  }
  
  static void
Index: objc/objc-lang.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/objc/objc-lang.c,v
retrieving revision 1.28
diff -c -3 -p -r1.28 objc-lang.c
*** objc/objc-lang.c	1 Jan 2003 12:49:14 -0000	1.28
--- objc/objc-lang.c	18 Feb 2003 20:55:12 -0000
*************** static void objc_init_options           
*** 99,104 ****
--- 99,107 ----
  #define LANG_HOOKS_TREE_INLINING_CONVERT_PARM_FOR_INLINING \
    c_convert_parm_for_inlining
  
+ #undef LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION
+ #define LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION c_expand_body
+ 
  #undef LANG_HOOKS_TYPE_FOR_MODE
  #define LANG_HOOKS_TYPE_FOR_MODE c_common_type_for_mode
  #undef LANG_HOOKS_TYPE_FOR_SIZE
*** cgraph.c.old	Tue Feb 18 18:20:11 2003
--- cgraph.c	Tue Feb 18 21:53:35 2003
*************** cgraph_mark_needed_node (node, needed)
*** 345,350 ****
--- 345,357 ----
      }
  }
  
+ void
+ cgraph_mark_needed_function (decl)
+      tree decl;
+ {
+   cgraph_mark_needed_node (cgraph_node (decl), 1);
+ }
+ 
  /* Analyze the whole compilation unit once it is parsed completely.  */
  
  void
*** cgraph.h.old	Tue Feb 18 18:20:01 2003
--- cgraph.h	Tue Feb 18 18:20:15 2003
*************** void cgraph_remove_call			PARAMS ((tree,
*** 97,100 ****
--- 97,101 ----
  bool cgraph_calls_p			PARAMS ((tree, tree));
  struct cgraph_local_info *cgraph_local_info PARAMS ((tree));
  struct cgraph_global_info *cgraph_global_info PARAMS ((tree));
+ void cgraph_mark_needed_function PARAMS ((tree decl));
  #endif  /* GCC_CGRAPH_H  */


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