aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorAldy Hernandez <aldyh@redhat.com>2004-10-05 20:11:17 +0000
committerAldy Hernandez <aldyh@gcc.gnu.org>2004-10-05 20:11:17 +0000
commit2a2e3f05b63e223da76ad63a7ee08267aa18c8e1 (patch)
treec705c5b28aa519bc64718ce0c24dea4a352a5ae2 /gcc
parent0f51ccfcd8de8513d98890ae4e9d9198db1a35b3 (diff)
downloadgcc-2a2e3f05b63e223da76ad63a7ee08267aa18c8e1.zip
gcc-2a2e3f05b63e223da76ad63a7ee08267aa18c8e1.tar.gz
gcc-2a2e3f05b63e223da76ad63a7ee08267aa18c8e1.tar.bz2
frv.h (LEGITIMIZE_ADDRESS): New.
* config/frv/frv.h (LEGITIMIZE_ADDRESS): New. * config/frv/frv-protos.h (frv_legitimize_address): Protoize. (frv_emit_move): Same. * config/frv/frv.c (frv_emit_move): New. (frv_legitimize_address): New. * config/frv/frv.md ("movsi"): Call frv_emit_move. ("movqi"): Same. ("movhi"): Same. ("movdi"): Same. ("movsf"): Same. ("movdf"): Same. From-SVN: r88574
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog17
-rw-r--r--gcc/config/frv/frv-protos.h2
-rw-r--r--gcc/config/frv/frv.c36
-rw-r--r--gcc/config/frv/frv.h10
-rw-r--r--gcc/config/frv/frv.md55
5 files changed, 74 insertions, 46 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f3b9b84..9c98af6 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,20 @@
+2004-10-05 Aldy Hernandez <aldyh@redhat.com>
+
+ * config/frv/frv.h (LEGITIMIZE_ADDRESS): New.
+
+ * config/frv/frv-protos.h (frv_legitimize_address): Protoize.
+ (frv_emit_move): Same.
+
+ * config/frv/frv.c (frv_emit_move): New.
+ (frv_legitimize_address): New.
+
+ * config/frv/frv.md ("movsi"): Call frv_emit_move.
+ ("movqi"): Same.
+ ("movhi"): Same.
+ ("movdi"): Same.
+ ("movsf"): Same.
+ ("movdf"): Same.
+
2004-10-05 Joseph S. Myers <jsm@polyomino.org.uk>
* c-decl.c (declspecs_add_type): Don't pedwarn for _Complex in
diff --git a/gcc/config/frv/frv-protos.h b/gcc/config/frv/frv-protos.h
index cf6c859..d775260 100644
--- a/gcc/config/frv/frv-protos.h
+++ b/gcc/config/frv/frv-protos.h
@@ -68,6 +68,7 @@ extern int frv_initial_elimination_offset (int, int);
#ifdef RTX_CODE
extern int frv_legitimate_address_p (enum machine_mode, rtx,
int, int, int);
+extern rtx frv_legitimize_address (rtx, rtx, enum machine_mode);
extern rtx frv_find_base_term (rtx);
#ifdef TREE_CODE
@@ -100,6 +101,7 @@ extern const char *frv_asm_output_opcode
extern void frv_final_prescan_insn (rtx, rtx *, int);
extern void frv_print_operand (FILE *, rtx, int);
extern void frv_print_operand_address (FILE *, rtx);
+extern void frv_emit_move (enum machine_mode, rtx, rtx);
extern int frv_emit_movsi (rtx, rtx);
extern const char *output_move_single (rtx *, rtx);
extern const char *output_move_double (rtx *, rtx);
diff --git a/gcc/config/frv/frv.c b/gcc/config/frv/frv.c
index 9862013..b8d6961 100644
--- a/gcc/config/frv/frv.c
+++ b/gcc/config/frv/frv.c
@@ -3427,6 +3427,13 @@ frv_legitimate_address_p (enum machine_mode mode,
return ret;
}
+rtx
+frv_legitimize_address (rtx x ATTRIBUTE_UNUSED,
+ rtx oldx ATTRIBUTE_UNUSED,
+ enum machine_mode mode ATTRIBUTE_UNUSED)
+{
+ return NULL_RTX;
+}
/* Test whether a local function descriptor is canonical, i.e.,
whether we can use FUNCDESC_GOTOFF to compute the address of the
@@ -5342,6 +5349,35 @@ direct_return_p (void)
}
+void
+frv_emit_move (enum machine_mode mode, rtx dest, rtx src)
+{
+ switch (mode)
+ {
+ case SImode:
+ if (frv_emit_movsi (dest, src))
+ return;
+ break;
+
+ case QImode:
+ case HImode:
+ case DImode:
+ case SFmode:
+ case DFmode:
+ if (!reload_in_progress
+ && !reload_completed
+ && !register_operand (dest, mode)
+ && !reg_or_0_operand (src, mode))
+ src = copy_to_mode_reg (mode, src);
+ break;
+
+ default:
+ abort ();
+ }
+
+ emit_insn (gen_rtx_SET (VOIDmode, dest, src));
+}
+
/* Emit code to handle a MOVSI, adding in the small data register or pic
register if needed to load up addresses. Return TRUE if the appropriate
instructions are emitted. */
diff --git a/gcc/config/frv/frv.h b/gcc/config/frv/frv.h
index 91acc3d..55fd007 100644
--- a/gcc/config/frv/frv.h
+++ b/gcc/config/frv/frv.h
@@ -2335,6 +2335,16 @@ __asm__("\n" \
will reload one or both registers only if neither labeling works. */
#define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_BASE_P (X)
+#define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN) \
+do { \
+ rtx new_x = frv_legitimize_address (X, OLDX, MODE); \
+ if (new_x) \
+ { \
+ (X) = new_x; \
+ goto WIN; \
+ } \
+} while (0)
+
#define FIND_BASE_TERM frv_find_base_term
/* A C statement or compound statement with a conditional `goto LABEL;'
diff --git a/gcc/config/frv/frv.md b/gcc/config/frv/frv.md
index a3f9453..0cf8887 100644
--- a/gcc/config/frv/frv.md
+++ b/gcc/config/frv/frv.md
@@ -1558,14 +1558,7 @@
[(set (match_operand:QI 0 "general_operand" "")
(match_operand:QI 1 "general_operand" ""))]
""
- "
-{
- if (!reload_in_progress
- && !reload_completed
- && !register_operand (operands[0], QImode)
- && !reg_or_0_operand (operands[1], QImode))
- operands[1] = copy_to_mode_reg (QImode, operands[1]);
-}")
+ "{ frv_emit_move (QImode, operands[0], operands[1]); DONE; }")
(define_insn "*movqi_load"
[(set (match_operand:QI 0 "register_operand" "=d,f")
@@ -1587,14 +1580,7 @@
[(set (match_operand:HI 0 "general_operand" "")
(match_operand:HI 1 "general_operand" ""))]
""
- "
-{
- if (!reload_in_progress
- && !reload_completed
- && !register_operand (operands[0], HImode)
- && !reg_or_0_operand (operands[1], HImode))
- operands[1] = copy_to_mode_reg (HImode, operands[1]);
-}")
+ "{ frv_emit_move (HImode, operands[0], operands[1]); DONE; }")
(define_insn "*movhi_load"
[(set (match_operand:HI 0 "register_operand" "=d,f")
@@ -1645,11 +1631,7 @@
[(set (match_operand:SI 0 "move_destination_operand" "")
(match_operand:SI 1 "move_source_operand" ""))]
""
- "
-{
- if (frv_emit_movsi (operands[0], operands[1]))
- DONE;
-}")
+ "{ frv_emit_move (SImode, operands[0], operands[1]); DONE; }")
;; Note - it is best to only have one movsi pattern and to handle
;; all the various contingencies by the use of alternatives. This
@@ -1673,7 +1655,9 @@
;; re-recognize them again after the substitution for memory. So keep
;; a memory constraint available, just make sure reload won't be
;; tempted to use it.
-
+;;
+
+
(define_insn "*movsi_load"
[(set (match_operand:SI 0 "register_operand" "=d,f")
(match_operand:SI 1 "frv_load_operand" "m,m"))]
@@ -1752,14 +1736,7 @@
[(set (match_operand:DI 0 "nonimmediate_operand" "")
(match_operand:DI 1 "general_operand" ""))]
""
- "
-{
- if (!reload_in_progress
- && !reload_completed
- && !register_operand (operands[0], DImode)
- && !reg_or_0_operand (operands[1], DImode))
- operands[1] = copy_to_mode_reg (DImode, operands[1]);
-}")
+ "{ frv_emit_move (DImode, operands[0], operands[1]); DONE; }")
(define_insn "*movdi_double"
[(set (match_operand:DI 0 "move_destination_operand" "=e,?h,??d,??f,R,?R,??m,??m,e,?h,??d,??f,?e,??d,?h,??f,R,m,e,??d,e,??d,?h,??f")
@@ -1893,14 +1870,7 @@
[(set (match_operand:SF 0 "general_operand" "")
(match_operand:SF 1 "general_operand" ""))]
""
- "
-{
- if (!reload_in_progress
- && !reload_completed
- && !register_operand (operands[0], SFmode)
- && !reg_or_0_operand (operands[1], SFmode))
- operands[1] = copy_to_mode_reg (SFmode, operands[1]);
-}")
+ "{ frv_emit_move (SFmode, operands[0], operands[1]); DONE; }")
(define_split
[(set (match_operand:SF 0 "integer_register_operand" "")
@@ -1962,14 +1932,7 @@
[(set (match_operand:DF 0 "nonimmediate_operand" "")
(match_operand:DF 1 "general_operand" ""))]
""
- "
-{
- if (!reload_in_progress
- && !reload_completed
- && !register_operand (operands[0], DFmode)
- && !reg_or_0_operand (operands[1], DFmode))
- operands[1] = copy_to_mode_reg (DFmode, operands[1]);
-}")
+ "{ frv_emit_move (DFmode, operands[0], operands[1]); DONE; }")
(define_insn "*movdf_double"
[(set (match_operand:DF 0 "move_destination_operand" "=h,?e,??f,??d,R,?R,??m,??m,h,?e,??f,??d,?h,??f,?e,??d,R,m,h,??f,e,??d,e,??d")