OSDN Git Service

* alpha.h (FUNCTION_OK_FOR_SIBCALL): New.
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 17 Mar 2000 22:41:25 +0000 (22:41 +0000)
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 17 Mar 2000 22:41:25 +0000 (22:41 +0000)
        * alpha.md (sibcall, sibcall_value, sibcall_epilogue): New.
        (*sibcall_osf_1, *sibcall_value_osf_1): New.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@32613 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/alpha/alpha.h
gcc/config/alpha/alpha.md

index 3ac1d63..84cd1bb 100644 (file)
        (safe_for_unsave): New.
        * tree.h (lang_safe_for_unsave, safe_for_unsave): Declare.
 
+       * alpha.h (FUNCTION_OK_FOR_SIBCALL): New.
+       * alpha.md (sibcall, sibcall_value, sibcall_epilogue): New.
+       (*sibcall_osf_1, *sibcall_value_osf_1): New.
+
 2000-03-17  Mark Mitchell  <mark@codesourcery.com>
 
        * objc/objc-act.c (encode_method_prototype): Pass types, not
@@ -214,7 +218,7 @@ Thu Mar 16 09:02:19 2000  Jason Eckhardt  <jle@cygnus.com>
 2000-03-16  Neil Booth  <NeilB@earthling.net>
 
        * cppinit.c (handle_option):  Implement #unassert directive
-        as -A- command line option.
+       as -A- command line option.
        (print_help):  Update.
        * cpptexi.c:  Update.
 
@@ -298,9 +302,9 @@ Wed Mar 15 13:07:05 MET 2000  Jan Hubicka  <jh@suse.cz>
 
 Wed Feb 23 13:00:06 CET 2000  Jan Hubicka  <jh@suse.cz>
 
-        * flow.c (fixup_reorder_chain): Avoid double labels in the basic block;
-        end of basic block is jump_insn, not barrier; use create_basic_block
-        instead of creating basic block by hand.
+       * flow.c (fixup_reorder_chain): Avoid double labels in the basic block;
+       end of basic block is jump_insn, not barrier; use create_basic_block
+       instead of creating basic block by hand.
 
 2000-03-14  Jason Eckhardt  <jle@cygnus.com>
 
index 40717ac..15a4b31 100644 (file)
@@ -1168,6 +1168,16 @@ extern int alpha_memory_latency;
     }                                                                  \
 }
 
