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] Fix PR 16089, emit_initial_value_sets not CFG aware


The problem for this PR, is that emit_initial_value_sets is not CFG aware so would cause
an ICE;  it would put insns before the first BB.  This patches fixes this problem and
it moves a previous private function from builtins.c to cfgrtl.c which emit_initial_value_sets
now uses.

Thanks,
Andrew Pinski

ChangeLog:

	* builtins.c (entry_of_function): Move to ...
	* cfgrtl.c (entry_of_function): Here and make non-static.
	* integrate.c (emit_initial_value_sets): Use entry_of_function.
	* rtl.h (entry_of_function): Prototype.


Patch:
Index: builtins.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/builtins.c,v
retrieving revision 1.339
diff -u -p -r1.339 builtins.c
--- builtins.c	19 Jun 2004 15:33:05 -0000	1.339
+++ builtins.c	20 Jun 2004 15:41:29 -0000
@@ -1207,13 +1207,6 @@ expand_builtin_apply_args_1 (void)
   return copy_addr_to_reg (XEXP (registers, 0));
 }
 
-/* Return RTX to emit after when we want to emit code on the entry of function.  */
-static rtx
-entry_of_function (void)
-{
-  return (n_basic_blocks ? BB_HEAD (ENTRY_BLOCK_PTR->next_bb) : get_insns ());
-}
-
 /* __builtin_apply_args returns block of memory allocated on
    the stack into which is stored the arg pointer, structure
    value address, static chain, and all the registers that might
Index: cfgrtl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfgrtl.c,v
retrieving revision 1.121
diff -u -p -r1.121 cfgrtl.c
--- cfgrtl.c	14 Jun 2004 12:09:07 -0000	1.121
+++ cfgrtl.c	20 Jun 2004 15:41:32 -0000
@@ -440,6 +440,13 @@ free_bb_for_insn (void)
       BLOCK_FOR_INSN (insn) = NULL;
 }
 
+/* Return RTX to emit after when we want to emit code on the entry of function.  */
+rtx
+entry_of_function (void)
+{
+  return (n_basic_blocks ? BB_HEAD (ENTRY_BLOCK_PTR->next_bb) : get_insns ());
+}
+
 /* Update insns block within BB.  */
 
 void
Index: integrate.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/integrate.c,v
retrieving revision 1.257
diff -u -p -r1.257 integrate.c
--- integrate.c	15 Jun 2004 18:02:25 -0000	1.257
+++ integrate.c	20 Jun 2004 15:41:47 -0000
@@ -1300,7 +1300,7 @@ emit_initial_value_sets (void)
   seq = get_insns ();
   end_sequence ();
 
-  emit_insn_after (seq, get_insns ());
+  emit_insn_after (seq, entry_of_function ());
 }
 
 /* If the backend knows where to allocate pseudos for hard
Index: rtl.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/rtl.h,v
retrieving revision 1.480
diff -u -p -r1.480 rtl.h
--- rtl.h	18 Jun 2004 07:33:07 -0000	1.480
+++ rtl.h	20 Jun 2004 15:41:51 -0000
@@ -2199,6 +2199,7 @@ void restore_line_number_status (int old
 extern void renumber_insns (FILE *);
 extern void remove_unnecessary_notes (void);
 extern rtx delete_insn (rtx);
+extern rtx entry_of_function (void);
 extern void delete_insn_chain (rtx, rtx);
 extern rtx unlink_insn_chain (rtx, rtx);
 extern rtx delete_insn_and_edges (rtx);


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