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]

[PATCH] Call free_after_compilation from use_thunk instead of target output_mi_thunk hooks


Hi!

g++.dg/other/pr22003.C fails since my recent -freorder-blocks-and-partition
change to support exceptions on ppc and presumably other architectures.
Well, it actually fails even before those changes, on 4.4 branch etc., but
before those changes dg-require-effective-target freorder wasn't ever true
for C++, so the testcase wasn't run.
use_thunk calls assemble_start_function, then
output_mi_thunk hook and assemble_end_function.  assemble_start_function
for -freorder-blocks-and-partition initializes a bunch of crtl->subsections
fields, then output_mi_thunk on various targets called
free_after_compilation which zeroes out *crtl and afterwards
assembe_end_function wants to use the various crtl->subsections fields.
Fixed by calling free_after_compilation after assemble_end_function instead.
For targets that didn't call free_after_compilation from output_mi_thunk
hook this will mean that *crtl is properly cleaned up, for other targets it
means just that the freeing is done a couple of insns later.

Ok for trunk?

2009-08-19  Jakub Jelinek  <jakub@redhat.com>

	* method.c (use_thunk): Call free_after_compilation after
	assemble_end_function.

	* config/rs6000/rs6000.c (rs6000_output_mi_thunk): Don't call
	free_after_compilation.
	* config/score/score7.c (score7_output_mi_thunk): Likewise.
	* config/score/score3.c (score3_output_mi_thunk): Likewise.
	* config/ia64/ia64.c (ia64_output_mi_thunk): Likewise.
	* config/mips/mips.c (mips_output_mi_thunk): Likewise.
	* config/sh/sh.c (sh_output_mi_thunk): Likewise.
	* config/m68k/m68k.c (m68k_output_mi_thunk): Likewise.
	* config/sparc/sparc.c (sparc_output_mi_thunk): Likewise.

--- gcc/cp/method.c.jj	2009-07-17 11:10:18.000000000 +0200
+++ gcc/cp/method.c	2009-08-19 10:01:43.000000000 +0200
@@ -450,6 +450,7 @@ use_thunk (tree thunk_fndecl, bool emit_
 
       assemble_end_function (thunk_fndecl, fnname);
       init_insn_lengths ();
+      free_after_compilation (cfun);
       current_function_decl = 0;
       set_cfun (NULL);
       TREE_ASM_WRITTEN (thunk_fndecl) = 1;
--- gcc/config/rs6000/rs6000.c.jj	2009-08-18 13:38:17.000000000 +0200
+++ gcc/config/rs6000/rs6000.c	2009-08-19 10:03:48.000000000 +0200
@@ -20117,7 +20117,6 @@ rs6000_output_mi_thunk (FILE *file, tree
   final_start_function (insn, file, 1);
   final (insn, file, 1);
   final_end_function ();
-  free_after_compilation (cfun);
 
   reload_completed = 0;
   epilogue_completed = 0;
--- gcc/config/score/score7.c.jj	2009-08-03 15:47:39.000000000 +0200
+++ gcc/config/score/score7.c	2009-08-19 10:03:57.000000000 +0200
@@ -379,7 +379,6 @@ score7_output_mi_thunk (FILE *file, tree
   final_start_function (insn, file, 1);
   final (insn, file, 1);
   final_end_function ();
-  free_after_compilation (cfun);
 
   /* Clean up the vars set above.  Note that final_end_function resets
      the global pointer for us.  */
--- gcc/config/score/score3.c.jj	2009-08-03 15:47:39.000000000 +0200
+++ gcc/config/score/score3.c	2009-08-19 10:03:54.000000000 +0200
@@ -380,7 +380,6 @@ score3_output_mi_thunk (FILE *file, tree
   final_start_function (insn, file, 1);
   final (insn, file, 1);
   final_end_function ();
-  free_after_compilation (cfun);
 
   /* Clean up the vars set above.  Note that final_end_function resets
      the global pointer for us.  */
--- gcc/config/ia64/ia64.c.jj	2009-08-03 15:47:38.000000000 +0200
+++ gcc/config/ia64/ia64.c	2009-08-19 10:04:01.000000000 +0200
@@ -10288,7 +10288,6 @@ ia64_output_mi_thunk (FILE *file, tree t
   final_start_function (insn, file, 1);
   final (insn, file, 1);
   final_end_function ();
-  free_after_compilation (cfun);
 
   reload_completed = 0;
   epilogue_completed = 0;
--- gcc/config/mips/mips.c.jj	2009-08-18 13:02:17.000000000 +0200
+++ gcc/config/mips/mips.c	2009-08-19 10:04:04.000000000 +0200
@@ -13942,7 +13942,6 @@ mips_output_mi_thunk (FILE *file, tree t
   final_start_function (insn, file, 1);
   final (insn, file, 1);
   final_end_function ();
-  free_after_compilation (cfun);
 
   /* Clean up the vars set above.  Note that final_end_function resets
      the global pointer for us.  */
--- gcc/config/sh/sh.c.jj	2009-08-18 13:02:16.000000000 +0200
+++ gcc/config/sh/sh.c	2009-08-19 10:04:07.000000000 +0200
@@ -11282,7 +11282,6 @@ sh_output_mi_thunk (FILE *file, tree thu
   final_start_function (insns, file, 1);
   final (insns, file, 1);
   final_end_function ();
-  free_after_compilation (cfun);
 
   reload_completed = 0;
   epilogue_completed = 0;
--- gcc/config/m68k/m68k.c.jj	2009-05-20 14:10:10.000000000 +0200
+++ gcc/config/m68k/m68k.c	2009-08-19 10:04:19.000000000 +0200
@@ -5026,7 +5026,6 @@ m68k_output_mi_thunk (FILE *file, tree t
   /* Restore the original PIC register.  */
   if (flag_pic)
     SET_REGNO (pic_offset_table_rtx, PIC_REG);
-  free_after_compilation (cfun);
 }
 
 /* Worker function for TARGET_STRUCT_VALUE_RTX.  */
--- gcc/config/sparc/sparc.c.jj	2009-08-07 08:19:25.000000000 +0200
+++ gcc/config/sparc/sparc.c	2009-08-19 10:04:29.000000000 +0200
@@ -8942,7 +8942,6 @@ sparc_output_mi_thunk (FILE *file, tree 
   final_start_function (insn, file, 1);
   final (insn, file, 1);
   final_end_function ();
-  free_after_compilation (cfun);
 
   reload_completed = 0;
   epilogue_completed = 0;


	Jakub


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