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]

tidy rtl inliner vs decl_saved_insns


DECL_SAVED_INSNS (which has been mis-named for a while) is currently
tested for non-null-ness to imply that the rtl inliner is doing something.
I have other needs for DECL_SAVED_INSNS, so this rearranges things such
that the tests in question are directly obvious as to what they're trying
to test.

I just noticed that I mis-split a patch from a moment ago, in that there
was supposed to have been a change to allocate_struct_function to set
DECL_SAVED_INSNS here.  Instead, it got applied early.  That set is exactly
why this one is necessary.  So if you got unlucky with your cvs updates
and retrieved the previous, but not this one, please try again.


r~


        * function.h (struct function): Add rtl_inline_init, saved_for_inline.
        * integrate.c (save_for_inline): Set saved_for_inline.
        * c-semantics.c (genrtl_scope_stmt): Check it.
        * toplev.c (wrapup_global_declarations): Check it.
        (rest_of_handle_inlining): Set and check rtl_inline_init.
        (rest_of_compilation): Remove out of date comment.

Index: c-semantics.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-semantics.c,v
retrieving revision 1.70
diff -c -p -d -r1.70 c-semantics.c
*** c-semantics.c	24 Jul 2003 20:48:06 -0000	1.70
--- c-semantics.c	29 Aug 2003 22:39:12 -0000
*************** genrtl_scope_stmt (tree t)
*** 645,650 ****
--- 645,651 ----
  	  if (TREE_CODE (fn) == FUNCTION_DECL
  	      && DECL_CONTEXT (fn) == current_function_decl
  	      && DECL_SAVED_INSNS (fn)
+ 	      && DECL_SAVED_INSNS (fn)->saved_for_inline
  	      && !TREE_ASM_WRITTEN (fn)
  	      && TREE_ADDRESSABLE (fn))
  	    {
Index: function.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/function.h,v
retrieving revision 1.101
diff -c -p -d -r1.101 function.h
*** function.h	29 Aug 2003 22:19:35 -0000	1.101
--- function.h	29 Aug 2003 22:39:12 -0000
*************** struct function GTY(())
*** 504,509 ****
--- 504,516 ----
  
    /* Nonzero if code to initialize arg_pointer_save_area has been emitted.  */
    unsigned int arg_pointer_save_area_init : 1;
+ 
+   /* Flag for use by ther rtl inliner, to tell if the function has been
+      processed at least once.  */
+   unsigned int rtl_inline_init : 1;
+ 
+   /* Nonzero if the rtl inliner has saved the function for inlining.  */
+   unsigned int saved_for_inline : 1;
  };
  
  /* The function currently being compiled.  */
Index: integrate.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/integrate.c,v
retrieving revision 1.232
diff -c -p -d -r1.232 integrate.c
*** integrate.c	19 Jul 2003 14:47:07 -0000	1.232
--- integrate.c	29 Aug 2003 22:39:12 -0000
*************** save_for_inline (tree fndecl)
*** 492,498 ****
      }
    cfun->original_decl_initial = DECL_INITIAL (fndecl);
    cfun->no_debugging_symbols = (write_symbols == NO_DEBUG);
!   DECL_SAVED_INSNS (fndecl) = cfun;
  
    /* Clean up.  */
    if (! flag_no_inline)
--- 492,498 ----
      }
    cfun->original_decl_initial = DECL_INITIAL (fndecl);
    cfun->no_debugging_symbols = (write_symbols == NO_DEBUG);
!   cfun->saved_for_inline = 1;
  
    /* Clean up.  */
    if (! flag_no_inline)
Index: toplev.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/toplev.c,v
retrieving revision 1.818
diff -c -p -d -r1.818 toplev.c
*** toplev.c	14 Aug 2003 01:47:30 -0000	1.818
--- toplev.c	29 Aug 2003 22:39:13 -0000
*************** wrapup_global_declarations (tree *vec, i
*** 1588,1593 ****
--- 1588,1594 ----
  	  if (TREE_CODE (decl) == FUNCTION_DECL
  	      && DECL_INITIAL (decl) != 0
  	      && DECL_SAVED_INSNS (decl) != 0
+ 	      && DECL_SAVED_INSNS (decl)->saved_for_inline
  	      && (flag_keep_inline_functions
  		  || (TREE_PUBLIC (decl) && !DECL_COMDAT (decl))
  		  || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))))
*************** rest_of_handle_inlining (tree decl)
*** 2464,2471 ****
  
    /* If we are reconsidering an inline function at the end of
       compilation, skip the stuff for making it inline.  */
!   if (DECL_SAVED_INSNS (decl) != 0)
      return 0;
  
    /* If this is nested inside an inlined external function, pretend
       it was only declared.  Since we cannot inline such functions,
--- 2465,2473 ----
  
    /* If we are reconsidering an inline function at the end of
       compilation, skip the stuff for making it inline.  */
!   if (cfun->rtl_inline_init)
      return 0;
+   cfun->rtl_inline_init = 1;
  
    /* If this is nested inside an inlined external function, pretend
       it was only declared.  Since we cannot inline such functions,
*************** rest_of_handle_inlining (tree decl)
*** 2522,2528 ****
  
    if (open_dump_file (DFI_rtl, decl))
      {
!       if (DECL_SAVED_INSNS (decl))
  	fprintf (rtl_dump_file, ";; (integrable)\n\n");
        close_dump_file (DFI_rtl, print_rtl, insns);
      }
--- 2524,2530 ----
  
    if (open_dump_file (DFI_rtl, decl))
      {
!       if (DECL_SAVED_INSNS (decl) && DECL_SAVED_INSNS (decl)->saved_for_inline)
  	fprintf (rtl_dump_file, ";; (integrable)\n\n");
        close_dump_file (DFI_rtl, print_rtl, insns);
      }
*************** rest_of_compilation (tree decl)
*** 3553,3561 ****
    if (! DECL_DEFER_OUTPUT (decl))
      {
        free_after_compilation (cfun);
- 
-       /* Clear integrate.c's pointer to the cfun structure we just
- 	 destroyed.  */
        DECL_SAVED_INSNS (decl) = 0;
      }
    cfun = 0;
--- 3555,3560 ----


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