Commit 3ec1b4cb by Hans-Peter Nilsson Committed by Hans-Peter Nilsson

mmix.c: Improve comments.

	* config/mmix/mmix.c: Improve comments.
	(mmix_target_asm_function_prologue): Drop variable
	empty_stack_frame.  Don't allocate unused slot above fp.
	(mmix_target_asm_function_epilogue): Mirror prologue changes.
	* config/mmix/mmix.h (MMIX_GNU_ABI_REG_ALLOC_ORDER): Don't have
	brace in first column.
	(enum reg_class): Ditto.
	(FIRST_PARM_OFFSET): Now 0.
	(USER_LABEL_PREFIX): Remove #if 0:d definition.

From-SVN: r50538
parent 0c1fcb02
2002-03-10 Hans-Peter Nilsson <hp@bitrange.com>
* config/mmix/mmix.c: Improve comments.
(mmix_target_asm_function_prologue): Drop variable
empty_stack_frame. Don't allocate unused slot above fp.
(mmix_target_asm_function_epilogue): Mirror prologue changes.
* config/mmix/mmix.h (MMIX_GNU_ABI_REG_ALLOC_ORDER): Don't have
brace in first column.
(enum reg_class): Ditto.
(FIRST_PARM_OFFSET): Now 0.
(USER_LABEL_PREFIX): Remove #if 0:d definition.
2002-03-10 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 2002-03-10 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* combine.c (make_extraction): Fix error in last change. * combine.c (make_extraction): Fix error in last change.
......
...@@ -414,7 +414,10 @@ mmix_return_addr_rtx (count, frame) ...@@ -414,7 +414,10 @@ mmix_return_addr_rtx (count, frame)
{ {
return count == 0 return count == 0
? (MMIX_CFUN_NEEDS_SAVED_EH_RETURN_ADDRESS ? (MMIX_CFUN_NEEDS_SAVED_EH_RETURN_ADDRESS
/* FIXME: Set frame_alias_set on the following. */ /* FIXME: Set frame_alias_set on the following. (Why?)
See mmix_initial_elimination_offset for the reason we can't use
get_hard_reg_initial_val for both. Always using a stack slot
and not a register would be suboptimal. */
? validize_mem (gen_rtx_MEM (Pmode, plus_constant (frame_pointer_rtx, -16))) ? validize_mem (gen_rtx_MEM (Pmode, plus_constant (frame_pointer_rtx, -16)))
: get_hard_reg_initial_val (Pmode, MMIX_INCOMING_RETURN_ADDRESS_REGNUM)) : get_hard_reg_initial_val (Pmode, MMIX_INCOMING_RETURN_ADDRESS_REGNUM))
: NULL_RTX; : NULL_RTX;
...@@ -440,7 +443,10 @@ mmix_initial_elimination_offset (fromreg, toreg) ...@@ -440,7 +443,10 @@ mmix_initial_elimination_offset (fromreg, toreg)
int fp_sp_offset int fp_sp_offset
= (get_frame_size () + current_function_outgoing_args_size + 7) & ~7; = (get_frame_size () + current_function_outgoing_args_size + 7) & ~7;
/* There is no actual difference between these two. */ /* There is no actual offset between these two virtual values, but for
the frame-pointer, we have the old one in the stack position below
it, so the offset for the frame-pointer to the stack-pointer is one
octabyte larger. */
if (fromreg == MMIX_ARG_POINTER_REGNUM if (fromreg == MMIX_ARG_POINTER_REGNUM
&& toreg == MMIX_FRAME_POINTER_REGNUM) && toreg == MMIX_FRAME_POINTER_REGNUM)
return 0; return 0;
...@@ -661,14 +667,8 @@ mmix_target_asm_function_prologue (stream, locals_size) ...@@ -661,14 +667,8 @@ mmix_target_asm_function_prologue (stream, locals_size)
int stack_space_to_allocate int stack_space_to_allocate
= (current_function_outgoing_args_size = (current_function_outgoing_args_size
+ current_function_pretend_args_size + current_function_pretend_args_size
+ (int) locals_size + 8 + 7) & ~7; + (int) locals_size + 7) & ~7;
int offset = -8; int offset = -8;
int empty_stack_frame
= (current_function_outgoing_args_size == 0
&& locals_size == 0
&& current_function_pretend_args_size == 0
&& current_function_varargs == 0
&& current_function_stdarg == 0);
int doing_dwarf = dwarf2out_do_frame (); int doing_dwarf = dwarf2out_do_frame ();
long cfa_offset = 0; long cfa_offset = 0;
...@@ -752,16 +752,10 @@ mmix_target_asm_function_prologue (stream, locals_size) ...@@ -752,16 +752,10 @@ mmix_target_asm_function_prologue (stream, locals_size)
} }
} }
/* In any case, skip over the return-address slot. FIXME: Not needed
now. */
offset -= 8;
/* Store the frame-pointer. */ /* Store the frame-pointer. */
if (frame_pointer_needed) if (frame_pointer_needed)
{ {
empty_stack_frame = 0;
if (offset < 0) if (offset < 0)
{ {
/* Get 8 less than otherwise, since we need to reach offset + 8. */ /* Get 8 less than otherwise, since we need to reach offset + 8. */
...@@ -799,8 +793,9 @@ mmix_target_asm_function_prologue (stream, locals_size) ...@@ -799,8 +793,9 @@ mmix_target_asm_function_prologue (stream, locals_size)
if (MMIX_CFUN_NEEDS_SAVED_EH_RETURN_ADDRESS) if (MMIX_CFUN_NEEDS_SAVED_EH_RETURN_ADDRESS)
{ {
/* Store the return-address, if one is needed on the stack. */ /* Store the return-address, if one is needed on the stack. We
empty_stack_frame = 0; usually store it in a register when needed, but that doesn't work
with -fexceptions. */
if (offset < 0) if (offset < 0)
{ {
...@@ -838,8 +833,6 @@ mmix_target_asm_function_prologue (stream, locals_size) ...@@ -838,8 +833,6 @@ mmix_target_asm_function_prologue (stream, locals_size)
/* Store the register defining the numbering of local registers, so /* Store the register defining the numbering of local registers, so
we know how long to unwind the register stack. */ we know how long to unwind the register stack. */
empty_stack_frame = 0;
if (offset < 0) if (offset < 0)
{ {
/* Get 8 less than otherwise, since we need to reach offset + 8. */ /* Get 8 less than otherwise, since we need to reach offset + 8. */
...@@ -894,8 +887,6 @@ mmix_target_asm_function_prologue (stream, locals_size) ...@@ -894,8 +887,6 @@ mmix_target_asm_function_prologue (stream, locals_size)
&& regs_ever_live[regno] && ! call_used_regs[regno]) && regs_ever_live[regno] && ! call_used_regs[regno])
|| IS_MMIX_EH_RETURN_DATA_REG (regno)) || IS_MMIX_EH_RETURN_DATA_REG (regno))
{ {
empty_stack_frame = 0;
if (offset < 0) if (offset < 0)
{ {
int stack_chunk; int stack_chunk;
...@@ -950,11 +941,10 @@ mmix_target_asm_function_prologue (stream, locals_size) ...@@ -950,11 +941,10 @@ mmix_target_asm_function_prologue (stream, locals_size)
offset -= 8; offset -= 8;
} }
/* Finally, allocate room for local vars (if they weren't allocated for /* Finally, allocate room for outgoing args and local vars if room
above) and outgoing args. This might be any number of bytes (well, wasn't allocated above. This might be any number of bytes (well, we
we assume it fits in a host-int). assume it fits in a host-int). */
Don't allocate (the return-address slot) if the stack frame is empty. */ if (stack_space_to_allocate)
if (stack_space_to_allocate && ! empty_stack_frame)
{ {
if (stack_space_to_allocate < 256) if (stack_space_to_allocate < 256)
{ {
...@@ -1006,19 +996,13 @@ mmix_target_asm_function_epilogue (stream, locals_size) ...@@ -1006,19 +996,13 @@ mmix_target_asm_function_epilogue (stream, locals_size)
int stack_space_to_deallocate int stack_space_to_deallocate
= (current_function_outgoing_args_size = (current_function_outgoing_args_size
+ current_function_pretend_args_size + current_function_pretend_args_size
+ (int) locals_size + 8 + 7) & ~7; + (int) locals_size + 7) & ~7;
/* The assumption that locals_size fits in an int is asserted in /* The assumption that locals_size fits in an int is asserted in
mmix_target_asm_function_prologue. */ mmix_target_asm_function_prologue. */
/* The first address to access is beyond the outgoing_args area. */ /* The first address to access is beyond the outgoing_args area. */
int offset = current_function_outgoing_args_size; int offset = current_function_outgoing_args_size;
int empty_stack_frame
= (current_function_outgoing_args_size == 0
&& locals_size == 0
&& current_function_pretend_args_size == 0
&& ! MMIX_CFUN_NEEDS_SAVED_EH_RETURN_ADDRESS
&& ! MMIX_CFUN_HAS_LANDING_PAD);
/* Add the space for global non-register-stack registers. /* Add the space for global non-register-stack registers.
It is assumed that the frame-pointer register can be one of these It is assumed that the frame-pointer register can be one of these
...@@ -1059,8 +1043,6 @@ mmix_target_asm_function_epilogue (stream, locals_size) ...@@ -1059,8 +1043,6 @@ mmix_target_asm_function_epilogue (stream, locals_size)
&& regs_ever_live[regno] && !call_used_regs[regno]) && regs_ever_live[regno] && !call_used_regs[regno])
|| IS_MMIX_EH_RETURN_DATA_REG (regno)) || IS_MMIX_EH_RETURN_DATA_REG (regno))
{ {
empty_stack_frame = 0;
if (offset > 255) if (offset > 255)
{ {
if (offset > 65535) if (offset > 65535)
...@@ -1106,8 +1088,6 @@ mmix_target_asm_function_epilogue (stream, locals_size) ...@@ -1106,8 +1088,6 @@ mmix_target_asm_function_epilogue (stream, locals_size)
/* Get back the old frame-pointer-value. */ /* Get back the old frame-pointer-value. */
if (frame_pointer_needed) if (frame_pointer_needed)
{ {
empty_stack_frame = 0;
if (offset > 255) if (offset > 255)
{ {
if (offset > 65535) if (offset > 65535)
...@@ -1135,27 +1115,22 @@ mmix_target_asm_function_epilogue (stream, locals_size) ...@@ -1135,27 +1115,22 @@ mmix_target_asm_function_epilogue (stream, locals_size)
offset += 8; offset += 8;
} }
/* Do not deallocate the return-address slot if the stack frame is /* We do not need to restore pretended incoming args, just add back
empty, because then it was never allocated. */ offset to sp. */
if (! empty_stack_frame) if (stack_space_to_deallocate > 65535)
{ {
/* We do not need to restore pretended incoming args, just add /* There's better support for incrementing than decrementing, so
back offset to sp. */ we might be able to optimize this as we see a need. */
if (stack_space_to_deallocate > 65535) mmix_output_register_setting (stream, 255,
{ stack_space_to_deallocate, 1);
/* There's better support for incrementing than decrementing, so fprintf (stream, "\tADDU %s,%s,$255\n",
we might be able to optimize this as we see a need. */ reg_names[MMIX_STACK_POINTER_REGNUM],
mmix_output_register_setting (stream, 255, reg_names[MMIX_STACK_POINTER_REGNUM]);
stack_space_to_deallocate, 1);
fprintf (stream, "\tADDU %s,%s,$255\n",
reg_names[MMIX_STACK_POINTER_REGNUM],
reg_names[MMIX_STACK_POINTER_REGNUM]);
}
else
fprintf (stream, "\tINCL %s,%d\n",
reg_names[MMIX_STACK_POINTER_REGNUM],
stack_space_to_deallocate);
} }
else if (stack_space_to_deallocate != 0)
fprintf (stream, "\tINCL %s,%d\n",
reg_names[MMIX_STACK_POINTER_REGNUM],
stack_space_to_deallocate);
if (current_function_calls_eh_return) if (current_function_calls_eh_return)
/* Adjustment the (normal) stack-pointer to that of the receiver. /* Adjustment the (normal) stack-pointer to that of the receiver.
...@@ -1343,9 +1318,9 @@ void ...@@ -1343,9 +1318,9 @@ void
mmix_trampoline_template (stream) mmix_trampoline_template (stream)
FILE * stream; FILE * stream;
{ {
/* Read a value from to static-chain, jump somewhere. The static chain /* Read a value into the static-chain register and jump somewhere. The
is stored at offset 16, and the function address is stored at offset static chain is stored at offset 16, and the function address is
24. */ stored at offset 24. */
/* FIXME: GCC copies this using *intsize* (tetra), when it should use /* FIXME: GCC copies this using *intsize* (tetra), when it should use
register size (octa). */ register size (octa). */
fprintf (stream, "\tGETA $255,1F\n\t"); fprintf (stream, "\tGETA $255,1F\n\t");
......
...@@ -483,7 +483,7 @@ extern int target_flags; ...@@ -483,7 +483,7 @@ extern int target_flags;
assuming it is referenced a very limited number of times. Other global assuming it is referenced a very limited number of times. Other global
and fixed registers come next; they are never allocated. */ and fixed registers come next; they are never allocated. */
#define MMIX_GNU_ABI_REG_ALLOC_ORDER \ #define MMIX_GNU_ABI_REG_ALLOC_ORDER \
{ 252, 251, 250, 249, 248, 247, 246, \ { 252, 251, 250, 249, 248, 247, 246, \
245, 244, 243, 242, 241, 240, 239, 238, \ 245, 244, 243, 242, 241, 240, 239, 238, \
237, 236, 235, 234, 233, 232, 231, \ 237, 236, 235, 234, 233, 232, 231, \
\ \
...@@ -549,10 +549,10 @@ extern int target_flags; ...@@ -549,10 +549,10 @@ extern int target_flags;
/* Node: Register Classes */ /* Node: Register Classes */
enum reg_class enum reg_class
{ {
NO_REGS, GENERAL_REGS, REMAINDER_REG, HIMULT_REG, NO_REGS, GENERAL_REGS, REMAINDER_REG, HIMULT_REG,
SYSTEM_REGS, ALL_REGS, LIM_REG_CLASSES SYSTEM_REGS, ALL_REGS, LIM_REG_CLASSES
}; };
#define N_REG_CLASSES (int) LIM_REG_CLASSES #define N_REG_CLASSES (int) LIM_REG_CLASSES
...@@ -626,10 +626,7 @@ enum reg_class ...@@ -626,10 +626,7 @@ enum reg_class
#define STARTING_FRAME_OFFSET \ #define STARTING_FRAME_OFFSET \
mmix_starting_frame_offset () mmix_starting_frame_offset ()
/* There is a stack slot between the frame-pointer and the first #define FIRST_PARM_OFFSET(FUNDECL) 0
parameter, where the return address is sometimes stored. FIXME:
Unnecessary. */
#define FIRST_PARM_OFFSET(FUNDECL) 8
#define DYNAMIC_CHAIN_ADDRESS(FRAMEADDR) \ #define DYNAMIC_CHAIN_ADDRESS(FRAMEADDR) \
mmix_dynamic_chain_address (FRAMEADDR) mmix_dynamic_chain_address (FRAMEADDR)
...@@ -1104,10 +1101,6 @@ const_section () \ ...@@ -1104,10 +1101,6 @@ const_section () \
#define PRINT_OPERAND_ADDRESS(STREAM, X) \ #define PRINT_OPERAND_ADDRESS(STREAM, X) \
mmix_print_operand_address (STREAM, X) mmix_print_operand_address (STREAM, X)
#if 0
#define USER_LABEL_PREFIX "_"
#endif
#define ASM_OUTPUT_REG_PUSH(STREAM, REGNO) \ #define ASM_OUTPUT_REG_PUSH(STREAM, REGNO) \
mmix_asm_output_reg_push (STREAM, REGNO) mmix_asm_output_reg_push (STREAM, REGNO)
......
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