This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[Patch] S/390 nonlocal goto problem
- From: Andreas Krebbel <krebbel1 at de dot ibm dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 29 Sep 2003 09:47:04 +0200
- Subject: [Patch] S/390 nonlocal goto problem
- Organization: IBM Entwicklung GmbH
Hello,
the patch I've posted on Friday was line wrapped by my mail client. The following version should
apply without problems.
Sorry!
Index: gcc/config/s390/s390.md
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/config/s390/s390.md,v
retrieving revision 1.75
diff -p -c -r1.75 s390.md
*** gcc/config/s390/s390.md 29 Aug 2003 00:40:40 -0000 1.75
--- gcc/config/s390/s390.md 26 Sep 2003 08:45:29 -0000
***************
*** 7057,7076 ****
;
! ; setjmp/longjmp instruction pattern(s).
;
- (define_expand "builtin_setjmp_setup"
- [(match_operand 0 "register_operand" "")]
- ""
- {
- rtx base = gen_rtx_MEM (Pmode, plus_constant (operands[0], 4 * GET_MODE_SIZE (Pmode)));
- rtx basereg = gen_rtx_REG (Pmode, BASE_REGISTER);
-
- emit_move_insn (base, basereg);
- DONE;
- })
-
(define_expand "builtin_setjmp_receiver"
[(match_operand 0 "" "")]
"flag_pic"
--- 7057,7065 ----
;
! ; setjmp instruction pattern.
;
(define_expand "builtin_setjmp_receiver"
[(match_operand 0 "" "")]
"flag_pic"
***************
*** 7080,7110 ****
DONE;
})
- (define_expand "builtin_longjmp"
- [(match_operand 0 "register_operand" "")]
- ""
- {
- /* The elements of the buffer are, in order: */
- rtx fp = gen_rtx_MEM (Pmode, operands[0]);
- rtx lab = gen_rtx_MEM (Pmode, plus_constant (operands[0], GET_MODE_SIZE (Pmode)));
- rtx stack = gen_rtx_MEM (Pmode, plus_constant (operands[0], 2 * GET_MODE_SIZE (Pmode)));
- rtx base = gen_rtx_MEM (Pmode, plus_constant (operands[0], 4 * GET_MODE_SIZE (Pmode)));
- rtx basereg = gen_rtx_REG (Pmode, BASE_REGISTER);
- rtx jmp = gen_reg_rtx (Pmode);
-
- emit_move_insn (jmp, lab);
- emit_move_insn (basereg, base);
- emit_stack_restore (SAVE_NONLOCAL, stack, NULL_RTX);
- emit_move_insn (hard_frame_pointer_rtx, fp);
-
- emit_insn (gen_rtx_USE (VOIDmode, hard_frame_pointer_rtx));
- emit_insn (gen_rtx_USE (VOIDmode, stack_pointer_rtx));
- emit_insn (gen_rtx_USE (VOIDmode, basereg));
- emit_indirect_jump (jmp);
- DONE;
- })
-
-
;; These patterns say how to save and restore the stack pointer. We need not
;; save the stack pointer at function level since we are careful to
;; preserve the backchain. At block level, we have to restore the backchain
--- 7069,7074 ----
***************
*** 7144,7156 ****
{
rtx temp = gen_reg_rtx (Pmode);
! /* Copy the backchain to the first word, sp to the second. */
emit_move_insn (temp, gen_rtx_MEM (Pmode, operands[1]));
emit_move_insn (operand_subword (operands[0], 0, 0,
! TARGET_64BIT ? TImode : DImode),
temp);
emit_move_insn (operand_subword (operands[0], 1, 0,
! TARGET_64BIT ? TImode : DImode),
operands[1]);
DONE;
})
--- 7108,7124 ----
{
rtx temp = gen_reg_rtx (Pmode);
! /* Copy the backchain to the first word, sp to the second and the literal pool
! base to the third. */
! emit_move_insn (operand_subword (operands[0], 2, 0,
! TARGET_64BIT ? OImode : TImode),
! gen_rtx_REG (Pmode, BASE_REGISTER));
emit_move_insn (temp, gen_rtx_MEM (Pmode, operands[1]));
emit_move_insn (operand_subword (operands[0], 0, 0,
! TARGET_64BIT ? OImode : TImode),
temp);
emit_move_insn (operand_subword (operands[0], 1, 0,
! TARGET_64BIT ? OImode : TImode),
operands[1]);
DONE;
})
***************
*** 7161,7175 ****
""
{
rtx temp = gen_reg_rtx (Pmode);
! /* Restore the backchain from the first word, sp from the second. */
emit_move_insn (temp,
operand_subword (operands[1], 0, 0,
! TARGET_64BIT ? TImode : DImode));
emit_move_insn (operands[0],
operand_subword (operands[1], 1, 0,
! TARGET_64BIT ? TImode : DImode));
emit_move_insn (gen_rtx_MEM (Pmode, operands[0]), temp);
DONE;
})
--- 7129,7150 ----
""
{
rtx temp = gen_reg_rtx (Pmode);
+ rtx base = gen_rtx_REG (Pmode, BASE_REGISTER);
! /* Restore the backchain from the first word, sp from the second and the
! literal pool base from the third. */
emit_move_insn (temp,
operand_subword (operands[1], 0, 0,
! TARGET_64BIT ? OImode : TImode));
emit_move_insn (operands[0],
operand_subword (operands[1], 1, 0,
! TARGET_64BIT ? OImode : TImode));
emit_move_insn (gen_rtx_MEM (Pmode, operands[0]), temp);
+ emit_move_insn (base,
+ operand_subword (operands[1], 2, 0,
+ TARGET_64BIT ? OImode : TImode));
+ emit_insn (gen_rtx_USE (VOIDmode, base));
+
DONE;
})
Index: gcc/config/s390/s390.h
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/config/s390/s390.h,v
retrieving revision 1.84
diff -p -c -r1.84 s390.h
*** gcc/config/s390/s390.h 27 Aug 2003 18:50:37 -0000 1.84
--- gcc/config/s390/s390.h 26 Sep 2003 08:45:29 -0000
*************** if (INTEGRAL_MODE_P (MODE) &&
*** 240,246 ****
NONLOCAL needs twice Pmode to maintain both backchain and SP. */
#define STACK_SAVEAREA_MODE(LEVEL) \
(LEVEL == SAVE_FUNCTION ? VOIDmode \
! : LEVEL == SAVE_NONLOCAL ? (TARGET_64BIT ? TImode : DImode) : Pmode)
/* Define target floating point format. */
#define TARGET_FLOAT_FORMAT \
--- 240,246 ----
NONLOCAL needs twice Pmode to maintain both backchain and SP. */
#define STACK_SAVEAREA_MODE(LEVEL) \
(LEVEL == SAVE_FUNCTION ? VOIDmode \
! : LEVEL == SAVE_NONLOCAL ? (TARGET_64BIT ? OImode : TImode) : Pmode)
/* Define target floating point format. */
#define TARGET_FLOAT_FORMAT \