mmix.md (define_constants): Remove misleading FIXME.

* config/mmix/mmix.md (define_constants): Remove misleading
	FIXME.  Add MMIX_fp_rO_OFFSET.
	("nonlocal_goto_receiver"): Don't have stack-frame address of
	saved rO as part of the pattern.  Remove FIXME.
	("*nonlocal_goto_receiver_expanded"): Similar.  Generate address
	here, at output-time.
	* config/mmix/crti.asm (_init): Register _fini with atexit.
	* config/mmix/crtn.asm (_fini): Add omitted "POP 0,0".
	* config/mmix/mmix.c (mmix_target_asm_function_prologue): Correct
	unwind information when frame_pointer_needed.
	(mmix_assemble_integer): Tweak wording in comment.

From-SVN: r51776
This commit is contained in:
Hans-Peter Nilsson 2002-04-03 02:23:07 +00:00 committed by Hans-Peter Nilsson
parent 1a8129b342
commit 9a7996ef89
5 changed files with 113 additions and 46 deletions

View File

@ -1,3 +1,17 @@
2002-04-03 Hans-Peter Nilsson <hp@bitrange.com>
* config/mmix/mmix.md (define_constants): Remove misleading
FIXME. Add MMIX_fp_rO_OFFSET.
("nonlocal_goto_receiver"): Don't have stack-frame address of
saved rO as part of the pattern. Remove FIXME.
("*nonlocal_goto_receiver_expanded"): Similar. Generate address
here, at output-time.
* config/mmix/crti.asm (_init): Register _fini with atexit.
* config/mmix/crtn.asm (_fini): Add omitted "POP 0,0".
* config/mmix/mmix.c (mmix_target_asm_function_prologue): Correct
unwind information when frame_pointer_needed.
(mmix_assemble_integer): Tweak wording in comment.
2002-04-02 Richard Henderson <rth@redhat.com>
PR opt/3967

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2001 Free Software Foundation, Inc.
/* Copyright (C) 2001, 2002 Free Software Foundation, Inc.
Contributed by Hans-Peter Nilsson <hp@bitrange.com>
This file is free software; you can redistribute it and/or modify it
@ -103,6 +103,14 @@ _init:
TRAP 0,0,0
0H IS @
% Register _fini to be executed as the last atexit function.
#ifdef __MMIX_ABI_GNU__
GETA $231,_fini
#else
GETA $1,_fini
#endif
PUSHJ $0,atexit
.section .fini,"ax",@progbits
.global _fini
_fini:

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2001 Free Software Foundation, Inc.
/* Copyright (C) 2001, 2002 Free Software Foundation, Inc.
Contributed by Hans-Peter Nilsson <hp@bitrange.com>
This file is free software; you can redistribute it and/or modify it
@ -87,5 +87,6 @@ gnu_parm_reg_1 GREG
.section .fini,"ax",@progbits
GETA $255,0F
PUT rJ,$255
POP 0,0
0H PUT rJ,$0
POP 0,0

View File

@ -734,8 +734,9 @@ mmix_target_asm_function_prologue (stream, locals_size)
setting; they don't accumulate. We must keep track
of the offset ourselves. */
cfa_offset += stack_chunk;
dwarf2out_def_cfa ("", MMIX_STACK_POINTER_REGNUM,
cfa_offset);
if (!frame_pointer_needed)
dwarf2out_def_cfa ("", MMIX_STACK_POINTER_REGNUM,
cfa_offset);
}
offset += stack_chunk;
stack_space_to_allocate -= stack_chunk;
@ -768,11 +769,7 @@ mmix_target_asm_function_prologue (stream, locals_size)
reg_names[MMIX_STACK_POINTER_REGNUM],
stack_chunk);
if (doing_dwarf)
{
cfa_offset += stack_chunk;
dwarf2out_def_cfa ("", MMIX_STACK_POINTER_REGNUM,
cfa_offset);
}
cfa_offset += stack_chunk;
offset += stack_chunk;
stack_space_to_allocate -= stack_chunk;
}
@ -785,8 +782,18 @@ mmix_target_asm_function_prologue (stream, locals_size)
reg_names[MMIX_STACK_POINTER_REGNUM],
offset + 8);
if (doing_dwarf)
dwarf2out_reg_save ("", MMIX_FRAME_POINTER_REGNUM,
-cfa_offset + offset);
{
/* If we're using the frame-pointer, then we just need this CFA
definition basing on that value (often equal to the CFA).
Further changes to the stack-pointer do not affect the
frame-pointer, so we conditionalize them below on
!frame_pointer_needed. */
dwarf2out_def_cfa ("", MMIX_FRAME_POINTER_REGNUM,
-cfa_offset + offset + 8);
dwarf2out_reg_save ("", MMIX_FRAME_POINTER_REGNUM,
-cfa_offset + offset);
}
offset -= 8;
}
@ -811,8 +818,9 @@ mmix_target_asm_function_prologue (stream, locals_size)
if (doing_dwarf)
{
cfa_offset += stack_chunk;
dwarf2out_def_cfa ("", MMIX_STACK_POINTER_REGNUM,
cfa_offset);
if (!frame_pointer_needed)
dwarf2out_def_cfa ("", MMIX_STACK_POINTER_REGNUM,
cfa_offset);
}
offset += stack_chunk;
stack_space_to_allocate -= stack_chunk;
@ -850,7 +858,8 @@ mmix_target_asm_function_prologue (stream, locals_size)
if (doing_dwarf)
{
cfa_offset += stack_chunk;
dwarf2out_def_cfa ("", MMIX_STACK_POINTER_REGNUM,
if (!frame_pointer_needed)
dwarf2out_def_cfa ("", MMIX_STACK_POINTER_REGNUM,
cfa_offset);
}
}
@ -910,8 +919,9 @@ mmix_target_asm_function_prologue (stream, locals_size)
if (doing_dwarf)
{
cfa_offset += stack_chunk;
dwarf2out_def_cfa ("", MMIX_STACK_POINTER_REGNUM,
cfa_offset);
if (!frame_pointer_needed)
dwarf2out_def_cfa ("", MMIX_STACK_POINTER_REGNUM,
cfa_offset);
}
}
else
@ -925,8 +935,9 @@ mmix_target_asm_function_prologue (stream, locals_size)
if (doing_dwarf)
{
cfa_offset += stack_chunk;
dwarf2out_def_cfa ("", MMIX_STACK_POINTER_REGNUM,
cfa_offset);
if (!frame_pointer_needed)
dwarf2out_def_cfa ("", MMIX_STACK_POINTER_REGNUM,
cfa_offset);
}
}
@ -965,8 +976,9 @@ mmix_target_asm_function_prologue (stream, locals_size)
if (doing_dwarf)
{
cfa_offset += stack_space_to_allocate;
dwarf2out_def_cfa ("", MMIX_STACK_POINTER_REGNUM,
cfa_offset);
if (!frame_pointer_needed)
dwarf2out_def_cfa ("", MMIX_STACK_POINTER_REGNUM,
cfa_offset);
}
}
@ -1912,13 +1924,12 @@ mmix_assemble_integer (x, size, aligned_p)
{
/* We handle a limited number of types of operands in here. But
that's ok, because we can punt to generic functions. We then
pretend that we don't emit aligned data is needed, so the usual
.pseudo syntax is used (which work for aligned data too). We
actually *must* do that, since we say we don't have simple
aligned pseudos, causing this function to be called. We just
try and keep as much compatibility as possible with mmixal
syntax for normal cases (i.e. without GNU extensions and C
only). */
pretend that aligned data isn't needed, so the usual .<pseudo>
syntax is used (which works for aligned data too). We actually
*must* do that, since we say we don't have simple aligned
pseudos, causing this function to be called. We just try and
keep as much compatibility as possible with mmixal syntax for
normal cases (i.e. without GNU extensions and C only). */
case 1:
if (GET_CODE (x) != CONST_INT)
{

View File

@ -34,11 +34,9 @@
;; The order of insns is as in Node: Standard Names, with smaller modes
;; before bigger modes.
;; FIXME:s
;; - Use new formats; e.g. '{' not '"*{'.
(define_constants
[(MMIX_rJ_REGNUM 259)]
[(MMIX_rJ_REGNUM 259)
(MMIX_fp_rO_OFFSET -24)]
)
;; FIXME: Can we remove the reg-to-reg for smaller modes? Shouldn't they
@ -1101,35 +1099,70 @@ DIVU %1,%1,%2\;GET %0,:rR\;NEGU %2,0,%0\;CSNN %0,$255,%2")
;; of "pop 0,0" until rO equals the saved value. (If it goes lower, we
;; should call abort.)
(define_expand "nonlocal_goto_receiver"
[(parallel [(unspec_volatile [(match_dup 0)] 1)
[(parallel [(unspec_volatile [(const_int 0)] 1)
(clobber (scratch:DI))
(clobber (reg:DI MMIX_rJ_REGNUM))])
(set (reg:DI MMIX_rJ_REGNUM) (match_dup 1))]
(set (reg:DI MMIX_rJ_REGNUM) (match_dup 0))]
""
"
{
rtx tem
= validize_mem (gen_rtx_MEM (Pmode,
plus_constant (frame_pointer_rtx, -24)));
operands[0] = XEXP (tem, 0);
operands[1]
operands[0]
= get_hard_reg_initial_val (Pmode, MMIX_INCOMING_RETURN_ADDRESS_REGNUM);
/* Mark this function as containing a landing-pad. */
cfun->machine->has_landing_pad = 1;
}")
;; FIXME: Do we need to keep this in memory? Can GCC counter our
;; expectations and use saved registers to keep the slot address in,
;; "across" the exception or goto? Anyway, we need to make sure the value
;; ends up in a non-local register, so best is to load it ourselves.
;; GCC can insist on using saved registers to keep the slot address in
;; "across" the exception, or (perhaps) to use saved registers in the
;; address and re-use them after the register stack unwind, so it's best
;; to form the address ourselves.
(define_insn "*nonlocal_goto_receiver_expanded"
[(unspec_volatile [(match_operand:DI 0 "address_operand" "p")] 1)
(clobber (match_scratch:DI 1 "=&r"))
[(unspec_volatile [(const_int 0)] 1)
(clobber (match_scratch:DI 0 "=&r"))
(clobber (reg:DI MMIX_rJ_REGNUM))]
""
"GETA $255,0f\;PUT rJ,$255\;LDOU $255,%a0\n\
0:\;GET %1,rO\;CMPU %1,%1,$255\;BNP %1,1f\;POP 0,0\n1:")
{
rtx temp_reg = operands[0];
rtx my_operands[2];
HOST_WIDEST_INT offs;
const char *my_template
= "GETA $255,0f\;PUT rJ,$255\;LDOU $255,%a0\n\
0:\;GET %1,rO\;CMPU %1,%1,$255\;BNP %1,1f\;POP 0,0\n1:";
my_operands[1] = temp_reg;
/* If we have a frame-pointer (hence unknown stack-pointer offset),
just use the frame-pointer and the known offset. */
if (frame_pointer_needed)
{
my_operands[0] = GEN_INT (-MMIX_fp_rO_OFFSET);
output_asm_insn ("NEGU %1,0,%0", my_operands);
my_operands[0] = gen_rtx_PLUS (Pmode, frame_pointer_rtx, temp_reg);
}
else
{
/* We know the fp-based offset, so "eliminate" it to be sp-based. */
offs
= (mmix_initial_elimination_offset (MMIX_FRAME_POINTER_REGNUM,
MMIX_STACK_POINTER_REGNUM)
+ MMIX_fp_rO_OFFSET);
if (offs >= 0 && offs <= 255)
my_operands[0]
= gen_rtx_PLUS (Pmode, stack_pointer_rtx, GEN_INT (offs));
else
{
mmix_output_register_setting (asm_out_file, REGNO (temp_reg),
offs, 1);
my_operands[0] = gen_rtx_PLUS (Pmode, stack_pointer_rtx, temp_reg);
}
}
output_asm_insn (my_template, my_operands);
return "";
})
(define_insn "*Naddu"
[(set (match_operand:DI 0 "register_operand" "=r")