aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2002-01-16 14:15:25 +0000
committerUlrich Weigand <uweigand@gcc.gnu.org>2002-01-16 14:15:25 +0000
commit44b8152b881c0d4e8583ecfffdc41d7a3b1d7a0b (patch)
tree2a8f379c4f813b665e011f940c9d562e40f61f00
parent1d6e90ac10263b976699d6c039dc9a49c0598aaa (diff)
downloadgcc-44b8152b881c0d4e8583ecfffdc41d7a3b1d7a0b.zip
gcc-44b8152b881c0d4e8583ecfffdc41d7a3b1d7a0b.tar.gz
gcc-44b8152b881c0d4e8583ecfffdc41d7a3b1d7a0b.tar.bz2
s390.c (s390_emit_prologue): Do not emit USE insn for GOT register; add REG_MAYBE_DEAD notes instead.
* config/s390/s390.c (s390_emit_prologue): Do not emit USE insn for GOT register; add REG_MAYBE_DEAD notes instead. config/s390/s390.md (call, call_value): Add GOT register to CALL_INSN_FUNCTION_USAGE where needed. (call_exp, call_value_exp): New. From-SVN: r48908
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/config/s390/s390.c8
-rw-r--r--gcc/config/s390/s390.md88
3 files changed, 76 insertions, 28 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 03e675b..5c262ab 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2002-01-16 Ulrich Weigand <uweigand@de.ibm.com>
+
+ * config/s390/s390.c (s390_emit_prologue): Do not emit USE
+ insn for GOT register; add REG_MAYBE_DEAD notes instead.
+ config/s390/s390.md (call, call_value): Add GOT register to
+ CALL_INSN_FUNCTION_USAGE where needed.
+ (call_exp, call_value_exp): New.
+
2002-01-16 Nick Clifton <nickc@cambridge.redhat.com>
* config/arm/arm.c: General formatting tidy up.
diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index f1f45cc..2cf2e41 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -2989,11 +2989,13 @@ s390_emit_prologue ()
got_symbol = force_const_mem (Pmode, got_symbol);
insn = emit_move_insn (pic_offset_table_rtx,
got_symbol);
+ REG_NOTES(insn) = gen_rtx_EXPR_LIST (REG_MAYBE_DEAD, NULL_RTX,
+ REG_NOTES (insn));
+
insn = emit_insn (gen_add2_insn (pic_offset_table_rtx,
gen_rtx_REG (Pmode, BASE_REGISTER)));
-
- /* We need the GOT pointer even if we don't know it ... */
- emit_insn (gen_rtx_USE (VOIDmode, pic_offset_table_rtx));
+ REG_NOTES(insn) = gen_rtx_EXPR_LIST (REG_MAYBE_DEAD, NULL_RTX,
+ REG_NOTES (insn));
}
}
}
diff --git a/gcc/config/s390/s390.md b/gcc/config/s390/s390.md
index 8a8b2ee..9a50992 100644
--- a/gcc/config/s390/s390.md
+++ b/gcc/config/s390/s390.md
@@ -5965,20 +5965,14 @@
;
(define_expand "call"
- [(parallel [(call (match_operand 0 "" "")
- (match_operand 1 "" ""))
- (clobber (match_operand 2 "" ""))])]
+ [(call (match_operand 0 "" "")
+ (match_operand 1 "" ""))
+ (use (match_operand 2 "" ""))]
""
"
{
- /* Abuse operand 2 to hold the return register. */
- operands[2] = gen_rtx_REG (Pmode, RETURN_REGNUM);
-
- /* In 31-bit, we must load the GOT register even if the
- compiler doesn't know about it, because the PLT glue
- code uses it. In 64-bit, this is not necessary. */
- if (flag_pic && !TARGET_64BIT)
- current_function_uses_pic_offset_table = 1;
+ int plt_call = 0;
+ rtx insn;
/* Direct function calls need special treatment. */
if (GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF)
@@ -5987,10 +5981,12 @@
/* When calling a global routine in PIC mode, we must
replace the symbol itself with the PLT stub. */
- if (flag_pic && !SYMBOL_REF_FLAG(sym))
+ if (flag_pic && !SYMBOL_REF_FLAG (sym))
{
sym = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, sym), 113);
sym = gen_rtx_CONST (Pmode, sym);
+
+ plt_call = 1;
}
/* Unless we can use the bras(l) insn, force the
@@ -6004,8 +6000,30 @@
operands[0] = gen_rtx_MEM (QImode, sym);
}
+
+ /* Emit insn. */
+ insn = emit_call_insn (gen_call_exp (operands[0], operands[1],
+ gen_rtx_REG (Pmode, RETURN_REGNUM)));
+
+ /* In 31-bit, we must load the GOT register even if the
+ compiler doesn't know about it, because the PLT glue
+ code uses it. In 64-bit, this is not necessary. */
+ if (plt_call && !TARGET_64BIT)
+ {
+ current_function_uses_pic_offset_table = 1;
+ use_reg (&CALL_INSN_FUNCTION_USAGE (insn), pic_offset_table_rtx);
+ }
+
+ DONE;
}")
+(define_expand "call_exp"
+ [(parallel [(call (match_operand 0 "" "")
+ (match_operand 1 "" ""))
+ (clobber (match_operand 2 "" ""))])]
+ ""
+ "")
+
(define_insn "brasl"
[(call (mem:QI (match_operand:DI 0 "bras_sym_operand" "X"))
(match_operand:SI 1 "const_int_operand" "n"))
@@ -6070,21 +6088,15 @@
;
(define_expand "call_value"
- [(parallel [(set (match_operand 0 "" "")
- (call (match_operand 1 "" "")
- (match_operand 2 "" "")))
- (clobber (match_operand 3 "" ""))])]
+ [(set (match_operand 0 "" "")
+ (call (match_operand 1 "" "")
+ (match_operand 2 "" "")))
+ (use (match_operand 3 "" ""))]
""
"
{
- /* Abuse operand 3 to hold the return register. */
- operands[3] = gen_rtx_REG (Pmode, RETURN_REGNUM);
-
- /* In 31-bit, we must load the GOT register even if the
- compiler doesn't know about it, because the PLT glue
- code uses it. In 64-bit, this is not necessary. */
- if (flag_pic && !TARGET_64BIT)
- current_function_uses_pic_offset_table = 1;
+ int plt_call = 0;
+ rtx insn;
/* Direct function calls need special treatment. */
if (GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF)
@@ -6093,10 +6105,12 @@
/* When calling a global routine in PIC mode, we must
replace the symbol itself with the PLT stub. */
- if (flag_pic && !SYMBOL_REF_FLAG(sym))
+ if (flag_pic && !SYMBOL_REF_FLAG (sym))
{
sym = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, sym), 113);
sym = gen_rtx_CONST (Pmode, sym);
+
+ plt_call = 1;
}
/* Unless we can use the bras(l) insn, force the
@@ -6110,8 +6124,32 @@
operands[1] = gen_rtx_MEM (QImode, sym);
}
+
+ /* Emit insn. */
+ insn = emit_call_insn (
+ gen_call_value_exp (operands[0], operands[1], operands[2],
+ gen_rtx_REG (Pmode, RETURN_REGNUM)));
+
+ /* In 31-bit, we must load the GOT register even if the
+ compiler doesn't know about it, because the PLT glue
+ code uses it. In 64-bit, this is not necessary. */
+ if (plt_call && !TARGET_64BIT)
+ {
+ current_function_uses_pic_offset_table = 1;
+ use_reg (&CALL_INSN_FUNCTION_USAGE (insn), pic_offset_table_rtx);
+ }
+
+ DONE;
}")
+(define_expand "call_value_exp"
+ [(parallel [(set (match_operand 0 "" "")
+ (call (match_operand 1 "" "")
+ (match_operand 2 "" "")))
+ (clobber (match_operand 3 "" ""))])]
+ ""
+ "")
+
(define_insn "brasl_r"
[(set (match_operand 0 "register_operand" "=df")
(call (mem:QI (match_operand:DI 1 "bras_sym_operand" "X"))