cfg.c (force_nonfallthru_and_redirect): Handle redirecting to the exit block.
authorRichard Henderson <rth@redhat.com>
Wed, 19 Sep 2001 19:29:10 +0000 (12:29 -0700)
committerRichard Henderson <rth@gcc.gnu.org>
Wed, 19 Sep 2001 19:29:10 +0000 (12:29 -0700)
        * cfg.c (force_nonfallthru_and_redirect): Handle redirecting
        to the exit block.
        * Makefile.in (cfg.o): Depend on TM_P_H.

From-SVN: r45696

gcc/ChangeLog
gcc/Makefile.in
gcc/cfg.c

index 9c147c8..22d2074 100644 (file)
@@ -1,5 +1,11 @@
 2001-09-19  Richard Henderson  <rth@redhat.com>
 
+       * cfg.c (force_nonfallthru_and_redirect): Handle redirecting
+       to the exit block.
+       * Makefile.in (cfg.o): Depend on TM_P_H.
+
+2001-09-19  Richard Henderson  <rth@redhat.com>
+
        * config/alpha/alpha.c (local_symbol_p): Split out from ...
        (local_symbolic_operand): ... here.
        (small_symbolic_operand): Check mode.
index 8b7ceb8..57f29c5 100644 (file)
@@ -1490,7 +1490,7 @@ flow.o : flow.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TREE_H) flags.h insn-config.h
    function.h except.h $(EXPR_H) ssa.h $(GGC_H) $(TM_P_H)
 cfg.o : cfg.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) flags.h insn-config.h \
    $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h output.h toplev.h $(RECOG_H) \
-   function.h except.h $(GGC_H) 
+   function.h except.h $(GGC_H) $(TM_P_H)
 cfganal.o : cfganal.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) \
    $(BASIC_BLOCK_H) hard-reg-set.h $(GGC_H)
 cfgbuild.o : cfgbuild.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) flags.h insn-config.h \
index 00645c2..9ba752d 100644 (file)
--- a/gcc/cfg.c
+++ b/gcc/cfg.c
@@ -64,9 +64,16 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include "function.h"
 #include "except.h"
 #include "toplev.h"
-
+#include "tm_p.h"
 #include "obstack.h"
 
+
+/* Stubs in case we haven't got a return insn.  */
+#ifndef HAVE_return
+#define HAVE_return 0
+#define gen_return() NULL_RTX
+#endif
+
 /* The obstack on which the flow graph components are allocated.  */
 
 struct obstack flow_obstack;
@@ -1249,7 +1256,6 @@ force_nonfallthru_and_redirect (e, target)
   basic_block jump_block, new_bb = NULL;
   rtx note;
   edge new_edge;
-  rtx label;
 
   if (e->flags & EDGE_ABNORMAL)
     abort ();
@@ -1290,10 +1296,20 @@ force_nonfallthru_and_redirect (e, target)
   else
     jump_block = e->src;
   e->flags &= ~EDGE_FALLTHRU;
-  label = block_label (target);
-  emit_jump_insn_after (gen_jump (label), jump_block->end);
-  JUMP_LABEL (jump_block->end) = label;
-  LABEL_NUSES (label)++;
+  if (target == EXIT_BLOCK_PTR)
+    {
+      if (HAVE_return)
+       emit_jump_insn_after (gen_return (), jump_block->end);
+      else
+       abort ();
+    }
+  else
+    {
+      rtx label = block_label (target);
+      emit_jump_insn_after (gen_jump (label), jump_block->end);
+      JUMP_LABEL (jump_block->end) = label;
+      LABEL_NUSES (label)++;
+    }
   emit_barrier_after (jump_block->end);
   redirect_edge_succ_nodup (e, target);