aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2014-03-15 21:40:29 +0000
committerEric Botcazou <ebotcazou@adacore.com>2014-03-15 21:40:29 +0000
commitc2d6aa3d9eda8d208db701179ca5c5f33cbda81a (patch)
tree8ee120c58c28488da9d3020ea35a3825df9990ca
parente15d8e993749bd4f16d3600e859875b9e82918ee (diff)
* config/sparc/sparc-protos.h (tls_call_delay): Delete.
(eligible_for_call_delay): New prototype. * config/sparc/sparc.c (tls_call_delay): Rename into... (eligible_for_call_delay): ...this. Return false if the instruction cannot be put in the delay slot of a branch. (eligible_for_restore_insn): Simplify. (eligible_for_return_delay): Return false if the instruction cannot be put in the delay slot of a branch and simplify. (eligible_for_sibcall_delay): Return false if the instruction cannot be put in the delay slot of a branch. * config/sparc/sparc.md (fix_ut699): New attribute. (tls_call_delay): Delete. (in_call_delay): Reimplement. (eligible_for_sibcall_del1ay): Rename into... (in_sibcall_delay): ...this. (eligible_for_return_delay): Rename into... (in_return_delay): ...this. (in_branch_delay): Reimplement. (in_uncond_branch_delay): Delete. (in_annul_branch_delay): Delete. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@208598 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog23
-rw-r--r--gcc/config/sparc/sparc-protos.h2
-rw-r--r--gcc/config/sparc/sparc.c42
-rw-r--r--gcc/config/sparc/sparc.md74
4 files changed, 70 insertions, 71 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index b6d7f7e687d..95c7cfaf3d2 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,26 @@
+2014-03-15 Eric Botcazou <ebotcazou@adacore.com>
+
+ * config/sparc/sparc-protos.h (tls_call_delay): Delete.
+ (eligible_for_call_delay): New prototype.
+ * config/sparc/sparc.c (tls_call_delay): Rename into...
+ (eligible_for_call_delay): ...this. Return false if the instruction
+ cannot be put in the delay slot of a branch.
+ (eligible_for_restore_insn): Simplify.
+ (eligible_for_return_delay): Return false if the instruction cannot be
+ put in the delay slot of a branch and simplify.
+ (eligible_for_sibcall_delay): Return false if the instruction cannot be
+ put in the delay slot of a branch.
+ * config/sparc/sparc.md (fix_ut699): New attribute.
+ (tls_call_delay): Delete.
+ (in_call_delay): Reimplement.
+ (eligible_for_sibcall_delay): Rename into...
+ (in_sibcall_delay): ...this.
+ (eligible_for_return_delay): Rename into...
+ (in_return_delay): ...this.
+ (in_branch_delay): Reimplement.
+ (in_uncond_branch_delay): Delete.
+ (in_annul_branch_delay): Delete.
+
2014-03-14 Georg-Johann Lay <avr@gjlay.de>
Backport from 2014-03-14 trunk r208562.
diff --git a/gcc/config/sparc/sparc-protos.h b/gcc/config/sparc/sparc-protos.h
index a0c1a7a05f4..1fd71655705 100644
--- a/gcc/config/sparc/sparc-protos.h
+++ b/gcc/config/sparc/sparc-protos.h
@@ -84,9 +84,9 @@ extern void emit_conditional_branch_insn (rtx []);
extern int mems_ok_for_ldd_peep (rtx, rtx, rtx);
extern int empty_delay_slot (rtx);
extern int emit_cbcond_nop (rtx);
+extern int eligible_for_call_delay (rtx);
extern int eligible_for_return_delay (rtx);
extern int eligible_for_sibcall_delay (rtx);
-extern int tls_call_delay (rtx);
extern int emit_move_sequence (rtx, enum machine_mode);
extern int fp_sethi_p (rtx);
extern int fp_mov_p (rtx);
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index c5bcb3ba8cf..829dc70f9a4 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -3329,10 +3329,13 @@ emit_cbcond_nop (rtx insn)
/* Return nonzero if TRIAL can go into the call delay slot. */
int
-tls_call_delay (rtx trial)
+eligible_for_call_delay (rtx trial)
{
rtx pat;
+ if (get_attr_in_branch_delay (trial) == IN_BRANCH_DELAY_FALSE)
+ return 0;
+
/* Binutils allows
call __tls_get_addr, %tgd_call (foo)
add %l7, %o0, %o0, %tgd_add (foo)
@@ -3414,11 +3417,7 @@ eligible_for_restore_insn (rtx trial, bool return_p)
/* If we have the 'return' instruction, anything that does not use
local or output registers and can go into a delay slot wins. */
- else if (return_p
- && TARGET_V9
- && !epilogue_renumber (&pat, 1)
- && get_attr_in_uncond_branch_delay (trial)
- == IN_UNCOND_BRANCH_DELAY_TRUE)
+ else if (return_p && TARGET_V9 && !epilogue_renumber (&pat, 1))
return 1;
/* The 'restore src1,src2,dest' pattern for SImode. */
@@ -3461,21 +3460,20 @@ eligible_for_return_delay (rtx trial)
int regno;
rtx pat;
- if (GET_CODE (trial) != INSN)
- return 0;
-
- if (get_attr_length (trial) != 1)
- return 0;
-
/* If the function uses __builtin_eh_return, the eh_return machinery
occupies the delay slot. */
if (crtl->calls_eh_return)
return 0;
+ if (get_attr_in_branch_delay (trial) == IN_BRANCH_DELAY_FALSE)
+ return 0;
+
/* In the case of a leaf or flat function, anything can go into the slot. */
if (sparc_leaf_function_p || TARGET_FLAT)
- return
- get_attr_in_uncond_branch_delay (trial) == IN_UNCOND_BRANCH_DELAY_TRUE;
+ return 1;
+
+ if (!NONJUMP_INSN_P (trial))
+ return 0;
pat = PATTERN (trial);
if (GET_CODE (pat) == PARALLEL)
@@ -3495,9 +3493,7 @@ eligible_for_return_delay (rtx trial)
if (regno >= 8 && regno < 24)
return 0;
}
- return !epilogue_renumber (&pat, 1)
- && (get_attr_in_uncond_branch_delay (trial)
- == IN_UNCOND_BRANCH_DELAY_TRUE);
+ return !epilogue_renumber (&pat, 1);
}
if (GET_CODE (pat) != SET)
@@ -3517,10 +3513,7 @@ eligible_for_return_delay (rtx trial)
instruction, it can probably go in. But restore will not work
with FP_REGS. */
if (! SPARC_INT_REG_P (regno))
- return (TARGET_V9
- && !epilogue_renumber (&pat, 1)
- && get_attr_in_uncond_branch_delay (trial)
- == IN_UNCOND_BRANCH_DELAY_TRUE);
+ return TARGET_V9 && !epilogue_renumber (&pat, 1);
return eligible_for_restore_insn (trial, true);
}
@@ -3532,10 +3525,10 @@ eligible_for_sibcall_delay (rtx trial)
{
rtx pat;
- if (GET_CODE (trial) != INSN || GET_CODE (PATTERN (trial)) != SET)
+ if (get_attr_in_branch_delay (trial) == IN_BRANCH_DELAY_FALSE)
return 0;
- if (get_attr_length (trial) != 1)
+ if (!NONJUMP_INSN_P (trial))
return 0;
pat = PATTERN (trial);
@@ -3554,6 +3547,9 @@ eligible_for_sibcall_delay (rtx trial)
return 1;
}
+ if (GET_CODE (pat) != SET)
+ return 0;
+
/* Otherwise, only operations which can be done in tandem with
a `restore' insn can go into the delay slot. */
if (GET_CODE (SET_DEST (pat)) != REG
diff --git a/gcc/config/sparc/sparc.md b/gcc/config/sparc/sparc.md
index 737cff0310e..9b0bad35861 100644
--- a/gcc/config/sparc/sparc.md
+++ b/gcc/config/sparc/sparc.md
@@ -285,7 +285,8 @@
(const_string "none"))
(define_attr "pic" "false,true"
- (symbol_ref "(flag_pic != 0 ? PIC_TRUE : PIC_FALSE)"))
+ (symbol_ref "(flag_pic != 0
+ ? PIC_TRUE : PIC_FALSE)"))
(define_attr "calls_alloca" "false,true"
(symbol_ref "(cfun->calls_alloca != 0
@@ -307,6 +308,10 @@
(symbol_ref "(TARGET_FLAT != 0
? FLAT_TRUE : FLAT_FALSE)"))
+(define_attr "fix_ut699" "false,true"
+ (symbol_ref "(sparc_fix_ut699 != 0
+ ? FIX_UT699_TRUE : FIX_UT699_FALSE)"))
+
;; Length (in # of insns).
;; Beware that setting a length greater or equal to 3 for conditional branches
;; has a side-effect (see output_cbranch and output_v9branch).
@@ -421,32 +426,18 @@
[(set_attr "length" "2")
(set_attr "type" "multi")])
-;; Attributes for instruction and branch scheduling
-(define_attr "tls_call_delay" "false,true"
- (symbol_ref "(tls_call_delay (insn)
- ? TLS_CALL_DELAY_TRUE : TLS_CALL_DELAY_FALSE)"))
-
+;; Attributes for branch scheduling
(define_attr "in_call_delay" "false,true"
- (cond [(eq_attr "type" "uncond_branch,branch,cbcond,uncond_cbcond,call,sibcall,call_no_delay_slot,multi")
- (const_string "false")
- (eq_attr "type" "load,fpload,store,fpstore")
- (if_then_else (eq_attr "length" "1")
- (const_string "true")
- (const_string "false"))]
- (if_then_else (and (eq_attr "length" "1")
- (eq_attr "tls_call_delay" "true"))
- (const_string "true")
- (const_string "false"))))
-
-(define_attr "eligible_for_sibcall_delay" "false,true"
+ (symbol_ref "(eligible_for_call_delay (insn)
+ ? IN_CALL_DELAY_TRUE : IN_CALL_DELAY_FALSE)"))
+
+(define_attr "in_sibcall_delay" "false,true"
(symbol_ref "(eligible_for_sibcall_delay (insn)
- ? ELIGIBLE_FOR_SIBCALL_DELAY_TRUE
- : ELIGIBLE_FOR_SIBCALL_DELAY_FALSE)"))
+ ? IN_SIBCALL_DELAY_TRUE : IN_SIBCALL_DELAY_FALSE)"))
-(define_attr "eligible_for_return_delay" "false,true"
+(define_attr "in_return_delay" "false,true"
(symbol_ref "(eligible_for_return_delay (insn)
- ? ELIGIBLE_FOR_RETURN_DELAY_TRUE
- : ELIGIBLE_FOR_RETURN_DELAY_FALSE)"))
+ ? IN_RETURN_DELAY_TRUE : IN_RETURN_DELAY_FALSE)"))
;; ??? !v9: Should implement the notion of predelay slots for floating-point
;; branches. This would allow us to remove the nop always inserted before
@@ -461,39 +452,28 @@
;; because it prevents us from moving back the final store of inner loops.
(define_attr "in_branch_delay" "false,true"
- (if_then_else (and (eq_attr "type" "!uncond_branch,branch,cbcond,uncond_cbcond,call,sibcall,call_no_delay_slot,multi")
- (eq_attr "length" "1"))
- (const_string "true")
- (const_string "false")))
-
-(define_attr "in_uncond_branch_delay" "false,true"
- (if_then_else (and (eq_attr "type" "!uncond_branch,branch,cbcond,uncond_cbcond,call,sibcall,call_no_delay_slot,multi")
- (eq_attr "length" "1"))
- (const_string "true")
- (const_string "false")))
-
-(define_attr "in_annul_branch_delay" "false,true"
- (if_then_else (and (eq_attr "type" "!uncond_branch,branch,cbcond,uncond_cbcond,call,sibcall,call_no_delay_slot,multi")
- (eq_attr "length" "1"))
- (const_string "true")
- (const_string "false")))
+ (cond [(eq_attr "type" "uncond_branch,branch,cbcond,uncond_cbcond,call,sibcall,call_no_delay_slot,multi")
+ (const_string "false")
+ (and (eq_attr "fix_ut699" "true") (eq_attr "type" "load,sload"))
+ (const_string "false")
+ (eq_attr "length" "1")
+ (const_string "true")
+ ] (const_string "false")))
(define_delay (eq_attr "type" "call")
[(eq_attr "in_call_delay" "true") (nil) (nil)])
(define_delay (eq_attr "type" "sibcall")
- [(eq_attr "eligible_for_sibcall_delay" "true") (nil) (nil)])
+ [(eq_attr "in_sibcall_delay" "true") (nil) (nil)])
+
+(define_delay (eq_attr "type" "return")
+ [(eq_attr "in_return_delay" "true") (nil) (nil)])
(define_delay (eq_attr "type" "branch")
- [(eq_attr "in_branch_delay" "true")
- (nil) (eq_attr "in_annul_branch_delay" "true")])
+ [(eq_attr "in_branch_delay" "true") (nil) (eq_attr "in_branch_delay" "true")])
(define_delay (eq_attr "type" "uncond_branch")
- [(eq_attr "in_uncond_branch_delay" "true")
- (nil) (nil)])
-
-(define_delay (eq_attr "type" "return")
- [(eq_attr "eligible_for_return_delay" "true") (nil) (nil)])
+ [(eq_attr "in_branch_delay" "true") (nil) (nil)])
;; Include SPARC DFA schedulers