add h8sx support to h8300
Richard Sandiford
rsandifo@redhat.com
Thu Jul 8 09:39:00 GMT 2004
Alexandre Oliva <aoliva@redhat.com> writes:
> gcc.c-torture/execute/builtin-setjmp.c. It *still* fails at -O3
> -fomit-frame-pointer, but not at lower optimization levels, which it
> did before.
Are you sure it's still needed? Is it possible that whatever was
causing the failure was fixed by another patch?
I tried the attached, both with and without the h8300.md bit,
and it didn't make any difference to the results for this testcase.
Like you say, -O3 -fomit-frame-pointer fails either way.
FWIW, the test pattern was h8300-sim{-msx}{,-mn}.
I just remember this making quite a big difference to quality of the
output, but it was over a year ago, so perhaps I'm misremembering,
or perhaps it doesn't make as much difference now.
Richard
Index: config/h8300/h8300.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/h8300/h8300.c,v
retrieving revision 1.290
diff -u -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.290 h8300.c
--- config/h8300/h8300.c 8 Jul 2004 03:40:31 -0000 1.290
+++ config/h8300/h8300.c 8 Jul 2004 08:37:36 -0000
@@ -454,16 +454,12 @@ h8300_init_once (void)
before reload so that register allocator will pick the second
alternative.
- - we would like 'D' to be be NO_REGS when the frame pointer isn't
- live, but we the frame pointer may turn out to be needed after
- we start reload, and then we may have already decided we don't
- have a choice, so we can't do that. Forcing the register
- allocator to use er6 if possible might produce better code for
- small functions: it's more efficient to save and restore er6 in
- the prologue & epilogue than to do it in a define_split.
- Hopefully disparaging 'D' will have a similar effect, without
- forcing a reload failure if the frame pointer is found to be
- needed too late. */
+ - 'D' should be NO_REGS when the frame pointer isn't live.
+ The idea is to *make* it live by restricting the register allocator
+ to the first alternative. This isn't needed for correctness
+ but it produces better code for small functions: it's more
+ efficient to save and restore er6 in the prologue & epilogue
+ than to do it in a define_split. */
enum reg_class
h8300_reg_class_from_letter (int c)
@@ -484,8 +480,8 @@ h8300_reg_class_from_letter (int c)
return DESTINATION_REGS;
case 'D':
- /* The meaning of a constraint shouldn't change dynamically, so
- we can't make this NO_REGS. */
+ if (!regs_ever_live[FP_REG])
+ return NO_REGS;
return GENERAL_REGS;
case 'f':
@@ -3051,10 +3047,6 @@ h8300_swap_into_er6 (rtx addr)
{
push (HARD_FRAME_POINTER_REGNUM);
emit_move_insn (hard_frame_pointer_rtx, addr);
- if (REGNO (addr) == SP_REG)
- emit_move_insn (hard_frame_pointer_rtx,
- plus_constant (hard_frame_pointer_rtx,
- GET_MODE_SIZE (word_mode)));
}
/* Move the current value of er6 into ADDR and pop its old value
@@ -3063,8 +3055,7 @@ h8300_swap_into_er6 (rtx addr)
void
h8300_swap_out_of_er6 (rtx addr)
{
- if (REGNO (addr) != SP_REG)
- emit_move_insn (addr, hard_frame_pointer_rtx);
+ emit_move_insn (addr, hard_frame_pointer_rtx);
pop (HARD_FRAME_POINTER_REGNUM);
}
Index: config/h8300/h8300.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/h8300/h8300.md,v
retrieving revision 1.286
diff -u -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.286 h8300.md
--- config/h8300/h8300.md 8 Jul 2004 03:40:33 -0000 1.286
+++ config/h8300/h8300.md 8 Jul 2004 08:37:37 -0000
@@ -574,7 +574,7 @@ (define_insn "movmd_internal_normal"
(mem:BLK (match_operand:HI 4 "register_operand" "1,1")))
(unspec [(match_operand:HI 5 "register_operand" "2,2")
(match_operand:HI 6 "const_int_operand" "n,n")] UNSPEC_MOVMD)
- (clobber (match_operand:HI 0 "register_operand" "=d,??D"))
+ (clobber (match_operand:HI 0 "register_operand" "=d,!D"))
(clobber (match_operand:HI 1 "register_operand" "=f,f"))
(set (match_operand:HI 2 "register_operand" "=c,c")
(const_int 0))]
@@ -591,7 +591,7 @@ (define_insn "movmd_internal"
(mem:BLK (match_operand:SI 4 "register_operand" "1,1")))
(unspec [(match_operand:HI 5 "register_operand" "2,2")
(match_operand:HI 6 "const_int_operand" "n,n")] UNSPEC_MOVMD)
- (clobber (match_operand:SI 0 "register_operand" "=d,??D"))
+ (clobber (match_operand:SI 0 "register_operand" "=d,!D"))
(clobber (match_operand:SI 1 "register_operand" "=f,f"))
(set (match_operand:HI 2 "register_operand" "=c,c")
(const_int 0))]
@@ -702,7 +702,7 @@ (define_insn "stpcpy_internal_normal"
[(set (mem:BLK (match_operand:HI 3 "register_operand" "0,r"))
(unspec:BLK [(mem:BLK (match_operand:HI 4 "register_operand" "1,1"))]
UNSPEC_STPCPY))
- (clobber (match_operand:HI 0 "register_operand" "=d,??D"))
+ (clobber (match_operand:HI 0 "register_operand" "=d,!D"))
(clobber (match_operand:HI 1 "register_operand" "=f,f"))
(clobber (match_operand:HI 2 "register_operand" "=c,c"))]
"TARGET_H8300SX && TARGET_NORMAL_MODE"
@@ -716,7 +716,7 @@ (define_insn "stpcpy_internal"
[(set (mem:BLK (match_operand:SI 3 "register_operand" "0,r"))
(unspec:BLK [(mem:BLK (match_operand:SI 4 "register_operand" "1,1"))]
UNSPEC_STPCPY))
- (clobber (match_operand:SI 0 "register_operand" "=d,??D"))
+ (clobber (match_operand:SI 0 "register_operand" "=d,!D"))
(clobber (match_operand:SI 1 "register_operand" "=f,f"))
(clobber (match_operand:SI 2 "register_operand" "=c,c"))]
"TARGET_H8300SX && !TARGET_NORMAL_MODE"
More information about the Gcc-patches
mailing list