cfgrtl.c (emit_insn_at_entry): New function.
authorBernd Schmidt <bernd.schmidt@analog.com>
Fri, 15 Sep 2006 12:35:43 +0000 (12:35 +0000)
committerBernd Schmidt <bernds@gcc.gnu.org>
Fri, 15 Sep 2006 12:35:43 +0000 (12:35 +0000)
* cfgrtl.c (emit_insn_at_entry): New function.
* rtl.h (emit_insn_at_entry): Declare it.
* integrate.c (emit_initial_value_sets): Use it.

From-SVN: r116968

gcc/ChangeLog
gcc/cfgrtl.c
gcc/integrate.c
gcc/rtl.h

index d6f892c6ea6e676fc02e9c7bb077a6da87fe8269..b69961aa18bb7c9fd50532511daf42fd96947f76 100644 (file)
@@ -5,6 +5,10 @@
        expanding the number of iterations.
        * config/bfin/bfin.c (bfin_rtx_costs): Handle UDIV, UMOD.
 
+       * cfgrtl.c (emit_insn_at_entry): New function.
+       * rtl.h (emit_insn_at_entry): Declare it.
+       * integrate.c (emit_initial_value_sets): Use it.
+
 2006-09-15  Kazu Hirata  <kazu@codesourcery.com>
 
        * doc/tm.texi (TARGET_FUNCTION_VALUE): Put @deftypefn all in
index b07bb9467eb17365c363ed7f071e89818ff6f9d3..df281cb2d89bd3e162673459890135f5fbc21ee7 100644 (file)
@@ -453,6 +453,20 @@ entry_of_function (void)
          BB_HEAD (ENTRY_BLOCK_PTR->next_bb) : get_insns ());
 }
 
+/* Emit INSN at the entry point of the function, ensuring that it is only
+   executed once per function.  */
+void
+emit_insn_at_entry (rtx insn)
+{
+  edge_iterator ei = ei_start (ENTRY_BLOCK_PTR->succs);
+  edge e = ei_safe_edge (ei);
+  if (!(e->flags & EDGE_FALLTHRU))
+    abort ();
+
+  insert_insn_on_edge (insn, e);
+  commit_edge_insertions ();
+}
+
 /* Update insns block within BB.  */
 
 void
index 98769354ddff8d8ff7d2d63858c2956ce225617f..a6eeede398596e5efa1b07375361ae3382cd827a 100644 (file)
@@ -294,7 +294,7 @@ emit_initial_value_sets (void)
   seq = get_insns ();
   end_sequence ();
 
-  emit_insn_after (seq, entry_of_function ());
+  emit_insn_at_entry (seq);
   return 0;
 }
 
index 75a89b63df10c92b54af1ef42eedf869789caed7..f8d97a18aad8c71af594d1a1309a667e1ab1414e 100644 (file)
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -2074,6 +2074,7 @@ extern rtx emit (rtx);
 extern void renumber_insns (void);
 extern rtx delete_insn (rtx);
 extern rtx entry_of_function (void);
+extern void emit_insn_at_entry (rtx);
 extern void delete_insn_chain (rtx, rtx);
 extern rtx unlink_insn_chain (rtx, rtx);
 extern rtx delete_insn_and_edges (rtx);