Commit 6619e96c by Alan Modra Committed by Alan Modra

pa.c (force_mode): New function.

	* pa.c (force_mode): New function.
	(emit_move_sequence): Use it instead of generating new rtx_REGs.

From-SVN: r41353
parent 92547f12
2001-04-14 Alan Modra <amodra@one.net.au>
* pa.c (force_mode): New function.
(emit_move_sequence): Use it instead of generating new rtx_REGs.
2001-04-13 Jim Wilson <wilson@redhat.com>
* config/ia64/ia64.c (ia64_expand_epilogue): Emit alloc if sibcall_p.
......
......@@ -53,6 +53,7 @@ Boston, MA 02111-1307, USA. */
static void pa_init_machine_status PARAMS ((struct function *));
static void pa_mark_machine_status PARAMS ((struct function *));
static void pa_free_machine_status PARAMS ((struct function *));
static inline rtx force_mode PARAMS ((enum machine_mode, rtx));
static void pa_combine_instructions PARAMS ((rtx));
static int pa_can_combine_p PARAMS ((rtx, rtx, rtx, int, rtx, rtx, rtx));
static int forward_branch_p PARAMS ((rtx));
......@@ -1173,6 +1174,22 @@ hppa_address_cost (X)
return 4;
}
/* Ensure mode of ORIG, a REG rtx, is MODE. Returns either ORIG or a
new rtx with the correct mode. */
static inline rtx
force_mode (mode, orig)
enum machine_mode mode;
rtx orig;
{
if (mode == GET_MODE (orig))
return orig;
if (REGNO (orig) >= FIRST_PSEUDO_REGISTER)
abort ();
return gen_rtx_REG (mode, REGNO (orig));
}
/* Emit insns to move operands[1] into operands[0].
Return 1 if we have written out everything that needs to be done to
......@@ -1253,7 +1270,7 @@ emit_move_sequence (operands, mode, scratch_reg)
/* SCRATCH_REG will hold an address and maybe the actual data. We want
it in WORD_MODE regardless of what mode it was originally given
to us. */
scratch_reg = gen_rtx_REG (word_mode, REGNO (scratch_reg));
scratch_reg = force_mode (word_mode, scratch_reg);
/* D might not fit in 14 bits either; for such cases load D into
scratch reg. */
......@@ -1285,7 +1302,7 @@ emit_move_sequence (operands, mode, scratch_reg)
/* SCRATCH_REG will hold an address and maybe the actual data. We want
it in WORD_MODE regardless of what mode it was originally given
to us. */
scratch_reg = gen_rtx_REG (word_mode, REGNO (scratch_reg));
scratch_reg = force_mode (word_mode, scratch_reg);
/* D might not fit in 14 bits either; for such cases load D into
scratch reg. */
......@@ -1323,7 +1340,7 @@ emit_move_sequence (operands, mode, scratch_reg)
/* SCRATCH_REG will hold an address and maybe the actual data. We want
it in WORD_MODE regardless of what mode it was originally given
to us. */
scratch_reg = gen_rtx_REG (word_mode, REGNO (scratch_reg));
scratch_reg = force_mode (word_mode, scratch_reg);
/* Force the constant into memory and put the address of the
memory location into scratch_reg. */
......@@ -1354,7 +1371,7 @@ emit_move_sequence (operands, mode, scratch_reg)
{
/* We are reloading the address into the scratch register, so we
want to make sure the scratch register is a full register. */
scratch_reg = gen_rtx_REG (word_mode, REGNO (scratch_reg));
scratch_reg = force_mode (word_mode, scratch_reg);
emit_move_insn (scratch_reg, XEXP (XEXP (operand1, 0), 1));
emit_move_insn (scratch_reg, gen_rtx_fmt_ee (GET_CODE (XEXP (operand1,
......@@ -1368,7 +1385,7 @@ emit_move_sequence (operands, mode, scratch_reg)
we want to load it in the same width as the original MEM,
which must be the same as the width of the ultimate destination,
OPERAND0. */
scratch_reg = gen_rtx_REG (GET_MODE (operand0), REGNO (scratch_reg));
scratch_reg = force_mode (GET_MODE (operand0), scratch_reg);
emit_move_insn (scratch_reg, gen_rtx_MEM (GET_MODE (operand0),
scratch_reg));
......@@ -1377,7 +1394,8 @@ emit_move_sequence (operands, mode, scratch_reg)
{
/* We want to load the scratch register using the same mode as
the ultimate destination. */
scratch_reg = gen_rtx_REG (GET_MODE (operand0), REGNO (scratch_reg));
scratch_reg = force_mode (GET_MODE (operand0), scratch_reg);
emit_move_insn (scratch_reg, operand1);
}
......@@ -1464,7 +1482,7 @@ emit_move_sequence (operands, mode, scratch_reg)
/* SCRATCH_REG will hold an address and maybe the actual
data. We want it in WORD_MODE regardless of what mode it
was originally given to us. */
scratch_reg = gen_rtx_REG (word_mode, REGNO (scratch_reg));
scratch_reg = force_mode (word_mode, scratch_reg);
}
else if (flag_pic)
scratch_reg = gen_reg_rtx (Pmode);
......@@ -1522,7 +1540,7 @@ emit_move_sequence (operands, mode, scratch_reg)
/* TEMP will hold an address and maybe the actual
data. We want it in WORD_MODE regardless of what mode it
was originally given to us. */
temp = gen_rtx_REG (word_mode, REGNO (temp));
temp = force_mode (word_mode, temp);
}
else
temp = gen_reg_rtx (Pmode);
......@@ -1561,7 +1579,7 @@ emit_move_sequence (operands, mode, scratch_reg)
/* TEMP will hold an address and maybe the actual
data. We want it in WORD_MODE regardless of what mode it
was originally given to us. */
temp = gen_rtx_REG (word_mode, REGNO (temp));
temp = force_mode (word_mode, temp);
}
else
temp = gen_reg_rtx (mode);
......
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