This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH][ARM][cleanup] Simplify some expressions in some epilogue-related functions
- From: Kyrill Tkachov <kyrylo dot tkachov at arm dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: Ramana Radhakrishnan <ramana dot radhakrishnan at arm dot com>, Richard Earnshaw <Richard dot Earnshaw at arm dot com>
- Date: Thu, 29 Jan 2015 11:40:25 +0000
- Subject: [PATCH][ARM][cleanup] Simplify some expressions in some epilogue-related functions
- Authentication-results: sourceware.org; auth=none
Hi all,
This is another cleanup patch that simplifies some expressions of the
form (<expr> ? true : false) or if (boolean == true) and other minor
cleanups.
Tested arm-none-eabi.
Ok for trunk? Or should this wait for the next stage?
Thanks,
Kyrill
2015-01-29 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* config/arm/arm.c (arm_emit_multi_reg_pop): Simplify definition of
return_in_pc. Remove redunant assignments.
(thumb2_emit_ldrd_pop): Simplify definition of return_in_pc.
(arm_expand_epilogue): Don't compare boolean with true in if condition.
commit 568374491b4497bd8b122cb31db8ecf2bd8cb43b
Author: Kyrylo Tkachov <kyrylo.tkachov@arm.com>
Date: Fri Nov 28 16:41:02 2014 +0000
[ARM] Clean up multi-ref pop and epilogue functions
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index c9701b7..246298a 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -20273,11 +20273,10 @@ arm_emit_multi_reg_pop (unsigned long saved_regs_mask)
rtx par;
rtx dwarf = NULL_RTX;
rtx tmp, reg;
- bool return_in_pc;
+ bool return_in_pc = saved_regs_mask & (1 << PC_REGNUM);
int offset_adj;
int emit_update;
- return_in_pc = (saved_regs_mask & (1 << PC_REGNUM)) ? true : false;
offset_adj = return_in_pc ? 1 : 0;
for (i = 0; i <= LAST_ARM_REGNUM; i++)
if (saved_regs_mask & (1 << i))
@@ -20293,10 +20292,7 @@ arm_emit_multi_reg_pop (unsigned long saved_regs_mask)
par = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (num_regs + emit_update + offset_adj));
if (return_in_pc)
- {
- tmp = ret_rtx;
- XVECEXP (par, 0, 0) = tmp;
- }
+ XVECEXP (par, 0, 0) = ret_rtx;
if (emit_update)
{
@@ -20446,9 +20442,8 @@ thumb2_emit_ldrd_pop (unsigned long saved_regs_mask)
rtx par = NULL_RTX;
rtx dwarf = NULL_RTX;
rtx tmp, reg, tmp1;
- bool return_in_pc;
+ bool return_in_pc = saved_regs_mask & (1 << PC_REGNUM);
- return_in_pc = (saved_regs_mask & (1 << PC_REGNUM)) ? true : false;
for (i = 0; i <= LAST_ARM_REGNUM; i++)
if (saved_regs_mask & (1 << i))
num_regs++;
@@ -25230,7 +25225,7 @@ arm_expand_epilogue (bool really_return)
arm_emit_multi_reg_pop (saved_regs_mask);
}
- if (return_in_pc == true)
+ if (return_in_pc)
return;
}