Commit adf39f8f by Andreas Krebbel Committed by Ulrich Weigand

s390.c (struct s390_frame_layout): New struct as element of struct machine_function.

2004-08-12  Andreas Krebbel  <krebbel1@de.ibm.com>

	* config/s390/s390.c (struct s390_frame_layout): New struct as element
	of struct machine_function.
	(cfun->machine->frame_size): Moved into cfun->machine->frame_layout and
	changed all uses.
	(cfun->machine->save_fprs_p): Replaced by cfun_save_high_fprs and
	changed all uses.
	(cfun_frame_layout, cfun_save_high_fprs_p, cfun_gprs_save_area_size)
	(cfun_set_fpr_bit, cfun_fpr_bit_p): New macros.
	(s390_frame_area, s390_register_info): New functions.
	(s390_optimize_prolog): Renamed to s390_optimize_prologue.  Added check
	for base register.
	(s390_return_addr_rtx, s390_return_address_offset)
	(s390_va_start, s390_gimplify_va_arg)
	(s390_emit_prologue, s390_emit_epilogue): Adjusted for new stack
	layouts.
	(s390_frame_info): Functionality partly moved to s390_register_info.
	Made adaptions for new stack layout.
	(save_gprs, restore_gprs): Changed meaning of second parameter and
	adapted all callers.

	* config/s390/s390.h (s390_backchain_string): New global variable.
	(MASK_BACKCHAIN): Removed definition.
	(TARGET_BACKCHAIN): Changed check.
	(TARGET_KERNEL_BACKCHAIN): New macro.
	(TARGET_SWITCHES): Removed entries of "backchain" and "no-backchain".
	(TARGET_OPTIONS): Added "backchain", "no-backchain" and
	"kernel-backchain".
	(DYNAMIC_CHAIN_ADDRESS): Adjusted for new stack layouts.

	* config/s390/s390.md ("allocate_stack"): Added TARGET_KERNEL_BACKCHAIN
	as condition.  Adjusted for new stack layout.

	* doc/invoke.texi: Added documentation for new option
	"-mkernel-backchain" and adjusted documentation of "-mbackchain" and
	"-mno-backchain".

From-SVN: r85882
parent faa03cf1
2004-08-12 Andreas Krebbel <krebbel1@de.ibm.com>
* config/s390/s390.c (struct s390_frame_layout): New struct as element
of struct machine_function.
(cfun->machine->frame_size): Moved into cfun->machine->frame_layout and
changed all uses.
(cfun->machine->save_fprs_p): Replaced by cfun_save_high_fprs and
changed all uses.
(cfun_frame_layout, cfun_save_high_fprs_p, cfun_gprs_save_area_size)
(cfun_set_fpr_bit, cfun_fpr_bit_p): New macros.
(s390_frame_area, s390_register_info): New functions.
(s390_optimize_prolog): Renamed to s390_optimize_prologue. Added check
for base register.
(s390_return_addr_rtx, s390_return_address_offset)
(s390_va_start, s390_gimplify_va_arg)
(s390_emit_prologue, s390_emit_epilogue): Adjusted for new stack
layouts.
(s390_frame_info): Functionality partly moved to s390_register_info.
Made adaptions for new stack layout.
(save_gprs, restore_gprs): Changed meaning of second parameter and
adapted all callers.
* config/s390/s390.h (s390_backchain_string): New global variable.
(MASK_BACKCHAIN): Removed definition.
(TARGET_BACKCHAIN): Changed check.
(TARGET_KERNEL_BACKCHAIN): New macro.
(TARGET_SWITCHES): Removed entries of "backchain" and "no-backchain".
(TARGET_OPTIONS): Added "backchain", "no-backchain" and
"kernel-backchain".
(DYNAMIC_CHAIN_ADDRESS): Adjusted for new stack layouts.
* config/s390/s390.md ("allocate_stack"): Added TARGET_KERNEL_BACKCHAIN
as condition. Adjusted for new stack layout.
* doc/invoke.texi: Added documentation for new option
"-mkernel-backchain" and adjusted documentation of "-mbackchain" and
"-mno-backchain".
2004-08-12 Paul Brook <paul@codesourcery.com> 2004-08-12 Paul Brook <paul@codesourcery.com>
* config/arm/lib1funcs.asm (ARM_FUNC_ALIAS): Also alias _L__name. * config/arm/lib1funcs.asm (ARM_FUNC_ALIAS): Also alias _L__name.
......
...@@ -60,6 +60,8 @@ extern enum processor_type s390_arch; ...@@ -60,6 +60,8 @@ extern enum processor_type s390_arch;
extern enum processor_flags s390_arch_flags; extern enum processor_flags s390_arch_flags;
extern const char *s390_arch_string; extern const char *s390_arch_string;
extern const char *s390_backchain_string;
#define TARGET_CPU_IEEE_FLOAT \ #define TARGET_CPU_IEEE_FLOAT \
(s390_arch_flags & PF_IEEE_FLOAT) (s390_arch_flags & PF_IEEE_FLOAT)
#define TARGET_CPU_ZARCH \ #define TARGET_CPU_ZARCH \
...@@ -89,7 +91,6 @@ extern const char *s390_arch_string; ...@@ -89,7 +91,6 @@ extern const char *s390_arch_string;
extern int target_flags; extern int target_flags;
#define MASK_HARD_FLOAT 0x01 #define MASK_HARD_FLOAT 0x01
#define MASK_BACKCHAIN 0x02
#define MASK_SMALL_EXEC 0x04 #define MASK_SMALL_EXEC 0x04
#define MASK_DEBUG_ARG 0x08 #define MASK_DEBUG_ARG 0x08
#define MASK_64BIT 0x10 #define MASK_64BIT 0x10
...@@ -100,7 +101,6 @@ extern int target_flags; ...@@ -100,7 +101,6 @@ extern int target_flags;
#define TARGET_HARD_FLOAT (target_flags & MASK_HARD_FLOAT) #define TARGET_HARD_FLOAT (target_flags & MASK_HARD_FLOAT)
#define TARGET_SOFT_FLOAT (!(target_flags & MASK_HARD_FLOAT)) #define TARGET_SOFT_FLOAT (!(target_flags & MASK_HARD_FLOAT))
#define TARGET_BACKCHAIN (target_flags & MASK_BACKCHAIN)
#define TARGET_SMALL_EXEC (target_flags & MASK_SMALL_EXEC) #define TARGET_SMALL_EXEC (target_flags & MASK_SMALL_EXEC)
#define TARGET_DEBUG_ARG (target_flags & MASK_DEBUG_ARG) #define TARGET_DEBUG_ARG (target_flags & MASK_DEBUG_ARG)
#define TARGET_64BIT (target_flags & MASK_64BIT) #define TARGET_64BIT (target_flags & MASK_64BIT)
...@@ -110,6 +110,9 @@ extern int target_flags; ...@@ -110,6 +110,9 @@ extern int target_flags;
#define TARGET_NO_FUSED_MADD (target_flags & MASK_NO_FUSED_MADD) #define TARGET_NO_FUSED_MADD (target_flags & MASK_NO_FUSED_MADD)
#define TARGET_FUSED_MADD (! TARGET_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. */ /* ??? Once this actually works, it could be made a runtime option. */
#define TARGET_IBM_FLOAT 0 #define TARGET_IBM_FLOAT 0
#define TARGET_IEEE_FLOAT 1 #define TARGET_IEEE_FLOAT 1
...@@ -123,8 +126,6 @@ extern int target_flags; ...@@ -123,8 +126,6 @@ extern int target_flags;
#define TARGET_SWITCHES \ #define TARGET_SWITCHES \
{ { "hard-float", 1, N_("Use hardware fp")}, \ { { "hard-float", 1, N_("Use hardware fp")}, \
{ "soft-float", -1, N_("Don't use hardware fp")}, \ { "soft-float", -1, N_("Don't use hardware fp")}, \
{ "backchain", 2, N_("Set backchain")}, \
{ "no-backchain", -2, N_("Don't set backchain (faster, but debug harder")},\
{ "small-exec", 4, N_("Use bras for executable < 64k")}, \ { "small-exec", 4, N_("Use bras for executable < 64k")}, \
{ "no-small-exec", -4, N_("Don't use bras")}, \ { "no-small-exec", -4, N_("Don't use bras")}, \
{ "debug", 8, N_("Additional debug prints")}, \ { "debug", 8, N_("Additional debug prints")}, \
...@@ -146,6 +147,12 @@ extern int target_flags; ...@@ -146,6 +147,12 @@ extern int target_flags;
N_("Schedule code for given CPU"), 0}, \ N_("Schedule code for given CPU"), 0}, \
{ "arch=", &s390_arch_string, \ { "arch=", &s390_arch_string, \
N_("Generate code for given CPU"), 0}, \ 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"}, \
} }
/* Support for configure-time defaults. */ /* Support for configure-time defaults. */
...@@ -559,9 +566,13 @@ extern int current_function_outgoing_args_size; ...@@ -559,9 +566,13 @@ extern int current_function_outgoing_args_size;
For frames farther back, we use the stack slot where For frames farther back, we use the stack slot where
the corresponding RETURN_REGNUM register was saved. */ the corresponding RETURN_REGNUM register was saved. */
#define DYNAMIC_CHAIN_ADDRESS(FRAME) \ #define DYNAMIC_CHAIN_ADDRESS(FRAME) \
((FRAME) != hard_frame_pointer_rtx ? (FRAME) : \ (TARGET_BACKCHAIN ? \
plus_constant (arg_pointer_rtx, -STACK_POINTER_OFFSET)) ((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) \ #define RETURN_ADDR_RTX(COUNT, FRAME) \
s390_return_addr_rtx ((COUNT), DYNAMIC_CHAIN_ADDRESS ((FRAME))) s390_return_addr_rtx ((COUNT), DYNAMIC_CHAIN_ADDRESS ((FRAME)))
......
...@@ -7217,11 +7217,19 @@ ...@@ -7217,11 +7217,19 @@
(plus (reg 15) (match_operand 1 "general_operand" ""))) (plus (reg 15) (match_operand 1 "general_operand" "")))
(set (match_operand 0 "general_operand" "") (set (match_operand 0 "general_operand" "")
(reg 15))] (reg 15))]
"TARGET_BACKCHAIN" "TARGET_BACKCHAIN || TARGET_KERNEL_BACKCHAIN"
{ {
rtx stack = gen_rtx_REG (Pmode, STACK_POINTER_REGNUM); rtx stack = gen_rtx_REG (Pmode, STACK_POINTER_REGNUM);
rtx chain = gen_rtx_MEM (Pmode, stack); rtx chain;
rtx temp = gen_reg_rtx (Pmode); rtx temp;
if (TARGET_KERNEL_BACKCHAIN)
chain = plus_constant (stack, STACK_POINTER_OFFSET - UNITS_PER_WORD);
else
chain = stack;
chain = gen_rtx_MEM (Pmode, chain);
temp = gen_reg_rtx (Pmode);
emit_move_insn (temp, chain); emit_move_insn (temp, chain);
......
...@@ -617,7 +617,7 @@ See RS/6000 and PowerPC Options. ...@@ -617,7 +617,7 @@ See RS/6000 and PowerPC Options.
@emph{S/390 and zSeries Options} @emph{S/390 and zSeries Options}
@gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
-mhard-float -msoft-float -mbackchain -mno-backchain @gol -mhard-float -msoft-float -mbackchain -mno-backchain -mkernel-backchain @gol
-msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
-m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
-mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd} -mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd}
...@@ -10454,13 +10454,27 @@ generates IEEE floating-point instructions. This is the default. ...@@ -10454,13 +10454,27 @@ generates IEEE floating-point instructions. This is the default.
@item -mbackchain @item -mbackchain
@itemx -mno-backchain @itemx -mno-backchain
@itemx -mkernel-backchain
@opindex mbackchain @opindex mbackchain
@opindex mno-backchain @opindex mno-backchain
Generate (or do not generate) code which maintains an explicit @opindex mkernel-backchain
backchain within the stack frame that points to the caller's frame. In order to provide a backchain the address of the caller's frame
This may be needed to allow debugging using tools that do not understand is stored within the callee's stack frame.
DWARF-2 call frame information. The default is not to generate the A backchain may be needed to allow debugging using tools that do not understand
backchain. 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 @item -msmall-exec
@itemx -mno-small-exec @itemx -mno-small-exec
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment