This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] s390: disable packed stack per default


Hello,

recently we encountered problems when using binaries produced from
gcc 2.95.3 or previous together with code compiled with the packed
stack layout. It turned out that the s390 back end in gcc 2.95.3
uses a little hack which relies on the backchain pointer to be
stored at a fix position. 

Because a lot of binaries are out there produced by a gcc 2.95.3
compiler it is not acceptable to break the call compatibility 
between binaries from that compiler and the current. So we 
(Ulrich and I) decided to disable the packed stack layout by default.

In order to do that I had to introduce a new target switch because
the former tristate option (-mbackchain/-mno-backchain/-mkernel-backchain)
did not provide a stack layout without a back chain and without the
packed register save area. So the new switch is 
(-mpacked-stack/-mno-packed-stack). And the combination which formerly
could not be expressed (-mno-backchain/-mno-packed-stack) is the default
by now.

Bootstrapped on s390 and s390x.

Testsuite builds with: 
  -mpacked-stack/-mno-backchain
  -mno-packed-stack/-mbackchain
  -mno-packed-stack/-mno-backchain
without regressions.

-mpacked-stack/-mbackchain produced accepted test suite failures due to
the ABI incompatibility.

OK?

-Andreas-

2004-11-22  Andreas Krebbel  <krebbel1@de.ibm.com>

	* config/s390/s390.c (s390_backchain_string): Removed.
	(s390_return_addr_rtx, s390_back_chain_rtx, s390_frame_info)
	(s390_emit_prologue, s390_va_start, s390_gimplify_va_arg):
	Changed users of TARGET_BACKCHAIN, TARGET_NO_BACKCHAIN and
	TARGET_KERNEL_BACKCHAIN to reflect the new options.
	* config/s390/s390.h (MASK_BACKCHAIN, MASK_PACKED_STACK): New macros.
	(TARGET_KERNEL_BACKCHAIN): Removed.
	(TARGET_BACKCHAIN): Former triple state option change to a target flag.
	(TARGET_PACKED_STACK): New macro.
	(TARGET_SWITCHES): New switches added.
	(TARGET_OPTIONS): "backchain", "no-backchain" and "kernel-backchain"
	removed.
	(DYNAMIC_CHAIN_ADDRESS): Use TARGET_PACKED_STACK.
	* config/s390/s390.md ("allocate_stack", "restore_stack_block")
	("save_stack_nonlocal", "restore_stack_nonlocal"): Modified to reflect 
	the change in target switch semantics.
	* config/s390/tpf.h (TARGET_DEFAULT_BACKCHAIN): Removed.
	(TARGET_DEFAULT): MASK_BACKCHAIN added.
	* doc/invoke.texi: Added documentation for the new/changed options.


Index: gcc/config/s390/s390.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/s390/s390.c,v
retrieving revision 1.202
diff -p -c -r1.202 s390.c
*** gcc/config/s390/s390.c	16 Nov 2004 17:37:31 -0000	1.202
--- gcc/config/s390/s390.c	22 Nov 2004 08:51:15 -0000
*************** enum processor_flags s390_arch_flags;
*** 205,214 ****
  const char *s390_tune_string;		/* for -mtune=<xxx> */
  const char *s390_arch_string;		/* for -march=<xxx> */
  
- /* String to specify backchain mode: 
-    "" no-backchain, "1" backchain, "2" kernel-backchain.  */
- const char *s390_backchain_string = TARGET_DEFAULT_BACKCHAIN;
- 
  const char *s390_warn_framesize_string;
  const char *s390_warn_dynamicstack_string;
  const char *s390_stack_size_string;