+/* We do not allow indirect calls to be optimized into sibling calls, nor
+   can we allow a call to a function in a different compilation unit to
+   be optimized into a sibcall.  Except if the function is known not to
+   return, in which case our caller doesn't care what the gp is.  */
+#define FUNCTION_OK_FOR_SIBCALL(DECL)                  \
+  (DECL                                                        \
+   && ((TREE_ASM_WRITTEN (DECL) && !flag_pic)          \
+       || ! TREE_PUBLIC (DECL)                         \
+       || (0 && TREE_THIS_VOLATILE (DECL))))
+
 /* Try to output insns to set TARGET equal to the constant C if it can be
    done in less than N insns.  Do all computations in MODE.  Returns the place
    where the output has been placed if it can be done and the insns have been
index ed4abe0..edba8cf 100644 (file)
   DONE;
 }")
 
+(define_expand "sibcall"
+  [(call (mem:DI (match_operand 0 "" ""))
+                (match_operand 1 "" ""))]
+  "!TARGET_OPEN_VMS && !TARGET_WINDOWS_NT"
+  "
+{
+  if (GET_CODE (operands[0]) != MEM)
+    abort ();
+  operands[0] = XEXP (operands[0], 0);
+}")
+
 (define_expand "call_osf"
   [(parallel [(call (mem:DI (match_operand 0 "" ""))
                    (match_operand 1 "" ""))
   DONE;
 }")
 
+(define_expand "sibcall_value"
+  [(set (match_operand 0 "" "")
+       (call (mem:DI (match_operand 1 "" ""))
+             (match_operand 2 "" "")))]
+  "!TARGET_OPEN_VMS && !TARGET_WINDOWS_NT"
+  "
+{
+  if (GET_CODE (operands[1]) != MEM)
+    abort ();
+  operands[1] = XEXP (operands[1], 0);
+}")
+
 (define_expand "call_value_osf"
   [(parallel [(set (match_operand 0 "" "")
                   (call (mem:DI (match_operand 1 "" ""))
     }
 }")
 
-(define_insn ""
+(define_insn "*call_osf_1"
   [(call (mem:DI (match_operand:DI 0 "call_operand" "r,R,i"))
         (match_operand 1 "" ""))
    (clobber (reg:DI 27))
   [(set_attr "type" "jsr")
    (set_attr "length" "12,*,16")])
       
-(define_insn ""
+(define_insn "*sibcall_osf_1"
+  [(call (mem:DI (match_operand:DI 0 "call_operand" "R,i"))
+        (match_operand 1 "" ""))]
+  "! TARGET_WINDOWS_NT && ! TARGET_OPEN_VMS"
+  "@
+   br $31,$%0..ng
+   jmp $31,%0"
+  [(set_attr "type" "jsr")
+   (set_attr "length" "*,8")])
+
+(define_insn "*call_nt_1"
   [(call (mem:DI (match_operand:DI 0 "call_operand" "r,R,i"))
         (match_operand 1 "" ""))
    (clobber (reg:DI 26))]
   [(set_attr "type" "jsr")
    (set_attr "length" "*,*,12")])
       
-(define_insn ""
+(define_insn "*call_vms_1"
   [(call (mem:DI (match_operand:DI 0 "call_operand" "r,i"))
         (match_operand 1 "" ""))
    (use (match_operand:DI 2 "nonimmediate_operand" "r,m"))
   ""
   "alpha_expand_epilogue ();")
 
+(define_expand "sibcall_epilogue"
+  [(return)]
+  "!TARGET_OPEN_VMS && !TARGET_WINDOWS_NT"
+  "alpha_expand_epilogue (); DONE;")
+
 (define_expand "eh_epilogue"
   [(use (match_operand:DI 0 "register_operand" "r"))
    (use (match_operand:DI 1 "register_operand" "r"))
 ;; The call patterns are at the end of the file because their
 ;; wildcard operand0 interferes with nice recognition.
 
-(define_insn ""
+(define_insn "*call_value_osf_1"
   [(set (match_operand 0 "" "")
        (call (mem:DI (match_operand:DI 1 "call_operand" "r,R,i"))
              (match_operand 2 "" "")))
   [(set_attr "type" "jsr")
    (set_attr "length" "12,*,16")])
 
-(define_insn ""
+(define_insn "*sibcall_value_osf_1"
+  [(set (match_operand 0 "" "")
+       (call (mem:DI (match_operand:DI 1 "call_operand" "R,i"))
+             (match_operand 2 "" "")))]
+  "! TARGET_WINDOWS_NT && ! TARGET_OPEN_VMS"
+  "@
+   br $31,$%1..ng
+   jmp $31,%1"
+  [(set_attr "type" "jsr")
+   (set_attr "length" "*,8")])
+
+(define_insn "*call_value_nt_1"
   [(set (match_operand 0 "" "")
        (call (mem:DI (match_operand:DI 1 "call_operand" "r,R,i"))
              (match_operand 2 "" "")))
   [(set_attr "type" "jsr")
    (set_attr "length" "*,*,12")])
 
-(define_insn ""
+(define_insn "*call_value_vms_1"
   [(set (match_operand 0 "" "")
        (call (mem:DI (match_operand:DI 1 "call_operand" "r,i"))
              (match_operand 2 "" "")))
    ldq $27,%3\;jsr $26,%1\;ldq $27,0($29)"
   [(set_attr "type" "jsr")
    (set_attr "length" "12,16")])
-
 \f
 ;; Peepholes go at the end.