diff options
Diffstat (limited to 'gcc/auto-inc-dec.c')
-rw-r--r-- | gcc/auto-inc-dec.c | 34 |
1 files changed, 6 insertions, 28 deletions
diff --git a/gcc/auto-inc-dec.c b/gcc/auto-inc-dec.c index 3241ed7..df522293 100644 --- a/gcc/auto-inc-dec.c +++ b/gcc/auto-inc-dec.c @@ -767,28 +767,6 @@ get_next_ref (int regno, basic_block bb, rtx_insn **next_array) } -/* Reverse the operands in a mem insn. */ - -static void -reverse_mem (void) -{ - rtx tmp = mem_insn.reg1; - mem_insn.reg1 = mem_insn.reg0; - mem_insn.reg0 = tmp; -} - - -/* Reverse the operands in a inc insn. */ - -static void -reverse_inc (void) -{ - rtx tmp = inc_insn.reg1; - inc_insn.reg1 = inc_insn.reg0; - inc_insn.reg0 = tmp; -} - - /* Return true if INSN is of a form "a = b op c" where a and b are regs. op is + if c is a reg and +|- if c is a const. Fill in INC_INSN with what is found. @@ -857,7 +835,7 @@ parse_add_or_inc (rtx_insn *insn, bool before_mem) { /* Reverse the two operands and turn *_ADD into *_INC since a = c + a. */ - reverse_inc (); + std::swap (inc_insn.reg0, inc_insn.reg1); inc_insn.form = before_mem ? FORM_PRE_INC : FORM_POST_INC; return true; } @@ -1017,7 +995,7 @@ find_inc (bool first_try) find this. Only try it once though. */ if (first_try && !mem_insn.reg1_is_const) { - reverse_mem (); + std::swap (mem_insn.reg0, mem_insn.reg1); return find_inc (false); } else @@ -1118,7 +1096,7 @@ find_inc (bool first_try) return false; if (!rtx_equal_p (mem_insn.reg0, inc_insn.reg0)) - reverse_inc (); + std::swap (inc_insn.reg0, inc_insn.reg1); } other_insn @@ -1168,7 +1146,7 @@ find_inc (bool first_try) /* See comment above on find_inc (false) call. */ if (first_try) { - reverse_mem (); + std::swap (mem_insn.reg0, mem_insn.reg1); return find_inc (false); } else @@ -1187,7 +1165,7 @@ find_inc (bool first_try) { /* We know that mem_insn.reg0 must equal inc_insn.reg1 or else we would not have found the inc insn. */ - reverse_mem (); + std::swap (mem_insn.reg0, mem_insn.reg1); if (!rtx_equal_p (mem_insn.reg0, inc_insn.reg0)) { /* See comment above on find_inc (false) call. */ @@ -1226,7 +1204,7 @@ find_inc (bool first_try) { if (first_try) { - reverse_mem (); + std::swap (mem_insn.reg0, mem_insn.reg1); return find_inc (false); } else |