aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorAndrew Haley <aph@cambridge.redhat.com>2002-02-01 15:20:16 +0000
committerAndrew Haley <aph@gcc.gnu.org>2002-02-01 15:20:16 +0000
commit5ee4950e46c20b9b14b2fca1997b63121b5158b1 (patch)
tree73bd43f41a41624df697e872f828c3eeab8129c6 /gcc
parentb88c0704cf87c13c78f1a0741704b4e41897c195 (diff)
downloadgcc-5ee4950e46c20b9b14b2fca1997b63121b5158b1.zip
gcc-5ee4950e46c20b9b14b2fca1997b63121b5158b1.tar.gz
gcc-5ee4950e46c20b9b14b2fca1997b63121b5158b1.tar.bz2
stormy16.md (pushqi): New.
2002-01-30 Andrew Haley <aph@cambridge.redhat.com> * config/stormy16/stormy16.md (pushqi): New. (popqi): New. (pushhi): New. (pophi): New. (movhi): Remove stack operands. (movqi): Likewise. * config/stormy16/stormy16.h (PREDICATE_CODES): Add nonimmediate_nonstack_operand. * config/stormy16/stormy16.c (nonimmediate_nonstack_operand): New. * config/stormy16/stormy16-protos.h (nonimmediate_nonstack_operand) New. From-SVN: r49394
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog15
-rw-r--r--gcc/config/stormy16/stormy16-protos.h1
-rw-r--r--gcc/config/stormy16/stormy16.c11
-rw-r--r--gcc/config/stormy16/stormy16.h4
-rw-r--r--gcc/config/stormy16/stormy16.md67
5 files changed, 80 insertions, 18 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index b6097ca..b8b7ac3 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,18 @@
+2002-01-30 Andrew Haley <aph@cambridge.redhat.com>
+
+ * config/stormy16/stormy16.md (pushqi): New.
+ (popqi): New.
+ (pushhi): New.
+ (pophi): New.
+ (movhi): Remove stack operands.
+ (movqi): Likewise.
+ * config/stormy16/stormy16.h (PREDICATE_CODES): Add
+ nonimmediate_nonstack_operand.
+ * config/stormy16/stormy16.c (nonimmediate_nonstack_operand):
+ New.
+ * config/stormy16/stormy16-protos.h (nonimmediate_nonstack_operand)
+ New.
+
2002-01-31 Jason Merrill <jason@redhat.com>
* Makefile.in (c-parse.c): Handle .output file.
diff --git a/gcc/config/stormy16/stormy16-protos.h b/gcc/config/stormy16/stormy16-protos.h
index 47c1e3e..76d0bc0 100644
--- a/gcc/config/stormy16/stormy16-protos.h
+++ b/gcc/config/stormy16/stormy16-protos.h
@@ -73,6 +73,7 @@ extern int inequality_operator PARAMS ((rtx, enum machine_mode));
extern void xstormy16_split_cbranch PARAMS ((enum machine_mode,
rtx, rtx, rtx, rtx));
extern int short_memory_operand PARAMS ((rtx, enum machine_mode));
+extern int nonimmediate_nonstack_operand PARAMS ((rtx, enum machine_mode));
extern enum reg_class xstormy16_secondary_reload_class
PARAMS ((enum reg_class, enum machine_mode, rtx));
extern int xstormy16_carry_plus_operand PARAMS ((rtx, enum machine_mode));
diff --git a/gcc/config/stormy16/stormy16.c b/gcc/config/stormy16/stormy16.c
index fd8c978..0a886ac 100644
--- a/gcc/config/stormy16/stormy16.c
+++ b/gcc/config/stormy16/stormy16.c
@@ -622,6 +622,17 @@ short_memory_operand (x, mode)
return (GET_CODE (XEXP (x, 0)) != PLUS);
}
+int
+nonimmediate_nonstack_operand (op, mode)
+ rtx op;
+ enum machine_mode mode;
+{
+ /* 'Q' is for pushes, 'R' for pops. */
+ return (nonimmediate_operand (op, mode)
+ && ! xstormy16_extra_constraint_p (op, 'Q')
+ && ! xstormy16_extra_constraint_p (op, 'R'));
+}
+
/* Splitter for the 'move' patterns, for modes not directly implemeted
by hardware. Emit insns to copy a value of mode MODE from SRC to
DEST.
diff --git a/gcc/config/stormy16/stormy16.h b/gcc/config/stormy16/stormy16.h
index c3539d2..b4ceb3e 100644
--- a/gcc/config/stormy16/stormy16.h
+++ b/gcc/config/stormy16/stormy16.h
@@ -3894,8 +3894,8 @@ do { \
{"shift_operator", {ASHIFT, ASHIFTRT, LSHIFTRT }}, \
{"equality_operator", {EQ, NE }}, \
{"inequality_operator", {GE, GT, LE, LT, GEU, GTU, LEU, LTU }}, \
- {"xstormy16_ineqsi_operator", {LT, GE, LTU, GEU }},
-
+ {"xstormy16_ineqsi_operator", {LT, GE, LTU, GEU }}, \
+ {"nonimmediate_nonstack_operand", {REG, MEM}},
/* An alias for a machine mode name. This is the machine mode that elements of
a jump-table should have. */
#define CASE_VECTOR_MODE SImode
diff --git a/gcc/config/stormy16/stormy16.md b/gcc/config/stormy16/stormy16.md
index 4435379..3dcaa68 100644
--- a/gcc/config/stormy16/stormy16.md
+++ b/gcc/config/stormy16/stormy16.md
@@ -72,21 +72,46 @@
;; :: Moves
;; ::
;; ::::::::::::::::::::
+;; push/pop qi and hi are here as separate insns rather than part of
+;; the movqi/hi patterns because we need to ensure that reload isn't
+;; passed anything it can't cope with. Without these patterns, we
+;; might end up with
+
+;; (set (mem (post_inc (sp))) mem (post_inc (reg)))
+
+;; If, in this example, reg needs reloading, reload will read reg from
+;; the stack , adjust sp, and store reg back at what is now the wrong
+;; offset. By using separate patterns for push and pop we ensure that
+;; insns like this one are never generated.
+
+(define_insn "pushqi"
+ [(set (mem:QI (post_inc (reg:HI 15)))
+ (match_operand:QI 0 "register_operand" "r"))]
+ ""
+ "push %0"
+ [(set_attr "psw_operand" "nop")
+ (set_attr "length" "2")])
+
+(define_insn "popqi"
+ [(set (match_operand:QI 0 "register_operand" "=r")
+ (mem:QI (pre_dec (reg:HI 15))))]
+ ""
+ "pop %0"
+ [(set_attr "psw_operand" "nop")
+ (set_attr "length" "2")])
(define_expand "movqi"
- [(set (match_operand:QI 0 "nonimmediate_operand" "")
+ [(set (match_operand:QI 0 "nonimmediate_nonstack_operand" "")
(match_operand:QI 1 "general_operand" ""))]
""
"{ xstormy16_expand_move (QImode, operands[0], operands[1]); DONE; }")
(define_insn "*movqi_internal"
- [(set (match_operand:QI 0 "nonimmediate_operand" "=r,Q,r,m,e,e,T,r,S")
- (match_operand:QI 1 "general_operand" "r,r,R,e,m,i,i,i,i"))]
+ [(set (match_operand:QI 0 "nonimmediate_nonstack_operand" "=r,m,e,e,T,r,S")
+ (match_operand:QI 1 "general_operand" "r,e,m,i,i,i,i"))]
""
"@
mov %0,%1
- push %1
- pop %0
mov.b %0,%1
mov.b %0,%1
mov %0,%1
@@ -95,8 +120,6 @@
mov.b %0,%1"
[(set_attr_alternative "length"
[(const_int 2)
- (const_int 2)
- (const_int 2)
(if_then_else (match_operand:QI 0 "short_memory_operand" "")
(const_int 2)
(const_int 4))
@@ -107,22 +130,36 @@
(const_int 2)
(const_int 4)
(const_int 4)])
- (set_attr "psw_operand" "0,nop,nop,0,0,0,nop,0,nop")])
+ (set_attr "psw_operand" "0,0,0,0,nop,0,nop")])
+
+(define_insn "pushhi"
+ [(set (mem:HI (post_inc (reg:HI 15)))
+ (match_operand:HI 0 "register_operand" "r"))]
+ ""
+ "push %0"
+ [(set_attr "psw_operand" "nop")
+ (set_attr "length" "2")])
+
+(define_insn "pophi"
+ [(set (match_operand:HI 0 "register_operand" "=r")
+ (mem:HI (pre_dec (reg:HI 15))))]
+ ""
+ "pop %0"
+ [(set_attr "psw_operand" "nop")
+ (set_attr "length" "2")])
(define_expand "movhi"
- [(set (match_operand:HI 0 "nonimmediate_operand" "")
+ [(set (match_operand:HI 0 "nonimmediate_nonstack_operand" "")
(match_operand:HI 1 "general_operand" ""))]
""
"{ xstormy16_expand_move (HImode, operands[0], operands[1]); DONE; }")
(define_insn "*movhi_internal"
- [(set (match_operand:HI 0 "nonimmediate_operand" "=r,Q,r,m,e,e,T,r,S")
- (match_operand:HI 1 "general_operand" "r,r,R,e,m,L,L,i,i"))]
+ [(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"))]
""
"@
mov %0,%1
- push %1
- pop %0
mov.w %0,%1
mov.w %0,%1
mov.w %0,%1
@@ -131,8 +168,6 @@
mov.w %0,%1"
[(set_attr_alternative "length"
[(const_int 2)
- (const_int 2)
- (const_int 2)
(if_then_else (match_operand:QI 0 "short_memory_operand" "")
(const_int 2)
(const_int 4))
@@ -143,7 +178,7 @@
(const_int 2)
(const_int 4)
(const_int 4)])
- (set_attr "psw_operand" "0,nop,nop,0,0,0,nop,0,nop")])
+ (set_attr "psw_operand" "0,0,0,0,nop,0,nop")])
(define_expand "movsi"
[(set (match_operand:SI 0 "nonimmediate_operand" "")