This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: some xstormy16 patches
> Otherwise, the patch looks OK.
Updated patch attached. Ok?
2002-03-05 Tom Tromey <tromey at redhat dot com>
* config/stormy16/stormy16.h (DWARF_LINE_MIN_INSTR_LENGTH):
Define.
2002-03-05 Nick Clifton <nickc at cambridge dot redhat dot com>
* config/stormy16/stormy16.md ("*eqbranchsi"): Remove '+' on
operand 2.
("*ineqbranchsi"): Likewise.
2002-03-05 Andrew Haley <aph at cambridge dot redhat dot com>
* config/stormy16/stormy16.c (xstormy16_expand_prologue): Delete
mem_fake_push_rtx. Instead construct a SEQUENCE to show the
register store followed by a stack increment.
2002-03-05 Chris Moller <cmoller at redhat dot com>
* config/stormy16/stormy16.c (REG_NEEDS_SAVE): added a term
to inhibit saving CARRY_REGS.
* config/stormy16/stormy16.c (xs_hi_general_operand):
added predicate to detect and error-out on out-of-range
const_ints for movhi.
* config/stormy16/stormy16.md (movhi): use
xs_hi_general_operand.
* config/stormy16/stormy16.c (xstormy16_expand_prologue):
added a check for local vbl size overflow.
* config/stormy16/stormy16.c (xs_hi_nonmemory_operand):
added predicate to detect and error-out on out-of-range
const_ints for addhi and subhi.
* config/stormy16/stormy16.md (addhi3, addchi4, addchi5,
subhi3, subchi4, subchi5): used xs_hi_nonmemory_operand.
* config/stormy16/stormy16.c (xstormy16_legitimate_address_p):
add a term to accept PRE_MODIFY addresses.
* config/stormy16/stormy16.c (xstormy16_expand_move):
add code to expand PRE_MODIFY addresses to an add followed
by a move.
Index: config/stormy16/stormy16.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/stormy16/stormy16.c,v
retrieving revision 1.35
diff -p -2 -r1.35 config/stormy16/stormy16.c
*** config/stormy16/stormy16.c 28 Jan 2003 18:08:55 -0000 1.35
--- config/stormy16/stormy16.c 6 Mar 2003 04:00:18 -0000
*************** xstormy16_carry_plus_operand (x, mode)
*** 546,549 ****
--- 546,572 ----
}
+ /* Detect and error out on out-of-range constants for movhi. */
+ int
+ xs_hi_general_operand (x, mode)
+ rtx x;
+ enum machine_mode mode ATTRIBUTE_UNUSED;
+ {
+ if ((GET_CODE (x) == CONST_INT)
+ && ((INTVAL (x) >= 32768) || (INTVAL (x) < -32768)))
+ error ("Constant halfword load operand out of range.");
+ return general_operand (x, mode);
+ }
+
+ /* Detect and error out on out-of-range constants for addhi and subhi. */
+ int
+ xs_hi_nonmemory_operand (x, mode)
+ rtx x;
+ enum machine_mode mode ATTRIBUTE_UNUSED;
+ {
+ if ((GET_CODE (x) == CONST_INT)
+ && ((INTVAL (x) >= 32768) || (INTVAL (x) < -32768)))
+ error ("Constant arithmetic operand out of range.");
+ return nonmemory_operand (x, mode);
+ }
enum reg_class
*************** xstormy16_legitimate_address_p (mode, x,
*** 582,586 ****
x = XEXP (x, 0);
! if (GET_CODE (x) == POST_INC
|| GET_CODE (x) == PRE_DEC)
x = XEXP (x, 0);
--- 605,611 ----
x = XEXP (x, 0);
! if ((GET_CODE (x) == PRE_MODIFY
! && GET_CODE (XEXP (XEXP (x, 1), 1)) == CONST_INT)
! || GET_CODE (x) == POST_INC
|| GET_CODE (x) == PRE_DEC)
x = XEXP (x, 0);
*************** xstormy16_expand_move (mode, dest, src)
*** 856,859 ****
--- 881,907 ----
rtx src;
{
+ if ((GET_CODE (dest) == MEM) && (GET_CODE (XEXP (dest, 0)) == PRE_MODIFY))
+ {
+ rtx pmv = XEXP (dest, 0);
+ rtx dest_reg = XEXP (pmv, 0);
+ rtx dest_mod = XEXP (pmv, 1);
+ rtx set = gen_rtx_SET (Pmode, dest_reg, dest_mod);
+ rtx clobber = gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (BImode, 16));
+
+ dest = gen_rtx_MEM (mode, dest_reg);
+ emit_insn (gen_rtx_PARALLEL (VOIDmode, gen_rtvec (2, set, clobber)));
+ }
+ else if ((GET_CODE (src) == MEM) && (GET_CODE (XEXP (src, 0)) == PRE_MODIFY))
+ {
+ rtx pmv = XEXP (src, 0);
+ rtx src_reg = XEXP (pmv, 0);
+ rtx src_mod = XEXP (pmv, 1);
+ rtx set = gen_rtx_SET (Pmode, src_reg, src_mod);
+ rtx clobber = gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (BImode, 16));
+
+ src = gen_rtx_MEM (mode, src_reg);
+ emit_insn (gen_rtx_PARALLEL (VOIDmode, gen_rtvec (2, set, clobber)));
+ }
+
/* There are only limited immediate-to-memory move instructions. */
if (! reload_in_progress
*************** struct xstormy16_stack_layout
*** 916,919 ****
--- 964,968 ----
((regs_ever_live[REGNUM] && ! call_used_regs[REGNUM]) \
|| (IFUN && ! fixed_regs[REGNUM] && call_used_regs[REGNUM] \
+ && (REGNO_REG_CLASS (REGNUM) != CARRY_REGS) \
&& (regs_ever_live[REGNUM] || ! current_function_is_leaf)))
*************** xstormy16_expand_prologue ()
*** 1015,1028 ****
rtx insn;
rtx mem_push_rtx;
- rtx mem_fake_push_rtx;
const int ifun = xstormy16_interrupt_function_p ();
mem_push_rtx = gen_rtx_POST_INC (Pmode, stack_pointer_rtx);
mem_push_rtx = gen_rtx_MEM (HImode, mem_push_rtx);
- mem_fake_push_rtx = gen_rtx_PRE_INC (Pmode, stack_pointer_rtx);
- mem_fake_push_rtx = gen_rtx_MEM (HImode, mem_fake_push_rtx);
layout = xstormy16_compute_stack_layout ();
/* Save the argument registers if necessary. */
if (layout.stdarg_save_size)
--- 1064,1077 ----
rtx insn;
rtx mem_push_rtx;
const int ifun = xstormy16_interrupt_function_p ();
mem_push_rtx = gen_rtx_POST_INC (Pmode, stack_pointer_rtx);
mem_push_rtx = gen_rtx_MEM (HImode, mem_push_rtx);
layout = xstormy16_compute_stack_layout ();
+ if (layout.locals_size >= 32768)
+ error ("Local variable memory requirements exceed capacity.");
+
/* Save the argument registers if necessary. */
if (layout.stdarg_save_size)
*************** xstormy16_expand_prologue ()
*** 1031,1042 ****
regno++)
{
rtx reg = gen_rtx_REG (HImode, regno);
insn = emit_move_insn (mem_push_rtx, reg);
RTX_FRAME_RELATED_P (insn) = 1;
REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR,
! gen_rtx_SET (VOIDmode,
! mem_fake_push_rtx,
! reg),
REG_NOTES (insn));
}
--- 1080,1102 ----
regno++)
{
+ rtx dwarf;
rtx reg = gen_rtx_REG (HImode, regno);
+
insn = emit_move_insn (mem_push_rtx, reg);
RTX_FRAME_RELATED_P (insn) = 1;
+
+ dwarf = gen_rtx_SEQUENCE (VOIDmode, rtvec_alloc (2));
+
+ XVECEXP (dwarf, 0, 0) = gen_rtx_SET (VOIDmode,
+ gen_rtx_MEM (Pmode, stack_pointer_rtx),
+ reg);
+ XVECEXP (dwarf, 0, 1) = gen_rtx_SET (Pmode, stack_pointer_rtx,
+ plus_constant (stack_pointer_rtx,
+ GET_MODE_SIZE (Pmode)));
REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR,
! dwarf,
REG_NOTES (insn));
+ RTX_FRAME_RELATED_P (XVECEXP (dwarf, 0, 0)) = 1;
+ RTX_FRAME_RELATED_P (XVECEXP (dwarf, 0, 1)) = 1;
}
*************** xstormy16_expand_prologue ()
*** 1045,1056 ****
if (REG_NEEDS_SAVE (regno, ifun))
{
rtx reg = gen_rtx_REG (HImode, regno);
insn = emit_move_insn (mem_push_rtx, reg);
RTX_FRAME_RELATED_P (insn) = 1;
REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR,
! gen_rtx_SET (VOIDmode,
! mem_fake_push_rtx,
! reg),
REG_NOTES (insn));
}
--- 1105,1127 ----
if (REG_NEEDS_SAVE (regno, ifun))
{
+ rtx dwarf;
rtx reg = gen_rtx_REG (HImode, regno);
+
insn = emit_move_insn (mem_push_rtx, reg);
RTX_FRAME_RELATED_P (insn) = 1;
+
+ dwarf = gen_rtx_SEQUENCE (VOIDmode, rtvec_alloc (2));
+
+ XVECEXP (dwarf, 0, 0) = gen_rtx_SET (VOIDmode,
+ gen_rtx_MEM (Pmode, stack_pointer_rtx),
+ reg);
+ XVECEXP (dwarf, 0, 1) = gen_rtx_SET (Pmode, stack_pointer_rtx,
+ plus_constant (stack_pointer_rtx,
+ GET_MODE_SIZE (Pmode)));
REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR,
! dwarf,
REG_NOTES (insn));
+ RTX_FRAME_RELATED_P (XVECEXP (dwarf, 0, 0)) = 1;
+ RTX_FRAME_RELATED_P (XVECEXP (dwarf, 0, 1)) = 1;
}
Index: config/stormy16/stormy16.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/stormy16/stormy16.h,v
retrieving revision 1.68
diff -p -2 -r1.68 config/stormy16/stormy16.h
*** config/stormy16/stormy16.h 28 Jan 2003 18:08:55 -0000 1.68
--- config/stormy16/stormy16.h 6 Mar 2003 04:00:19 -0000
*************** do { \
*** 3484,3487 ****
--- 3484,3492 ----
#define DWARF2_ADDR_SIZE 4
+ /* Define the architecture-dependent minimum instruction length (in
+ bytes). */
+ #define DWARF_LINE_MIN_INSTR_LENGTH 2
+
+
/* Define these macros to override the assembler syntax for the special SDB
assembler directives. See `sdbout.c' for a list of these macros and their
Index: config/stormy16/stormy16.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/stormy16/stormy16.md,v
retrieving revision 1.10
diff -p -2 -r1.10 config/stormy16/stormy16.md
*** config/stormy16/stormy16.md 20 Nov 2002 21:08:33 -0000 1.10
--- config/stormy16/stormy16.md 6 Mar 2003 04:00:19 -0000
***************
*** 151,155 ****
(define_expand "movhi"
[(set (match_operand:HI 0 "nonimmediate_nonstack_operand" "")
! (match_operand:HI 1 "general_operand" ""))]
""
"{ xstormy16_expand_move (HImode, operands[0], operands[1]); DONE; }")
--- 151,155 ----
(define_expand "movhi"
[(set (match_operand:HI 0 "nonimmediate_nonstack_operand" "")
! (match_operand:HI 1 "xs_hi_general_operand" ""))]
""
"{ xstormy16_expand_move (HImode, operands[0], operands[1]); DONE; }")
***************
*** 157,161 ****
(define_insn "*movhi_internal"
[(set (match_operand:HI 0 "nonimmediate_nonstack_operand" "=r,m,e,e,T,r,S")
! (match_operand:HI 1 "general_operand" "r,e,m,L,L,i,i"))]
""
"@
--- 157,161 ----
(define_insn "*movhi_internal"
[(set (match_operand:HI 0 "nonimmediate_nonstack_operand" "=r,m,e,e,T,r,S")
! (match_operand:HI 1 "xs_hi_general_operand" "r,e,m,L,L,i,i"))]
""
"@
***************
*** 280,284 ****
[(set (match_operand:HI 0 "register_operand" "=r,r,T,T,r,r,r")
(plus:HI (match_operand:HI 1 "register_operand" "%0,0,0,0,0,0,0")
! (match_operand:HI 2 "nonmemory_operand" "O,P,L,M,Ir,N,i")))
(clobber (match_scratch:BI 3 "=X,X,&y,&y,&y,&y,&y"))]
""
--- 280,284 ----
[(set (match_operand:HI 0 "register_operand" "=r,r,T,T,r,r,r")
(plus:HI (match_operand:HI 1 "register_operand" "%0,0,0,0,0,0,0")
! (match_operand:HI 2 "xs_hi_nonmemory_operand" "O,P,L,M,Ir,N,i")))
(clobber (match_scratch:BI 3 "=X,X,&y,&y,&y,&y,&y"))]
""
***************
*** 312,316 ****
[(set (match_operand:HI 0 "register_operand" "=T,r,r")
(plus:HI (match_operand:HI 1 "register_operand" "%0,0,0")
! (match_operand:HI 2 "nonmemory_operand" "L,Ir,i")))
(set (match_operand:BI 3 "register_operand" "=y,y,y")
(truncate:BI (lshiftrt:SI (plus:SI (zero_extend:SI (match_dup 1))
--- 312,316 ----
[(set (match_operand:HI 0 "register_operand" "=T,r,r")
(plus:HI (match_operand:HI 1 "register_operand" "%0,0,0")
! (match_operand:HI 2 "xs_hi_nonmemory_operand" "L,Ir,i")))
(set (match_operand:BI 3 "register_operand" "=y,y,y")
(truncate:BI (lshiftrt:SI (plus:SI (zero_extend:SI (match_dup 1))
***************
*** 330,334 ****
"register_operand"
"y,y,y")))
! (match_operand:HI 2 "nonmemory_operand" "L,Ir,i")))
(set (match_operand:BI 4 "register_operand" "=y,y,y")
(truncate:BI (lshiftrt:SI (plus:SI (plus:SI
--- 330,334 ----
"register_operand"
"y,y,y")))
! (match_operand:HI 2 "xs_hi_nonmemory_operand" "L,Ir,i")))
(set (match_operand:BI 4 "register_operand" "=y,y,y")
(truncate:BI (lshiftrt:SI (plus:SI (plus:SI
***************
*** 353,357 ****
[(set (match_operand:HI 0 "register_operand" "=r,r,T,T,r,r,r")
(minus:HI (match_operand:HI 1 "register_operand" "0,0,0,0,0,0,0")
! (match_operand:HI 2 "nonmemory_operand" "O,P,L,M,rI,M,i")))
(clobber (match_scratch:BI 3 "=X,X,&y,&y,&y,&y,&y"))]
""
--- 353,357 ----
[(set (match_operand:HI 0 "register_operand" "=r,r,T,T,r,r,r")
(minus:HI (match_operand:HI 1 "register_operand" "0,0,0,0,0,0,0")
! (match_operand:HI 2 "xs_hi_nonmemory_operand" "O,P,L,M,rI,M,i")))
(clobber (match_scratch:BI 3 "=X,X,&y,&y,&y,&y,&y"))]
""
***************
*** 369,373 ****
[(set (match_operand:HI 0 "register_operand" "=T,r,r")
(minus:HI (match_operand:HI 1 "register_operand" "0,0,0")
! (match_operand:HI 2 "nonmemory_operand" "L,Ir,i")))
(set (match_operand:BI 3 "register_operand" "=y,y,y")
(truncate:BI (lshiftrt:SI (minus:SI (zero_extend:SI (match_dup 1))
--- 369,373 ----
[(set (match_operand:HI 0 "register_operand" "=T,r,r")
(minus:HI (match_operand:HI 1 "register_operand" "0,0,0")
! (match_operand:HI 2 "xs_hi_nonmemory_operand" "L,Ir,i")))
(set (match_operand:BI 3 "register_operand" "=y,y,y")
(truncate:BI (lshiftrt:SI (minus:SI (zero_extend:SI (match_dup 1))
***************
*** 387,391 ****
"register_operand"
"y,y,y")))
! (match_operand:HI 2 "nonmemory_operand" "L,Ir,i")))
(set (match_operand:BI 4 "register_operand" "=y,y,y")
(truncate:BI (lshiftrt:SI (minus:SI (minus:SI
--- 387,391 ----
"register_operand"
"y,y,y")))
! (match_operand:HI 2 "xs_hi_nonmemory_operand" "L,Ir,i")))
(set (match_operand:BI 4 "register_operand" "=y,y,y")
(truncate:BI (lshiftrt:SI (minus:SI (minus:SI
***************
*** 797,801 ****
(if_then_else (match_operator:SI 1 "equality_operator"
[(match_operand:SI 2 "register_operand"
! "+r")
(const_int 0)])
(label_ref (match_operand 0 "" ""))
--- 797,801 ----
(if_then_else (match_operator:SI 1 "equality_operator"
[(match_operand:SI 2 "register_operand"
! "r")
(const_int 0)])
(label_ref (match_operand 0 "" ""))
***************
*** 818,822 ****
(if_then_else (match_operator:SI 1 "xstormy16_ineqsi_operator"
[(match_operand:SI 2 "register_operand"
! "+r")
(match_operand:SI 3 "nonmemory_operand"
"ri")])
--- 818,822 ----
(if_then_else (match_operator:SI 1 "xstormy16_ineqsi_operator"
[(match_operand:SI 2 "register_operand"
! "r")
(match_operand:SI 3 "nonmemory_operand"
"ri")])
***************
*** 852,856 ****
(label_ref (match_operand 0 "" ""))
(pc)))
! (set (match_operand:HI 2 "register_operand" "=2,2,2")
(minus:HI (minus:HI (match_dup 1) (zero_extend:HI (match_dup 4)))
(match_dup 3)))
--- 852,856 ----
(label_ref (match_operand 0 "" ""))
(pc)))
! (set (match_operand:HI 2 "register_operand" "=1,1,1")
(minus:HI (minus:HI (match_dup 1) (zero_extend:HI (match_dup 4)))
(match_dup 3)))