--- 205,210 ----
*************** s390_return_addr_rtx (int count, rtx fra
*** 6083,6089 ****
  
    /* Without backchain, we fail for all but the current frame.  */
  
!   if (!TARGET_BACKCHAIN && !TARGET_KERNEL_BACKCHAIN && count > 0)
      return NULL_RTX;
  
    /* For the current frame, we need to make sure the initial
--- 6079,6085 ----
  
    /* Without backchain, we fail for all but the current frame.  */
  
!   if (!TARGET_BACKCHAIN && count > 0)
      return NULL_RTX;
  
    /* For the current frame, we need to make sure the initial
*************** s390_return_addr_rtx (int count, rtx fra
*** 6095,6104 ****
        return gen_rtx_MEM (Pmode, return_address_pointer_rtx);
      }
  
!   if (TARGET_BACKCHAIN)
!     offset = RETURN_REGNUM * UNITS_PER_WORD;
!   else
      offset = -2 * UNITS_PER_WORD;
  
    addr = plus_constant (frame, offset);
    addr = memory_address (Pmode, addr);
--- 6091,6100 ----
        return gen_rtx_MEM (Pmode, return_address_pointer_rtx);
      }
  
!   if (TARGET_PACKED_STACK)
      offset = -2 * UNITS_PER_WORD;
+   else
+     offset = RETURN_REGNUM * UNITS_PER_WORD;
  
    addr = plus_constant (frame, offset);
    addr = memory_address (Pmode, addr);
*************** s390_back_chain_rtx (void)
*** 6113,6125 ****
  {
    rtx chain;
  
!   gcc_assert (TARGET_BACKCHAIN || TARGET_KERNEL_BACKCHAIN);
  
!   if (TARGET_BACKCHAIN)
!     chain = stack_pointer_rtx;
!   else
      chain = plus_constant (stack_pointer_rtx,
  			   STACK_POINTER_OFFSET - UNITS_PER_WORD);
  
    chain = gen_rtx_MEM (Pmode, chain);
    return chain;
--- 6109,6121 ----
  {
    rtx chain;
  
!   gcc_assert (TARGET_BACKCHAIN);
  
!   if (TARGET_PACKED_STACK)
      chain = plus_constant (stack_pointer_rtx,
  			   STACK_POINTER_OFFSET - UNITS_PER_WORD);
+   else
+     chain = stack_pointer_rtx;
  
    chain = gen_rtx_MEM (Pmode, chain);
    return chain;
*************** s390_frame_info (void)
*** 6287,6296 ****
    if (!TARGET_64BIT && cfun_frame_layout.frame_size > 0x7fff0000)
      fatal_error ("Total size of local variables exceeds architecture limit.");
    
!   cfun_frame_layout.save_backchain_p = (TARGET_BACKCHAIN 
! 					|| TARGET_KERNEL_BACKCHAIN);
  
!   if (TARGET_BACKCHAIN)
      {
        cfun_frame_layout.backchain_offset = 0;
        cfun_frame_layout.f0_offset = 16 * UNITS_PER_WORD;
--- 6283,6291 ----
    if (!TARGET_64BIT && cfun_frame_layout.frame_size > 0x7fff0000)
      fatal_error ("Total size of local variables exceeds architecture limit.");
    
!   cfun_frame_layout.save_backchain_p = TARGET_BACKCHAIN;
  
!   if (!TARGET_PACKED_STACK)
      {
        cfun_frame_layout.backchain_offset = 0;
        cfun_frame_layout.f0_offset = 16 * UNITS_PER_WORD;
*************** s390_frame_info (void)
*** 6299,6305 ****
        cfun_frame_layout.gprs_offset = (cfun_frame_layout.first_save_gpr
  				       * UNITS_PER_WORD);
      }
!   else if (TARGET_KERNEL_BACKCHAIN)
      {
        cfun_frame_layout.backchain_offset = (STACK_POINTER_OFFSET
  					    - UNITS_PER_WORD);
--- 6294,6300 ----
        cfun_frame_layout.gprs_offset = (cfun_frame_layout.first_save_gpr
  				       * UNITS_PER_WORD);
      }
!   else if (TARGET_BACKCHAIN) /* kernel stack layout */
      {
        cfun_frame_layout.backchain_offset = (STACK_POINTER_OFFSET
  					    - UNITS_PER_WORD);
*************** s390_frame_info (void)
*** 6354,6360 ****
        && !current_function_stdarg)
      return;
  
!   if (TARGET_BACKCHAIN)
      cfun_frame_layout.frame_size += (STARTING_FRAME_OFFSET
  				     + cfun_frame_layout.high_fprs * 8);
    else
--- 6349,6355 ----
        && !current_function_stdarg)
      return;
  
