gcc/
authorRichard Sandiford <richard.sandiford@arm.com>
Sun, 5 Jul 2015 07:48:04 +0000 (07:48 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Sun, 5 Jul 2015 07:48:04 +0000 (07:48 +0000)
* target-insns.def (builtin_longjmp, builtin_setjmp_receiver)
(builtin_setjmp_setup, exception_receiver, nonlocal_goto)
(nonlocal_goto_receiver): New targetm instruction patterns.
* builtins.c (expand_builtin_setjmp_setup): Use them instead
of HAVE_*/gen_* interface.
(expand_builtin_setjmp_receiver): Likewise.
(expand_builtin_longjmp, expand_builtin_nonlocal_goto): Likewise.
* except.c (expand_dw2_landing_pad_for_region): Likewise.

From-SVN: r225422

gcc/ChangeLog
gcc/builtins.c
gcc/except.c
gcc/target-insns.def

index 9ca2040e567d05816bb0bb4753d28fa663c17094..bcc35c046dd4b01875b4dd0f68b01a4ff69b0721 100644 (file)
@@ -1,3 +1,14 @@
+2015-07-05  Richard Sandiford  <richard.sandiford@arm.com>
+
+       * target-insns.def (builtin_longjmp, builtin_setjmp_receiver)
+       (builtin_setjmp_setup, exception_receiver, nonlocal_goto)
+       (nonlocal_goto_receiver): New targetm instruction patterns.
+       * builtins.c (expand_builtin_setjmp_setup): Use them instead
+       of HAVE_*/gen_* interface.
+       (expand_builtin_setjmp_receiver): Likewise.
+       (expand_builtin_longjmp, expand_builtin_nonlocal_goto): Likewise.
+       * except.c (expand_dw2_landing_pad_for_region): Likewise.
+
 2015-07-05  Richard Sandiford  <richard.sandiford@arm.com>
 
        * target.def: Add code_for_* hooks.
index 5f53342205a1e924a3f540861898e38838a7c395..c5a79803517a534aa8c7941e4964ed0a4764fd70 100644 (file)
@@ -889,10 +889,8 @@ expand_builtin_setjmp_setup (rtx buf_addr, rtx receiver_label)
   emit_stack_save (SAVE_NONLOCAL, &stack_save);
 
   /* If there is further processing to do, do it.  */
-#ifdef HAVE_builtin_setjmp_setup
-  if (HAVE_builtin_setjmp_setup)
-    emit_insn (gen_builtin_setjmp_setup (buf_addr));
-#endif
+  if (targetm.have_builtin_setjmp_setup ())
+    emit_insn (targetm.gen_builtin_setjmp_setup (buf_addr));
 
   /* We have a nonlocal label.   */
   cfun->has_nonlocal_label = 1;
@@ -903,7 +901,7 @@ expand_builtin_setjmp_setup (rtx buf_addr, rtx receiver_label)
    If RECEIVER_LABEL is NULL, instead contruct a nonlocal goto handler.  */
 
 void
-expand_builtin_setjmp_receiver (rtx receiver_label ATTRIBUTE_UNUSED)
+expand_builtin_setjmp_receiver (rtx receiver_label)
 {
   rtx chain;
 
@@ -919,9 +917,7 @@ expand_builtin_setjmp_receiver (rtx receiver_label ATTRIBUTE_UNUSED)
 
   /* Now put in the code to restore the frame pointer, and argument
      pointer, if needed.  */
-#ifdef HAVE_nonlocal_goto
-  if (! HAVE_nonlocal_goto)
-#endif
+  if (! targetm.have_nonlocal_goto ())
     {
       /* First adjust our frame pointer to its actual value.  It was
         previously set to the start of the virtual area corresponding to
@@ -972,17 +968,12 @@ expand_builtin_setjmp_receiver (rtx receiver_label ATTRIBUTE_UNUSED)
     }
 #endif
 
-#ifdef HAVE_builtin_setjmp_receiver
-  if (receiver_label != NULL && HAVE_builtin_setjmp_receiver)
-    emit_insn (gen_builtin_setjmp_receiver (receiver_label));
+  if (receiver_label != NULL && targetm.have_builtin_setjmp_receiver ())
+    emit_insn (targetm.gen_builtin_setjmp_receiver (receiver_label));
+  else if (targetm.have_nonlocal_goto_receiver ())
+    emit_insn (targetm.gen_nonlocal_goto_receiver ());
   else
-#endif
-#ifdef HAVE_nonlocal_goto_receiver
-    if (HAVE_nonlocal_goto_receiver)
-      emit_insn (gen_nonlocal_goto_receiver ());
-    else
-#endif
-      { /* Nothing */ }
+    { /* Nothing */ }
 
   /* We must not allow the code we just generated to be reordered by
      scheduling.  Specifically, the update of the frame pointer must
@@ -1019,11 +1010,9 @@ expand_builtin_longjmp (rtx buf_addr, rtx value)
   gcc_assert (value == const1_rtx);
 
   last = get_last_insn ();
-#ifdef HAVE_builtin_longjmp
-  if (HAVE_builtin_longjmp)
-    emit_insn (gen_builtin_longjmp (buf_addr));
+  if (targetm.have_builtin_longjmp ())
+    emit_insn (targetm.gen_builtin_longjmp (buf_addr));
   else
-#endif
     {
       fp = gen_rtx_MEM (Pmode, buf_addr);
       lab = gen_rtx_MEM (Pmode, plus_constant (Pmode, buf_addr,
@@ -1037,14 +1026,12 @@ expand_builtin_longjmp (rtx buf_addr, rtx value)
 
       /* Pick up FP, label, and SP from the block and jump.  This code is
         from expand_goto in stmt.c; see there for detailed comments.  */
-#ifdef HAVE_nonlocal_goto
-      if (HAVE_nonlocal_goto)
+      if (targetm.have_nonlocal_goto ())
        /* We have to pass a value to the nonlocal_goto pattern that will
           get copied into the static_chain pointer, but it does not matter
           what that value is, because builtin_setjmp does not use it.  */
-       emit_insn (gen_nonlocal_goto (value, lab, stack, fp));
+       emit_insn (targetm.gen_nonlocal_goto (value, lab, stack, fp));
       else
-#endif
        {
          lab = copy_to_reg (lab);
 
@@ -1166,12 +1153,10 @@ expand_builtin_nonlocal_goto (tree exp)
 
   crtl->has_nonlocal_goto = 1;
 
-#ifdef HAVE_nonlocal_goto
   /* ??? We no longer need to pass the static chain value, afaik.  */
-  if (HAVE_nonlocal_goto)
-    emit_insn (gen_nonlocal_goto (const0_rtx, r_label, r_sp, r_fp));
+  if (targetm.have_nonlocal_goto ())
+    emit_insn (targetm.gen_nonlocal_goto (const0_rtx, r_label, r_sp, r_fp));
   else
-#endif
     {
       r_label = copy_to_reg (r_label);
 
index d5f886e6a176d6b60f30bdf41ed0ca08e6eea4f4..399034aab05008950bc11b84b510a650f86ab6ef 100644 (file)
@@ -959,16 +959,11 @@ emit_to_new_bb_before (rtx_insn *seq, rtx insn)
 void
 expand_dw2_landing_pad_for_region (eh_region region)
 {
-#ifdef HAVE_exception_receiver
-  if (HAVE_exception_receiver)
-    emit_insn (gen_exception_receiver ());
+  if (targetm.have_exception_receiver ())
+    emit_insn (targetm.gen_exception_receiver ());
+  else if (targetm.have_nonlocal_goto_receiver ())
+    emit_insn (targetm.gen_nonlocal_goto_receiver ());
   else
-#endif
-#ifdef HAVE_nonlocal_goto_receiver
-  if (HAVE_nonlocal_goto_receiver)
-    emit_insn (gen_nonlocal_goto_receiver ());
-  else
-#endif
     { /* Nothing */ }
 
   if (region->exc_ptr_reg)
index 2c5288ebd05478a84be089ee801c4413f56426e3..bc4aa4d5f7c620b06422715924dab90090810a11 100644 (file)
    Patterns that take no operands should have a prototype "(void)".
 
    Instructions should be documented in md.texi rather than here.  */
+DEF_TARGET_INSN (builtin_longjmp, (rtx x0))
+DEF_TARGET_INSN (builtin_setjmp_receiver, (rtx x0))
+DEF_TARGET_INSN (builtin_setjmp_setup, (rtx x0))
 DEF_TARGET_INSN (canonicalize_funcptr_for_compare, (rtx x0, rtx x1))
 DEF_TARGET_INSN (casesi, (rtx x0, rtx x1, rtx x2, rtx x3, rtx x4))
 DEF_TARGET_INSN (epilogue, (void))
+DEF_TARGET_INSN (exception_receiver, (void))
 DEF_TARGET_INSN (jump, (rtx x0))
 DEF_TARGET_INSN (load_multiple, (rtx x0, rtx x1, rtx x2))
 DEF_TARGET_INSN (mem_signal_fence, (rtx x0))
 DEF_TARGET_INSN (mem_thread_fence, (rtx x0))
 DEF_TARGET_INSN (memory_barrier, (void))
+DEF_TARGET_INSN (nonlocal_goto, (rtx x0, rtx x1, rtx x2, rtx x3))
+DEF_TARGET_INSN (nonlocal_goto_receiver, (void))
 DEF_TARGET_INSN (prologue, (void))
 DEF_TARGET_INSN (return, (void))
 DEF_TARGET_INSN (sibcall_epilogue, (void))