From b3d31392c8d1782821f60d1e9acd34464dd8e163 Mon Sep 17 00:00:00 2001 From: Andreas Krebbel Date: Tue, 23 Nov 2004 17:39:59 +0000 Subject: s390.c (s390_backchain_string): Removed. 2004-11-23 Andreas Krebbel * 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. From-SVN: r91096 --- gcc/ChangeLog | 22 +++++++++++++++++ gcc/config/s390/s390.c | 60 ++++++++++++++++++++++------------------------ gcc/config/s390/s390.h | 63 +++++++++++++++++++++++-------------------------- gcc/config/s390/s390.md | 8 +++---- gcc/config/s390/tpf.h | 5 +--- gcc/doc/invoke.texi | 59 +++++++++++++++++++++++++++++++-------------- 6 files changed, 125 insertions(+), 92 deletions(-) (limited to 'gcc') diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3342ad1..01ecb44 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,25 @@ +2004-11-23 Andreas Krebbel + + * 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. + 2004-11-23 Uros Bizjak PR rtl-optimization/18614 diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index 91ee90d..54d2b1e 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -205,10 +205,6 @@ enum processor_flags s390_arch_flags; const char *s390_tune_string; /* for -mtune= */ const char *s390_arch_string; /* for -march= */ -/* 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; @@ -6083,7 +6079,7 @@ s390_return_addr_rtx (int count, rtx frame ATTRIBUTE_UNUSED) /* Without backchain, we fail for all but the current frame. */ - if (!TARGET_BACKCHAIN && !TARGET_KERNEL_BACKCHAIN && count > 0) + if (!TARGET_BACKCHAIN && count > 0) return NULL_RTX; /* For the current frame, we need to make sure the initial @@ -6095,10 +6091,10 @@ s390_return_addr_rtx (int count, rtx frame ATTRIBUTE_UNUSED) return gen_rtx_MEM (Pmode, return_address_pointer_rtx); } - if (TARGET_BACKCHAIN) - offset = RETURN_REGNUM * UNITS_PER_WORD; - else + 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); @@ -6113,13 +6109,13 @@ s390_back_chain_rtx (void) { rtx chain; - gcc_assert (TARGET_BACKCHAIN || TARGET_KERNEL_BACKCHAIN); + gcc_assert (TARGET_BACKCHAIN); - if (TARGET_BACKCHAIN) - chain = stack_pointer_rtx; - else + 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; @@ -6287,10 +6283,9 @@ s390_frame_info (void) 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); + cfun_frame_layout.save_backchain_p = TARGET_BACKCHAIN; - if (TARGET_BACKCHAIN) + if (!TARGET_PACKED_STACK) { cfun_frame_layout.backchain_offset = 0; cfun_frame_layout.f0_offset = 16 * UNITS_PER_WORD; @@ -6299,7 +6294,7 @@ s390_frame_info (void) cfun_frame_layout.gprs_offset = (cfun_frame_layout.first_save_gpr * UNITS_PER_WORD); } - else if (TARGET_KERNEL_BACKCHAIN) + else if (TARGET_BACKCHAIN) /* kernel stack layout */ { cfun_frame_layout.backchain_offset = (STACK_POINTER_OFFSET - UNITS_PER_WORD); @@ -6354,7 +6349,7 @@ s390_frame_info (void) && !current_function_stdarg) return; - if (TARGET_BACKCHAIN) + if (!TARGET_PACKED_STACK) cfun_frame_layout.frame_size += (STARTING_FRAME_OFFSET + cfun_frame_layout.high_fprs * 8); else @@ -6753,7 +6748,7 @@ s390_emit_prologue (void) save_fpr (stack_pointer_rtx, offset, i + 16); offset += 8; } - else if (TARGET_BACKCHAIN) + else if (!TARGET_PACKED_STACK) offset += 8; } @@ -6771,11 +6766,11 @@ s390_emit_prologue (void) if (!call_really_used_regs[i + 16]) RTX_FRAME_RELATED_P (insn) = 1; } - else if (TARGET_BACKCHAIN) + else if (!TARGET_PACKED_STACK) offset += 8; } - if (!TARGET_BACKCHAIN + if (TARGET_PACKED_STACK && cfun_save_high_fprs_p && cfun_frame_layout.f8_offset + cfun_frame_layout.high_fprs * 8 > 0) { @@ -6794,7 +6789,7 @@ s390_emit_prologue (void) next_fpr = i + 16; } - if (TARGET_BACKCHAIN) + if (!TARGET_PACKED_STACK) next_fpr = cfun_save_high_fprs_p ? 31 : 0; /* Decrement stack pointer. */ @@ -7050,7 +7045,7 @@ s390_emit_epilogue (bool sibcall) offset + next_offset, i); next_offset += 8; } - else if (TARGET_BACKCHAIN) + else if (!TARGET_PACKED_STACK) next_offset += 8; } @@ -7516,7 +7511,7 @@ s390_va_start (tree valist, rtx nextarg ATTRIBUTE_UNUSED) /* Find the register save area. */ t = make_tree (TREE_TYPE (sav), return_address_pointer_rtx); - if (TARGET_KERNEL_BACKCHAIN) + 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 @@ -7589,11 +7584,11 @@ s390_gimplify_va_arg (tree valist, tree type, tree *pre_p, reg = gpr; n_reg = 1; - /* TARGET_KERNEL_BACKCHAIN on 31 bit: It is assumed here that no padding + /* 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_KERNEL_BACKCHAIN - ? (TARGET_64BIT ? 4 : 2) * 8 : 2 * UNITS_PER_WORD); + 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; @@ -7610,7 +7605,8 @@ s390_gimplify_va_arg (tree valist, tree type, tree *pre_p, indirect_p = 0; reg = fpr; n_reg = 1; - sav_ofs = TARGET_KERNEL_BACKCHAIN ? 0 : 16 * UNITS_PER_WORD; + 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; @@ -7628,11 +7624,11 @@ s390_gimplify_va_arg (tree valist, tree type, tree *pre_p, 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; + /* 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; diff --git a/gcc/config/s390/s390.h b/gcc/config/s390/s390.h index 694dcb8..a3e021c 100644 --- a/gcc/config/s390/s390.h +++ b/gcc/config/s390/s390.h @@ -60,8 +60,6 @@ extern enum processor_type s390_arch; 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; @@ -106,6 +104,8 @@ extern int target_flags; #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)) @@ -117,9 +117,8 @@ extern int target_flags; #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') +#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 @@ -131,25 +130,27 @@ extern int target_flags; #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")}, \ +#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 \ @@ -157,12 +158,6 @@ extern int target_flags; 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}, \ @@ -623,12 +618,12 @@ extern int current_function_outgoing_args_size; 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)) : \ + (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))) + 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))) diff --git a/gcc/config/s390/s390.md b/gcc/config/s390/s390.md index dbeaea4..ccf70c7 100644 --- a/gcc/config/s390/s390.md +++ b/gcc/config/s390/s390.md @@ -7892,7 +7892,7 @@ (define_expand "allocate_stack" [(match_operand 0 "general_operand" "") (match_operand 1 "general_operand" "")] - "TARGET_BACKCHAIN || TARGET_KERNEL_BACKCHAIN" + "TARGET_BACKCHAIN" { rtx temp = gen_reg_rtx (Pmode); @@ -7942,7 +7942,7 @@ (define_expand "restore_stack_block" [(match_operand 0 "register_operand" "") (match_operand 1 "register_operand" "")] - "TARGET_BACKCHAIN || TARGET_KERNEL_BACKCHAIN" + "TARGET_BACKCHAIN" { rtx temp = gen_reg_rtx (Pmode); @@ -7964,7 +7964,7 @@ /* 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) + if (TARGET_BACKCHAIN) { rtx temp = force_reg (Pmode, s390_back_chain_rtx ()); emit_move_insn (operand_subword (operands[0], 0, 0, mode), temp); @@ -7988,7 +7988,7 @@ /* 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) + 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)); diff --git a/gcc/config/s390/tpf.h b/gcc/config/s390/tpf.h index e6a016a..33a50b4 100644 --- a/gcc/config/s390/tpf.h +++ b/gcc/config/s390/tpf.h @@ -58,10 +58,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 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" - + | MASK_TPF_PROFILING | MASK_BACKCHAIN) /* Exception handling. */ /* Select a format to encode pointers in exception handling data. */ diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index d6391dd..5796474 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -623,7 +623,8 @@ See RS/6000 and PowerPC Options. @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 +-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 @@ -10827,27 +10828,49 @@ generates IEEE floating-point instructions. This is the default. @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. +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. -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. +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 -- cgit v1.1