!   if (!TARGET_PACKED_STACK)
      cfun_frame_layout.frame_size += (STARTING_FRAME_OFFSET
  				     + cfun_frame_layout.high_fprs * 8);
    else
*************** s390_emit_prologue (void)
*** 6753,6759 ****
  	  save_fpr (stack_pointer_rtx, offset, i + 16);
  	  offset += 8;
  	}
!       else if (TARGET_BACKCHAIN)
  	  offset += 8;
      }
  
--- 6748,6754 ----
  	  save_fpr (stack_pointer_rtx, offset, i + 16);
  	  offset += 8;
  	}
!       else if (!TARGET_PACKED_STACK)
  	  offset += 8;
      }
  
*************** s390_emit_prologue (void)
*** 6771,6781 ****
  	  if (!call_really_used_regs[i + 16])
  	    RTX_FRAME_RELATED_P (insn) = 1;
  	}
!       else if (TARGET_BACKCHAIN)
  	offset += 8;
      }
  
!   if (!TARGET_BACKCHAIN 
        && cfun_save_high_fprs_p
        && cfun_frame_layout.f8_offset + cfun_frame_layout.high_fprs * 8 > 0)
      {
--- 6766,6776 ----
  	  if (!call_really_used_regs[i + 16])
  	    RTX_FRAME_RELATED_P (insn) = 1;
  	}
!       else if (!TARGET_PACKED_STACK)
  	offset += 8;
      }
  
!   if (TARGET_PACKED_STACK
        && cfun_save_high_fprs_p
        && cfun_frame_layout.f8_offset + cfun_frame_layout.high_fprs * 8 > 0)
      {
*************** s390_emit_prologue (void)
*** 6794,6800 ****
  	next_fpr = i + 16;
      }
    
!   if (TARGET_BACKCHAIN)
      next_fpr = cfun_save_high_fprs_p ? 31 : 0;
  
    /* Decrement stack pointer.  */
--- 6789,6795 ----
  	next_fpr = i + 16;
      }
    
!   if (!TARGET_PACKED_STACK)
      next_fpr = cfun_save_high_fprs_p ? 31 : 0;
  
    /* Decrement stack pointer.  */
*************** s390_emit_epilogue (bool sibcall)
*** 7050,7056 ****
  			   offset + next_offset, i);
  	      next_offset += 8;
  	    }
! 	  else if (TARGET_BACKCHAIN)
  	    next_offset += 8;
  	}
        
--- 7045,7051 ----
  			   offset + next_offset, i);
  	      next_offset += 8;
  	    }
! 	  else if (!TARGET_PACKED_STACK)
  	    next_offset += 8;
  	}
        
*************** s390_va_start (tree valist, rtx nextarg 
*** 7516,7522 ****
  
    /* Find the register save area.  */
    t = make_tree (TREE_TYPE (sav), return_address_pointer_rtx);
!   if (TARGET_KERNEL_BACKCHAIN)
      t = build (PLUS_EXPR, TREE_TYPE (sav), t,
  	       build_int_cst (NULL_TREE,
  			      -(RETURN_REGNUM - 2) * UNITS_PER_WORD
--- 7511,7517 ----
  
    /* Find the register save area.  */
    t = make_tree (TREE_TYPE (sav), return_address_pointer_rtx);
!   if (TARGET_BACKCHAIN && TARGET_PACKED_STACK) /* kernel stack layout */
      t = build (PLUS_EXPR, TREE_TYPE (sav), t,
  	       build_int_cst (NULL_TREE,
  			      -(RETURN_REGNUM - 2) * UNITS_PER_WORD
*************** s390_gimplify_va_arg (tree valist, tree 
*** 7589,7599 ****
        reg = gpr;
        n_reg = 1;
  
!       /* TARGET_KERNEL_BACKCHAIN on 31 bit: It is assumed here that no padding
  	 will be added by s390_frame_info because for va_args always an even
  	 number of gprs has to be saved r15-r2 = 14 regs.  */
!       sav_ofs = (TARGET_KERNEL_BACKCHAIN
! 		 ? (TARGET_64BIT ? 4 : 2) * 8 : 2 * UNITS_PER_WORD);
        sav_scale = UNITS_PER_WORD;
        size = UNITS_PER_WORD;
        max_reg = 4;
--- 7584,7594 ----
        reg = gpr;
        n_reg = 1;
  
!       /* kernel stack layout on 31 bit: It is assumed here that no padding
  	 will be added by s390_frame_info because for va_args always an even
  	 number of gprs has to be saved r15-r2 = 14 regs.  */
!       sav_ofs = ((TARGET_BACKCHAIN && TARGET_PACKED_STACK) ?
! 		 (TARGET_64BIT ? 4 : 2) * 8 : 2 * UNITS_PER_WORD);
        sav_scale = UNITS_PER_WORD;
        size = UNITS_PER_WORD;
        max_reg = 4;
*************** s390_gimplify_va_arg (tree valist, tree 
*** 7610,7616 ****
        indirect_p = 0;
        reg = fpr;
        n_reg = 1;
!       sav_ofs = TARGET_KERNEL_BACKCHAIN ? 0 : 16 * UNITS_PER_WORD;
        sav_scale = 8;
        /* TARGET_64BIT has up to 4 parameter in fprs */
        max_reg = TARGET_64BIT ? 3 : 1;
--- 7605,7612 ----
        indirect_p = 0;
        reg = fpr;
        n_reg = 1;
!       sav_ofs = ((TARGET_BACKCHAIN && TARGET_PACKED_STACK) ?
! 		 0 : 16 * UNITS_PER_WORD);
        sav_scale = 8;
        /* TARGET_64BIT has up to 4 parameter in fprs */
        max_reg = TARGET_64BIT ? 3 : 1;
*************** s390_gimplify_va_arg (tree valist, tree 
*** 7628,7638 ****
        reg = gpr;
        n_reg = (size + UNITS_PER_WORD - 1) / UNITS_PER_WORD;
  
!       /* TARGET_KERNEL_BACKCHAIN on 31 bit: It is assumed here that no padding
! 	will be added by s390_frame_info because for va_args always an even
! 	number of gprs has to be saved r15-r2 = 14 regs.  */
!       sav_ofs = TARGET_KERNEL_BACKCHAIN ? 
! 	(TARGET_64BIT ? 4 : 2) * 8 : 2*UNITS_PER_WORD;
  
        if (size < UNITS_PER_WORD)
  	sav_ofs += UNITS_PER_WORD - size;
--- 7624,7634 ----
        reg = gpr;
        n_reg = (size + UNITS_PER_WORD - 1) / UNITS_PER_WORD;
  
!       /* kernel stack layout on 31 bit: It is assumed here that no padding
! 	 will be added by s390_frame_info because for va_args always an even
! 	 number of gprs has to be saved r15-r2 = 14 regs.  */
!       sav_ofs = ((TARGET_BACKCHAIN && TARGET_PACKED_STACK) ? 
! 		 (TARGET_64BIT ? 4 : 2) * 8 : 2 * UNITS_PER_WORD);
  
        if (size < UNITS_PER_WORD)
  	sav_ofs += UNITS_PER_WORD - size;
Index: gcc/config/s390/s390.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/s390/s390.h,v
retrieving revision 1.129
diff -p -c -r1.129 s390.h
*** gcc/config/s390/s390.h	9 Nov 2004 20:46:15 -0000	1.129
--- gcc/config/s390/s390.h	22 Nov 2004 08:51:15 -0000
*************** extern enum processor_type s390_arch;
*** 60,67 ****
  extern enum processor_flags s390_arch_flags;
  extern const char *s390_arch_string;
  
- extern const char *s390_backchain_string;
- 
  extern const char *s390_warn_framesize_string;
  extern const char *s390_warn_dynamicstack_string;
  extern const char *s390_stack_size_string;
--- 60,65 ----
*************** extern int target_flags;
*** 106,111 ****
--- 104,111 ----
  #define MASK_MVCLE                 0x40
  #define MASK_TPF_PROFILING         0x80
  #define MASK_NO_FUSED_MADD         0x100
+ #define MASK_BACKCHAIN             0x200
+ #define MASK_PACKED_STACK          0x400
  
  #define TARGET_HARD_FLOAT          (target_flags & MASK_HARD_FLOAT)
  #define TARGET_SOFT_FLOAT          (!(target_flags & MASK_HARD_FLOAT))
*************** extern int target_flags;
*** 117,125 ****
  #define TARGET_TPF_PROFILING       (target_flags & MASK_TPF_PROFILING)
  #define TARGET_NO_FUSED_MADD       (target_flags & MASK_NO_FUSED_MADD)
  #define TARGET_FUSED_MADD	   (! TARGET_NO_FUSED_MADD)
! 
! #define TARGET_BACKCHAIN           (s390_backchain_string[0] == '1')
! #define TARGET_KERNEL_BACKCHAIN    (s390_backchain_string[0] == '2')
  
  /* ??? Once this actually works, it could be made a runtime option.  */
  #define TARGET_IBM_FLOAT           0
--- 117,124 ----
  #define TARGET_TPF_PROFILING       (target_flags & MASK_TPF_PROFILING)
  #define TARGET_NO_FUSED_MADD       (target_flags & MASK_NO_FUSED_MADD)
  #define TARGET_FUSED_MADD	   (! TARGET_NO_FUSED_MADD)
! #define TARGET_BACKCHAIN           (target_flags & MASK_BACKCHAIN)
! #define TARGET_PACKED_STACK        (target_flags & MASK_PACKED_STACK)
  
  /* ??? Once this actually works, it could be made a runtime option.  */
  #define TARGET_IBM_FLOAT           0
*************** extern int target_flags;
*** 131,155 ****
  #define TARGET_DEFAULT             MASK_HARD_FLOAT
  #endif
  
! #define TARGET_DEFAULT_BACKCHAIN ""
! 
! #define TARGET_SWITCHES                                                  \
! { { "hard-float",      1, N_("Use hardware fp")},                        \
!   { "soft-float",     -1, N_("Don't use hardware fp")},                  \
!   { "small-exec",      4, N_("Use bras for executable < 64k")},          \
!   { "no-small-exec",  -4, N_("Don't use bras")},                         \
!   { "debug",           8, N_("Additional debug prints")},                \
!   { "no-debug",       -8, N_("Don't print additional debug prints")},    \
!   { "64",             16, N_("64 bit ABI")},                             \
!   { "31",            -16, N_("31 bit ABI")},                             \
!   { "zarch",          32, N_("z/Architecture")},                         \
!   { "esa",           -32, N_("ESA/390 architecture")},                   \
!   { "mvcle",          64, N_("mvcle use")},                              \
!   { "no-mvcle",      -64, N_("mvc&ex")},                                 \
!   { "tpf-trace",     128, N_("enable tpf OS tracing code")},             \
!   { "no-tpf-trace", -128, N_("disable tpf OS tracing code")},            \
!   { "no-fused-madd", 256, N_("disable fused multiply/add instructions")},\
!   { "fused-madd",   -256, N_("enable fused multiply/add instructions")}, \
    { "", TARGET_DEFAULT, 0 } }
  
  #define TARGET_OPTIONS                                                         \
--- 130,156 ----
  #define TARGET_DEFAULT             MASK_HARD_FLOAT
  #endif
  
! #define TARGET_SWITCHES                                                      \
! { { "hard-float",          1, N_("Use hardware fp")},                        \
!   { "soft-float",         -1, N_("Don't use hardware fp")},                  \
!   { "small-exec",          4, N_("Use bras for executable < 64k")},          \
!   { "no-small-exec",      -4, N_("Don't use bras")},                         \
!   { "debug",               8, N_("Additional debug prints")},                \
!   { "no-debug",           -8, N_("Don't print additional debug prints")},    \
!   { "64",                 16, N_("64 bit ABI")},                             \
!   { "31",                -16, N_("31 bit ABI")},                             \
!   { "zarch",              32, N_("z/Architecture")},                         \
!   { "esa",               -32, N_("ESA/390 architecture")},                   \
!   { "mvcle",              64, N_("mvcle use")},                              \
!   { "no-mvcle",          -64, N_("mvc&ex")},                                 \
!   { "tpf-trace",         128, N_("Enable tpf OS tracing code")},             \
!   { "no-tpf-trace",     -128, N_("Disable tpf OS tracing code")},            \
!   { "no-fused-madd",     256, N_("Disable fused multiply/add instructions")},\
!   { "fused-madd",       -256, N_("Enable fused multiply/add instructions")}, \
!   { "backchain",         512, N_("Maintain backchain pointer")},             \
!   { "no-backchain",     -512, N_("Don't maintain backchain pointer")},       \
!   { "packed-stack",     1024, N_("Use packed stack layout")},                \
!   { "no-packed-stack", -1024, N_("Don't use packed stack layout")},          \
    { "", TARGET_DEFAULT, 0 } }
  
  #define TARGET_OPTIONS                                                         \
*************** extern int target_flags;
*** 157,168 ****
      N_("Schedule code for given CPU"), 0},                                     \
    { "arch=",            &s390_arch_string,                                     \
      N_("Generate code for given CPU"), 0},                                     \
-   { "backchain",        &s390_backchain_string,                                \
-     N_("Set backchain"), "1"},                                                 \
-   { "no-backchain",     &s390_backchain_string,                                \
-     N_("Do not set backchain"), ""},                                           \
-   { "kernel-backchain", &s390_backchain_string,                                \
-     N_("Set backchain appropriate for the linux kernel"), "2"},                \
    { "warn-framesize=",   &s390_warn_framesize_string,                          \
      N_("Warn if a single function's framesize exceeds the given framesize"),   \
         0},                                                                     \
--- 158,163 ----
*************** extern int current_function_outgoing_arg
*** 623,634 ****
     the corresponding RETURN_REGNUM register was saved.  */
  
  #define DYNAMIC_CHAIN_ADDRESS(FRAME)                                            \
!   (TARGET_BACKCHAIN ?                                                           \
!    ((FRAME) != hard_frame_pointer_rtx ? (FRAME) :				\
!     plus_constant (arg_pointer_rtx, -STACK_POINTER_OFFSET)) :                   \
      ((FRAME) != hard_frame_pointer_rtx ?                                        \
       plus_constant ((FRAME), STACK_POINTER_OFFSET - UNITS_PER_WORD) :           \
!      plus_constant (arg_pointer_rtx, -UNITS_PER_WORD)))
  
  #define RETURN_ADDR_RTX(COUNT, FRAME)						\
    s390_return_addr_rtx ((COUNT), DYNAMIC_CHAIN_ADDRESS ((FRAME)))
--- 618,629 ----
     the corresponding RETURN_REGNUM register was saved.  */
  
  #define DYNAMIC_CHAIN_ADDRESS(FRAME)                                            \
!   (TARGET_PACKED_STACK ?                                                        \
      ((FRAME) != hard_frame_pointer_rtx ?                                        \
       plus_constant ((FRAME), STACK_POINTER_OFFSET - UNITS_PER_WORD) :           \
!      plus_constant (arg_pointer_rtx, -UNITS_PER_WORD)) :                        \
!      ((FRAME) != hard_frame_pointer_rtx ? (FRAME) :				\
!       plus_constant (arg_pointer_rtx, -STACK_POINTER_OFFSET)))
  
  #define RETURN_ADDR_RTX(COUNT, FRAME)						\
    s390_return_addr_rtx ((COUNT), DYNAMIC_CHAIN_ADDRESS ((FRAME)))
Index: gcc/config/s390/s390.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/s390/s390.md,v
retrieving revision 1.146
diff -p -c -r1.146 s390.md
*** gcc/config/s390/s390.md	9 Nov 2004 20:46:15 -0000	1.146
--- gcc/config/s390/s390.md	22 Nov 2004 08:51:16 -0000
***************
*** 7892,7898 ****
  (define_expand "allocate_stack"
    [(match_operand 0 "general_operand" "")
     (match_operand 1 "general_operand" "")]
!  "TARGET_BACKCHAIN || TARGET_KERNEL_BACKCHAIN"
  {
    rtx temp = gen_reg_rtx (Pmode);
  
--- 7892,7898 ----
  (define_expand "allocate_stack"
    [(match_operand 0 "general_operand" "")
     (match_operand 1 "general_operand" "")]
!  "TARGET_BACKCHAIN"
  {
    rtx temp = gen_reg_rtx (Pmode);
  
***************
*** 7942,7948 ****
  (define_expand "restore_stack_block"
    [(match_operand 0 "register_operand" "")
     (match_operand 1 "register_operand" "")]
!   "TARGET_BACKCHAIN || TARGET_KERNEL_BACKCHAIN"
  {
    rtx temp = gen_reg_rtx (Pmode);
  
--- 7942,7948 ----
  (define_expand "restore_stack_block"
    [(match_operand 0 "register_operand" "")
     (match_operand 1 "register_operand" "")]
!   "TARGET_BACKCHAIN"
  {
    rtx temp = gen_reg_rtx (Pmode);
  
***************
*** 7964,7970 ****
    /* Copy the backchain to the first word, sp to the second and the
       literal pool base to the third.  */
  
!   if (TARGET_BACKCHAIN || TARGET_KERNEL_BACKCHAIN)
      {
        rtx temp = force_reg (Pmode, s390_back_chain_rtx ());
        emit_move_insn (operand_subword (operands[0], 0, 0, mode), temp);
--- 7964,7970 ----
    /* Copy the backchain to the first word, sp to the second and the
       literal pool base to the third.  */
  
!   if (TARGET_BACKCHAIN)
      {
        rtx temp = force_reg (Pmode, s390_back_chain_rtx ());
        emit_move_insn (operand_subword (operands[0], 0, 0, mode), temp);
***************
*** 7988,7994 ****
    /* Restore the backchain from the first word, sp from the second and the
       literal pool base from the third.  */
  
!   if (TARGET_BACKCHAIN || TARGET_KERNEL_BACKCHAIN)
      temp = force_reg (Pmode, operand_subword (operands[1], 0, 0, mode));
      
    emit_move_insn (base, operand_subword (operands[1], 2, 0, mode));
--- 7988,7994 ----
    /* Restore the backchain from the first word, sp from the second and the
       literal pool base from the third.  */
  
!   if (TARGET_BACKCHAIN)
      temp = force_reg (Pmode, operand_subword (operands[1], 0, 0, mode));
      
    emit_move_insn (base, operand_subword (operands[1], 2, 0, mode));
Index: gcc/config/s390/tpf.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/s390/tpf.h,v
retrieving revision 1.4
diff -p -c -r1.4 tpf.h
*** gcc/config/s390/tpf.h	8 Oct 2004 16:28:49 -0000	1.4
--- gcc/config/s390/tpf.h	22 Nov 2004 08:51:17 -0000
*************** Software Foundation, 59 Temple Place - S
*** 58,67 ****
     Also, enable TPF profiling support and the standard backchain by default.  */
  #undef TARGET_DEFAULT
  #define TARGET_DEFAULT		(MASK_64BIT | MASK_ZARCH | MASK_HARD_FLOAT \
! 				 | MASK_TPF_PROFILING)
! #undef TARGET_DEFAULT_BACKCHAIN
! #define TARGET_DEFAULT_BACKCHAIN "1"
! 
  /* Exception handling.  */
  
  /* Select a format to encode pointers in exception handling data.  */
--- 58,64 ----
     Also, enable TPF profiling support and the standard backchain by default.  */
  #undef TARGET_DEFAULT
  #define TARGET_DEFAULT		(MASK_64BIT | MASK_ZARCH | MASK_HARD_FLOAT \
! 				 | MASK_TPF_PROFILING | MASK_BACKCHAIN)
  /* Exception handling.  */
  
  /* Select a format to encode pointers in exception handling data.  */
Index: gcc/doc/invoke.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doc/invoke.texi,v
retrieving revision 1.557
diff -p -c -r1.557 invoke.texi
*** gcc/doc/invoke.texi	5 Nov 2004 21:38:33 -0000	1.557
--- gcc/doc/invoke.texi	22 Nov 2004 08:51:18 -0000
*************** See RS/6000 and PowerPC Options.
*** 623,629 ****
  
  @emph{S/390 and zSeries Options}
  @gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type} @gol
! -mhard-float  -msoft-float  -mbackchain  -mno-backchain -mkernel-backchain @gol
  -msmall-exec  -mno-small-exec  -mmvcle -mno-mvcle @gol
  -m64  -m31  -mdebug  -mno-debug  -mesa  -mzarch @gol
  -mtpf-trace -mno-tpf-trace  -mfused-madd  -mno-fused-madd @gol
--- 623,630 ----
  
  @emph{S/390 and zSeries Options}
  @gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type} @gol
! -mhard-float  -msoft-float  -mbackchain  -mno-backchain @gol
! -mpacked-stack  -mno-packed-stack @gol
  -msmall-exec  -mno-small-exec  -mmvcle -mno-mvcle @gol
  -m64  -m31  -mdebug  -mno-debug  -mesa  -mzarch @gol
  -mtpf-trace -mno-tpf-trace  -mfused-madd  -mno-fused-madd @gol
*************** generates IEEE floating-point instructio
*** 10827,10853 ****
  
  @item -mbackchain
  @itemx -mno-backchain
- @itemx -mkernel-backchain
  @opindex mbackchain
  @opindex mno-backchain
! @opindex mkernel-backchain
! In order to provide a backchain the address of the caller's frame
! is stored within the callee's stack frame.
  A backchain may be needed to allow debugging using tools that do not understand
  DWARF-2 call frame information.
! For @option{-mno-backchain} no backchain is maintained at all which is the
! default.
! If one of the other options is present the backchain pointer is placed either
! on top of the stack frame  (@option{-mkernel-backchain}) or on
! the bottom (@option{-mbackchain}).
! Beside the different backchain location @option{-mkernel-backchain}
! also changes stack frame layout breaking the ABI@.  This option
! is intended to be used for code which internally needs a backchain but has
! to get by with a limited stack size e.g.@: the linux kernel.
! Internal unwinding code not using DWARF-2 info has to be able to locate the
! return address of a function.  That will be eased be the fact that
! the return address of a function is placed two words below the backchain
! pointer.
  
  @item -msmall-exec
  @itemx -mno-small-exec
--- 10828,10876 ----
  
  @item -mbackchain
  @itemx -mno-backchain
  @opindex mbackchain
  @opindex mno-backchain
! Store (do not store) the address of the caller's frame as backchain pointer
! into the callee's stack frame.
  A backchain may be needed to allow debugging using tools that do not understand
  DWARF-2 call frame information.
! When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
! at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
! the backchain is placed into the topmost word of the 96/160 byte register
! save area.
! 
! In general, code compiled with @option{-mbackchain} is call-compatible with
! code compiled with @option{-mmo-backchain}; however, use of the backchain
! for debugging purposes usually requires that the whole binary is built with
! @option{-mbackchain}.  Note that the combination of @option{-mbackchain} and
! @option{-mpacked-stack} generates code that is not ABI-compatible.
! 
! The default is to not maintain the backchain.
! 
! @item -mpacked-stack
! @item -mno-packed-stack
! @opindex mpacked-stack
! @opindex mno-packed-stack
! Use (do not use) the packed stack layout.  When @option{-mno-packed-stack} is
! specified, the compiler uses the all fields of the 96/160 byte register save
! area only for their default purpose; unused fields still take up stack space.
! When @option{-mpacked-stack} is specified, register save slots are densely
! packed at the top of the register save area; unused space is reused for other
! purposes, allowing for more efficient use of the available stack space.
! However, when @option{-mbackchain} is also in effect, the topmost word of
! the save area is always used to store the backchain, and the return address
! register is always saved two words below the backchain.
! 
! As long as the stack frame backchain is not used, code generated with 
! @option{-mpacked-stack} is call-compatible with code generated with
! @option{-mno-packed-stack}.  Note that some non-FSF releases of GCC 2.95 for
! S/390 or zSeries generated code that uses the stack frame backchain at run
! time, not just for debugging purposes.  Such code is not call-compatible
! with code compiled with @option{-mpacked-stack}.  Also, note that the
! combination of @option{-mbackchain} and @option{-mpacked-stack} generates code
! that is not ABI-compatible.
! 
! The default is to not use the packed stack layout.
  
  @item -msmall-exec
  @itemx -mno-small-exec


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]