aboutsummaryrefslogtreecommitdiff
path: root/gcc/optabs.c
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@linaro.org>2011-04-12 14:56:57 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2011-04-12 14:56:57 +0000
commit28569ac3d4f3a80bad00c77bae72d82c4f963539 (patch)
treecc03e3af6c23aedc2d35dd550a24766687e4b0e5 /gcc/optabs.c
parentae59e00d17e296ccdaa5829ced97342bcf09971d (diff)
downloadgcc-28569ac3d4f3a80bad00c77bae72d82c4f963539.zip
gcc-28569ac3d4f3a80bad00c77bae72d82c4f963539.tar.gz
gcc-28569ac3d4f3a80bad00c77bae72d82c4f963539.tar.bz2
* recog.h, genoutput.c, optabs.c: Revert last patch.
From-SVN: r172321
Diffstat (limited to 'gcc/optabs.c')
-rw-r--r--gcc/optabs.c61
1 files changed, 15 insertions, 46 deletions
diff --git a/gcc/optabs.c b/gcc/optabs.c
index 15f50f7..682b8e4 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -7001,36 +7001,6 @@ insn_operand_matches (enum insn_code icode, unsigned int opno, rtx operand)
(operand, insn_data[(int) icode].operand[opno].mode)));
}
-/* Like maybe_legitimize_operand, but do not change the code of the
- current rtx value. */
-
-static bool
-maybe_legitimize_operand_same_code (enum insn_code icode, unsigned int opno,
- struct expand_operand *op)
-{
- /* See if the operand matches in its current form. */
- if (insn_operand_matches (icode, opno, op->value))
- return true;
-
- /* If the operand is a memory, try forcing the address into a register. */
- if (MEM_P (op->value) && insn_data[(int) icode].operand[opno].allows_mem)
- {
- rtx addr, mem, last;
-
- last = get_last_insn ();
- addr = force_reg (Pmode, XEXP (op->value, 0));
- mem = replace_equiv_address (op->value, addr);
- if (insn_operand_matches (icode, opno, mem))
- {
- op->value = mem;
- return true;
- }
- delete_insns_since (last);
- }
-
- return false;
-}
-
/* Try to make OP match operand OPNO of instruction ICODE. Return true
on success, storing the new operand value back in OP. */
@@ -7041,25 +7011,22 @@ maybe_legitimize_operand (enum insn_code icode, unsigned int opno,
enum machine_mode mode, imode;
bool old_volatile_ok, result;
+ old_volatile_ok = volatile_ok;
mode = op->mode;
+ result = false;
switch (op->type)
{
case EXPAND_FIXED:
- old_volatile_ok = volatile_ok;
volatile_ok = true;
- result = maybe_legitimize_operand_same_code (icode, opno, op);
- volatile_ok = old_volatile_ok;
- return result;
+ break;
case EXPAND_OUTPUT:
gcc_assert (mode != VOIDmode);
- if (op->value
- && op->value != const0_rtx
- && GET_MODE (op->value) == mode
- && maybe_legitimize_operand_same_code (icode, opno, op))
- return true;
-
- op->value = gen_reg_rtx (mode);
+ if (!op->value
+ || op->value == const0_rtx
+ || GET_MODE (op->value) != mode
+ || !insn_operand_matches (icode, opno, op->value))
+ op->value = gen_reg_rtx (mode);
break;
case EXPAND_INPUT:
@@ -7067,10 +7034,9 @@ maybe_legitimize_operand (enum insn_code icode, unsigned int opno,
gcc_assert (mode != VOIDmode);
gcc_assert (GET_MODE (op->value) == VOIDmode
|| GET_MODE (op->value) == mode);
- if (maybe_legitimize_operand_same_code (icode, opno, op))
- return true;
-
- op->value = copy_to_mode_reg (mode, op->value);
+ result = insn_operand_matches (icode, opno, op->value);
+ if (!result)
+ op->value = copy_to_mode_reg (mode, op->value);
break;
case EXPAND_CONVERT_TO:
@@ -7104,7 +7070,10 @@ maybe_legitimize_operand (enum insn_code icode, unsigned int opno,
goto input;
break;
}
- return insn_operand_matches (icode, opno, op->value);
+ if (!result)
+ result = insn_operand_matches (icode, opno, op->value);
+ volatile_ok = old_volatile_ok;
+ return result;
}
/* Make OP describe an input operand that should have the same value