vax-protos.h (reg_was_0_p): New prototype.

* vax-protos.h (reg_was_0_p): New prototype.
	* vax.md (movsi, movhi, movqi): Use reg_was_0_p.
	* vax.c (follows_p, reg_was_0_p): New functions.

From-SVN: r47110
This commit is contained in:
John David Anglin 2001-11-16 22:40:21 +00:00 committed by John David Anglin
parent 550b2951cd
commit 268399cd7f
4 changed files with 47 additions and 30 deletions

View File

@ -1,3 +1,9 @@
2001-11-16 John David Anglin <dave@hiauly1.hia.nrc.ca>
* vax-protos.h (reg_was_0_p): New prototype.
* vax.md (movsi, movhi, movqi): Use reg_was_0_p.
* vax.c (follows_p, reg_was_0_p): New functions.
2001-11-16 John David Anglin <dave@hiauly1.hia.nrc.ca>
* vax.md (casesi): Swap arguments in "(plus:SI (pc) (mult))". Reformat.

View File

@ -25,6 +25,7 @@ extern void print_operand_address PARAMS ((FILE *, rtx));
extern int vax_float_literal PARAMS ((rtx));
extern int vax_address_cost PARAMS ((rtx));
extern int vax_rtx_cost PARAMS ((rtx));
extern int reg_was_0_p PARAMS ((rtx, rtx));
#endif /* RTX_CODE */
#ifdef REAL_VALUE_TYPE

View File

@ -37,6 +37,7 @@ Boston, MA 02111-1307, USA. */
#include "target.h"
#include "target-def.h"
static int follows_p PARAMS ((rtx, rtx));
static void vax_output_function_prologue PARAMS ((FILE *, HOST_WIDE_INT));
#if VMS_TARGET
static void vms_asm_out_constructor PARAMS ((rtx, int));
@ -946,3 +947,38 @@ not_qsort (array, count, size, compare)
return;
}
#endif /* QSORT_WORKAROUND */
/* Return 1 if insn A follows B. */
static int
follows_p (a, b)
rtx a, b;
{
register rtx p;
for (p = a; p != b; p = NEXT_INSN (p))
if (! p)
return 1;
return 0;
}
/* Returns 1 if we know operand OP was 0 before INSN. */
int
reg_was_0_p (insn, op)
rtx insn, op;
{
rtx link;
return ((link = find_reg_note (insn, REG_WAS_0, 0))
/* Make sure the insn that stored the 0 is still present
and doesn't follow INSN in the insn sequence. */
&& ! INSN_DELETED_P (XEXP (link, 0))
&& GET_CODE (XEXP (link, 0)) != NOTE
&& ! follows_p (XEXP (link, 0), insn)
/* Make sure cross jumping didn't happen here. */
&& no_labels_between_p (XEXP (link, 0), insn)
/* Make sure the reg hasn't been clobbered. */
&& ! reg_set_between_p (op, XEXP (link, 0), insn));
}

View File

@ -184,17 +184,9 @@
""
"*
{
rtx link;
if (operands[1] == const1_rtx
&& (link = find_reg_note (insn, REG_WAS_0, 0))
/* Make sure the insn that stored the 0 is still present. */
&& ! INSN_DELETED_P (XEXP (link, 0))
&& GET_CODE (XEXP (link, 0)) != NOTE
/* Make sure cross jumping didn't happen here. */
&& no_labels_between_p (XEXP (link, 0), insn)
/* Make sure the reg hasn't been clobbered. */
&& ! reg_set_between_p (operands[0], XEXP (link, 0), insn))
if (operands[1] == const1_rtx && reg_was_0_p (insn, operands[0]))
return \"incl %0\";
if (GET_CODE (operands[1]) == SYMBOL_REF || GET_CODE (operands[1]) == CONST)
{
if (push_operand (operands[0], SImode))
@ -229,16 +221,7 @@
""
"*
{
rtx link;
if (operands[1] == const1_rtx
&& (link = find_reg_note (insn, REG_WAS_0, 0))
/* Make sure the insn that stored the 0 is still present. */
&& ! INSN_DELETED_P (XEXP (link, 0))
&& GET_CODE (XEXP (link, 0)) != NOTE
/* Make sure cross jumping didn't happen here. */
&& no_labels_between_p (XEXP (link, 0), insn)
/* Make sure the reg hasn't been clobbered. */
&& ! reg_set_between_p (operands[0], XEXP (link, 0), insn))
if (operands[1] == const1_rtx && reg_was_0_p (insn, operands[0]))
return \"incw %0\";
if (GET_CODE (operands[1]) == CONST_INT)
@ -283,16 +266,7 @@
""
"*
{
rtx link;
if (operands[1] == const1_rtx
&& (link = find_reg_note (insn, REG_WAS_0, 0))
/* Make sure the insn that stored the 0 is still present. */
&& ! INSN_DELETED_P (XEXP (link, 0))
&& GET_CODE (XEXP (link, 0)) != NOTE
/* Make sure cross jumping didn't happen here. */
&& no_labels_between_p (XEXP (link, 0), insn)
/* Make sure the reg hasn't been clobbered. */
&& ! reg_set_between_p (operands[0], XEXP (link, 0), insn))
if (operands[1] == const1_rtx && reg_was_0_p (insn, operands[0]))
return \"incb %0\";
if (GET_CODE (operands[1]) == CONST_INT)