[multiple changes]

2002-03-05  Tom Tromey  <tromey@redhat.com>

	* config/stormy16/stormy16.h (DWARF_LINE_MIN_INSTR_LENGTH):
	Define.

2002-03-05  Nick Clifton  <nickc@cambridge.redhat.com>

	* config/stormy16/stormy16.md ("*eqbranchsi"): Remove '+' on
	operand 2.
	("*ineqbranchsi"): Likewise.

2002-03-05  Andrew Haley  <aph@cambridge.redhat.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@redhat.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.

From-SVN: r63898
This commit is contained in:
DJ Delorie 2003-03-06 15:03:49 -05:00
parent 4c28216d00
commit f3922fd268
4 changed files with 139 additions and 21 deletions

View File

@ -1,3 +1,45 @@
2002-03-05 Tom Tromey <tromey@redhat.com>
* config/stormy16/stormy16.h (DWARF_LINE_MIN_INSTR_LENGTH):
Define.
2002-03-05 Nick Clifton <nickc@cambridge.redhat.com>
* config/stormy16/stormy16.md ("*eqbranchsi"): Remove '+' on
operand 2.
("*ineqbranchsi"): Likewise.
2002-03-05 Andrew Haley <aph@cambridge.redhat.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@redhat.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.
2003-03-06 Jason Merrill <jason@redhat.com>
* tree-inline.c (inlinable_function_p): Revert earlier change

View File

@ -545,6 +545,29 @@ xstormy16_carry_plus_operand (x, mode)
&& (INTVAL (XEXP (x, 1)) < -4 || INTVAL (XEXP (x, 1)) > 4));
}
/* 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_preferred_reload_class (x, class)
@ -581,7 +604,9 @@ xstormy16_legitimate_address_p (mode, x, strict)
&& LEGITIMATE_ADDRESS_INTEGER_P (XEXP (x, 1), 0))
x = XEXP (x, 0);
if (GET_CODE (x) == POST_INC
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);
@ -855,6 +880,29 @@ xstormy16_expand_move (mode, dest, src)
rtx dest;
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
&& ! reload_completed
@ -915,6 +963,7 @@ struct xstormy16_stack_layout
#define REG_NEEDS_SAVE(REGNUM, IFUN) \
((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)))
/* Compute the stack layout. */
@ -1014,44 +1063,66 @@ xstormy16_expand_prologue ()
int regno;
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 ();
if (layout.locals_size >= 32768)
error ("Local variable memory requirements exceed capacity.");
/* Save the argument registers if necessary. */
if (layout.stdarg_save_size)
for (regno = FIRST_ARGUMENT_REGISTER;
regno < FIRST_ARGUMENT_REGISTER + NUM_ARGUMENT_REGISTERS;
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,
gen_rtx_SET (VOIDmode,
mem_fake_push_rtx,
reg),
dwarf,
REG_NOTES (insn));
RTX_FRAME_RELATED_P (XVECEXP (dwarf, 0, 0)) = 1;
RTX_FRAME_RELATED_P (XVECEXP (dwarf, 0, 1)) = 1;
}
/* Push each of the registers to save. */
for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
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,
gen_rtx_SET (VOIDmode,
mem_fake_push_rtx,
reg),
dwarf,
REG_NOTES (insn));
RTX_FRAME_RELATED_P (XVECEXP (dwarf, 0, 0)) = 1;
RTX_FRAME_RELATED_P (XVECEXP (dwarf, 0, 1)) = 1;
}
/* It's just possible that the SP here might be what we need for

View File

@ -3483,6 +3483,11 @@ do { \
pointers. */
#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
arguments. If the standard syntax is used, you need not define them

View File

@ -150,13 +150,13 @@
(define_expand "movhi"
[(set (match_operand:HI 0 "nonimmediate_nonstack_operand" "")
(match_operand:HI 1 "general_operand" ""))]
(match_operand:HI 1 "xs_hi_general_operand" ""))]
""
"{ xstormy16_expand_move (HImode, operands[0], operands[1]); DONE; }")
(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"))]
(match_operand:HI 1 "xs_hi_general_operand" "r,e,m,L,L,i,i"))]
""
"@
mov %0,%1
@ -279,7 +279,7 @@
(define_insn "addhi3"
[(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")))
(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"))]
""
"@
@ -311,7 +311,7 @@
(define_insn "addchi4"
[(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")))
(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))
(zero_extend:SI (match_dup 2)))
@ -329,7 +329,7 @@
(zero_extend:HI (match_operand:BI 3
"register_operand"
"y,y,y")))
(match_operand:HI 2 "nonmemory_operand" "L,Ir,i")))
(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
(zero_extend:SI (match_dup 1))
@ -352,7 +352,7 @@
(define_insn "subhi3"
[(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")))
(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"))]
""
"@
@ -368,7 +368,7 @@
(define_insn "subchi4"
[(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")))
(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))
(zero_extend:SI (match_dup 2)))
@ -386,7 +386,7 @@
(zero_extend:HI (match_operand:BI 3
"register_operand"
"y,y,y")))
(match_operand:HI 2 "nonmemory_operand" "L,Ir,i")))
(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
(zero_extend:SI (match_dup 1))
@ -796,7 +796,7 @@
[(set (pc)
(if_then_else (match_operator:SI 1 "equality_operator"
[(match_operand:SI 2 "register_operand"
"+r")
"r")
(const_int 0)])
(label_ref (match_operand 0 "" ""))
(pc)))
@ -817,7 +817,7 @@
[(set (pc)
(if_then_else (match_operator:SI 1 "xstormy16_ineqsi_operator"
[(match_operand:SI 2 "register_operand"
"+r")
"r")
(match_operand:SI 3 "nonmemory_operand"
"ri")])
(label_ref (match_operand 0 "" ""))
@ -851,7 +851,7 @@
(match_operand:HI 3 "nonmemory_operand" "L,Ir,i")])
(label_ref (match_operand 0 "" ""))
(pc)))
(set (match_operand:HI 2 "register_operand" "=2,2,2")
(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)))
(clobber (match_operand:BI 6 "" "=y,y,y"))]