Commit 7d89dda5 by Richard Henderson

alpha.h (FUNCTION_OK_FOR_SIBCALL): New.

        * alpha.h (FUNCTION_OK_FOR_SIBCALL): New.
        * alpha.md (sibcall, sibcall_value, sibcall_epilogue): New.
        (*sibcall_osf_1, *sibcall_value_osf_1): New.

From-SVN: r32613
parent 0a1c58a2
...@@ -52,6 +52,10 @@ ...@@ -52,6 +52,10 @@
(safe_for_unsave): New. (safe_for_unsave): New.
* tree.h (lang_safe_for_unsave, safe_for_unsave): Declare. * 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> 2000-03-17 Mark Mitchell <mark@codesourcery.com>
* objc/objc-act.c (encode_method_prototype): Pass types, not * objc/objc-act.c (encode_method_prototype): Pass types, not
......
...@@ -1168,6 +1168,16 @@ extern int alpha_memory_latency; ...@@ -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 /* 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 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 where the output has been placed if it can be done and the insns have been
......
...@@ -3704,6 +3704,17 @@ ...@@ -3704,6 +3704,17 @@
DONE; 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" (define_expand "call_osf"
[(parallel [(call (mem:DI (match_operand 0 "" "")) [(parallel [(call (mem:DI (match_operand 0 "" ""))
(match_operand 1 "" "")) (match_operand 1 "" ""))
...@@ -3815,6 +3826,18 @@ ...@@ -3815,6 +3826,18 @@
DONE; 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" (define_expand "call_value_osf"
[(parallel [(set (match_operand 0 "" "") [(parallel [(set (match_operand 0 "" "")
(call (mem:DI (match_operand 1 "" "")) (call (mem:DI (match_operand 1 "" ""))
...@@ -3903,7 +3926,7 @@ ...@@ -3903,7 +3926,7 @@
} }
}") }")
(define_insn "" (define_insn "*call_osf_1"
[(call (mem:DI (match_operand:DI 0 "call_operand" "r,R,i")) [(call (mem:DI (match_operand:DI 0 "call_operand" "r,R,i"))
(match_operand 1 "" "")) (match_operand 1 "" ""))
(clobber (reg:DI 27)) (clobber (reg:DI 27))
...@@ -3916,7 +3939,17 @@ ...@@ -3916,7 +3939,17 @@
[(set_attr "type" "jsr") [(set_attr "type" "jsr")
(set_attr "length" "12,*,16")]) (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")) [(call (mem:DI (match_operand:DI 0 "call_operand" "r,R,i"))
(match_operand 1 "" "")) (match_operand 1 "" ""))
(clobber (reg:DI 26))] (clobber (reg:DI 26))]
...@@ -3928,7 +3961,7 @@ ...@@ -3928,7 +3961,7 @@
[(set_attr "type" "jsr") [(set_attr "type" "jsr")
(set_attr "length" "*,*,12")]) (set_attr "length" "*,*,12")])
(define_insn "" (define_insn "*call_vms_1"
[(call (mem:DI (match_operand:DI 0 "call_operand" "r,i")) [(call (mem:DI (match_operand:DI 0 "call_operand" "r,i"))
(match_operand 1 "" "")) (match_operand 1 "" ""))
(use (match_operand:DI 2 "nonimmediate_operand" "r,m")) (use (match_operand:DI 2 "nonimmediate_operand" "r,m"))
...@@ -5434,6 +5467,11 @@ ...@@ -5434,6 +5467,11 @@
"" ""
"alpha_expand_epilogue ();") "alpha_expand_epilogue ();")
(define_expand "sibcall_epilogue"
[(return)]
"!TARGET_OPEN_VMS && !TARGET_WINDOWS_NT"
"alpha_expand_epilogue (); DONE;")
(define_expand "eh_epilogue" (define_expand "eh_epilogue"
[(use (match_operand:DI 0 "register_operand" "r")) [(use (match_operand:DI 0 "register_operand" "r"))
(use (match_operand:DI 1 "register_operand" "r")) (use (match_operand:DI 1 "register_operand" "r"))
...@@ -5576,7 +5614,7 @@ ...@@ -5576,7 +5614,7 @@
;; The call patterns are at the end of the file because their ;; The call patterns are at the end of the file because their
;; wildcard operand0 interferes with nice recognition. ;; wildcard operand0 interferes with nice recognition.
(define_insn "" (define_insn "*call_value_osf_1"
[(set (match_operand 0 "" "") [(set (match_operand 0 "" "")
(call (mem:DI (match_operand:DI 1 "call_operand" "r,R,i")) (call (mem:DI (match_operand:DI 1 "call_operand" "r,R,i"))
(match_operand 2 "" ""))) (match_operand 2 "" "")))
...@@ -5590,7 +5628,18 @@ ...@@ -5590,7 +5628,18 @@
[(set_attr "type" "jsr") [(set_attr "type" "jsr")
(set_attr "length" "12,*,16")]) (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 "" "") [(set (match_operand 0 "" "")
(call (mem:DI (match_operand:DI 1 "call_operand" "r,R,i")) (call (mem:DI (match_operand:DI 1 "call_operand" "r,R,i"))
(match_operand 2 "" ""))) (match_operand 2 "" "")))
...@@ -5603,7 +5652,7 @@ ...@@ -5603,7 +5652,7 @@
[(set_attr "type" "jsr") [(set_attr "type" "jsr")
(set_attr "length" "*,*,12")]) (set_attr "length" "*,*,12")])
(define_insn "" (define_insn "*call_value_vms_1"
[(set (match_operand 0 "" "") [(set (match_operand 0 "" "")
(call (mem:DI (match_operand:DI 1 "call_operand" "r,i")) (call (mem:DI (match_operand:DI 1 "call_operand" "r,i"))
(match_operand 2 "" ""))) (match_operand 2 "" "")))
...@@ -5618,7 +5667,6 @@ ...@@ -5618,7 +5667,6 @@
[(set_attr "type" "jsr") [(set_attr "type" "jsr")
(set_attr "length" "12,16")]) (set_attr "length" "12,16")])
;; Peepholes go at the end. ;; Peepholes go at the end.
;; Optimize sign-extension of SImode loads. This shows up in the wake of ;; Optimize sign-extension of SImode loads. This shows up in the wake of
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment