Commit 2a2e3f05 by Aldy Hernandez Committed by Aldy Hernandez

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
parent 0f51ccfc
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> 2004-10-05 Joseph S. Myers <jsm@polyomino.org.uk>
* c-decl.c (declspecs_add_type): Don't pedwarn for _Complex in * c-decl.c (declspecs_add_type): Don't pedwarn for _Complex in
......
...@@ -68,6 +68,7 @@ extern int frv_initial_elimination_offset (int, int); ...@@ -68,6 +68,7 @@ extern int frv_initial_elimination_offset (int, int);
#ifdef RTX_CODE #ifdef RTX_CODE
extern int frv_legitimate_address_p (enum machine_mode, rtx, extern int frv_legitimate_address_p (enum machine_mode, rtx,
int, int, int); int, int, int);
extern rtx frv_legitimize_address (rtx, rtx, enum machine_mode);
extern rtx frv_find_base_term (rtx); extern rtx frv_find_base_term (rtx);
#ifdef TREE_CODE #ifdef TREE_CODE
...@@ -100,6 +101,7 @@ extern const char *frv_asm_output_opcode ...@@ -100,6 +101,7 @@ extern const char *frv_asm_output_opcode
extern void frv_final_prescan_insn (rtx, rtx *, int); extern void frv_final_prescan_insn (rtx, rtx *, int);
extern void frv_print_operand (FILE *, rtx, int); extern void frv_print_operand (FILE *, rtx, int);
extern void frv_print_operand_address (FILE *, rtx); 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 int frv_emit_movsi (rtx, rtx);
extern const char *output_move_single (rtx *, rtx); extern const char *output_move_single (rtx *, rtx);
extern const char *output_move_double (rtx *, rtx); extern const char *output_move_double (rtx *, rtx);
......
...@@ -3427,6 +3427,13 @@ frv_legitimate_address_p (enum machine_mode mode, ...@@ -3427,6 +3427,13 @@ frv_legitimate_address_p (enum machine_mode mode,
return ret; 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., /* Test whether a local function descriptor is canonical, i.e.,
whether we can use FUNCDESC_GOTOFF to compute the address of the whether we can use FUNCDESC_GOTOFF to compute the address of the
...@@ -5342,6 +5349,35 @@ direct_return_p (void) ...@@ -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 /* 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 register if needed to load up addresses. Return TRUE if the appropriate
instructions are emitted. */ instructions are emitted. */
......
...@@ -2335,6 +2335,16 @@ __asm__("\n" \ ...@@ -2335,6 +2335,16 @@ __asm__("\n" \
will reload one or both registers only if neither labeling works. */ 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 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 #define FIND_BASE_TERM frv_find_base_term
/* A C statement or compound statement with a conditional `goto LABEL;' /* A C statement or compound statement with a conditional `goto LABEL;'
......
...@@ -1558,14 +1558,7 @@ ...@@ -1558,14 +1558,7 @@
[(set (match_operand:QI 0 "general_operand" "") [(set (match_operand:QI 0 "general_operand" "")
(match_operand:QI 1 "general_operand" ""))] (match_operand:QI 1 "general_operand" ""))]
"" ""
" "{ frv_emit_move (QImode, operands[0], operands[1]); DONE; }")
{
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]);
}")
(define_insn "*movqi_load" (define_insn "*movqi_load"
[(set (match_operand:QI 0 "register_operand" "=d,f") [(set (match_operand:QI 0 "register_operand" "=d,f")
...@@ -1587,14 +1580,7 @@ ...@@ -1587,14 +1580,7 @@
[(set (match_operand:HI 0 "general_operand" "") [(set (match_operand:HI 0 "general_operand" "")
(match_operand:HI 1 "general_operand" ""))] (match_operand:HI 1 "general_operand" ""))]
"" ""
" "{ frv_emit_move (HImode, operands[0], operands[1]); DONE; }")
{
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]);
}")
(define_insn "*movhi_load" (define_insn "*movhi_load"
[(set (match_operand:HI 0 "register_operand" "=d,f") [(set (match_operand:HI 0 "register_operand" "=d,f")
...@@ -1645,11 +1631,7 @@ ...@@ -1645,11 +1631,7 @@
[(set (match_operand:SI 0 "move_destination_operand" "") [(set (match_operand:SI 0 "move_destination_operand" "")
(match_operand:SI 1 "move_source_operand" ""))] (match_operand:SI 1 "move_source_operand" ""))]
"" ""
" "{ frv_emit_move (SImode, operands[0], operands[1]); DONE; }")
{
if (frv_emit_movsi (operands[0], operands[1]))
DONE;
}")
;; Note - it is best to only have one movsi pattern and to handle ;; Note - it is best to only have one movsi pattern and to handle
;; all the various contingencies by the use of alternatives. This ;; all the various contingencies by the use of alternatives. This
...@@ -1673,7 +1655,9 @@ ...@@ -1673,7 +1655,9 @@
;; re-recognize them again after the substitution for memory. So keep ;; re-recognize them again after the substitution for memory. So keep
;; a memory constraint available, just make sure reload won't be ;; a memory constraint available, just make sure reload won't be
;; tempted to use it. ;; tempted to use it.
;;
(define_insn "*movsi_load" (define_insn "*movsi_load"
[(set (match_operand:SI 0 "register_operand" "=d,f") [(set (match_operand:SI 0 "register_operand" "=d,f")
(match_operand:SI 1 "frv_load_operand" "m,m"))] (match_operand:SI 1 "frv_load_operand" "m,m"))]
...@@ -1752,14 +1736,7 @@ ...@@ -1752,14 +1736,7 @@
[(set (match_operand:DI 0 "nonimmediate_operand" "") [(set (match_operand:DI 0 "nonimmediate_operand" "")
(match_operand:DI 1 "general_operand" ""))] (match_operand:DI 1 "general_operand" ""))]
"" ""
" "{ frv_emit_move (DImode, operands[0], operands[1]); DONE; }")
{
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]);
}")
(define_insn "*movdi_double" (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") [(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 @@ ...@@ -1893,14 +1870,7 @@
[(set (match_operand:SF 0 "general_operand" "") [(set (match_operand:SF 0 "general_operand" "")
(match_operand:SF 1 "general_operand" ""))] (match_operand:SF 1 "general_operand" ""))]
"" ""
" "{ frv_emit_move (SFmode, operands[0], operands[1]); DONE; }")
{
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]);
}")
(define_split (define_split
[(set (match_operand:SF 0 "integer_register_operand" "") [(set (match_operand:SF 0 "integer_register_operand" "")
...@@ -1962,14 +1932,7 @@ ...@@ -1962,14 +1932,7 @@
[(set (match_operand:DF 0 "nonimmediate_operand" "") [(set (match_operand:DF 0 "nonimmediate_operand" "")
(match_operand:DF 1 "general_operand" ""))] (match_operand:DF 1 "general_operand" ""))]
"" ""
" "{ frv_emit_move (DFmode, operands[0], operands[1]); DONE; }")
{
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]);
}")
(define_insn "*movdf_double" (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") [(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")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment