This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix finding reg-sets of call insn in collect_fn_hard_reg_usage


Richard,

atm the moment, when processing a call in collect_fn_hard_reg_usage, we get the used regs from the callee, but forget to register the regs in the call insn itself (ouch). This patch fixes this by introducing an extra IOR_HARD_REG_SET.

We also switch the order of find_all_hard_reg_sets and get_call_reg_set_usage. There's no point in doing find_all_hard_reg_sets on a call if get_call_reg_set_usage returns false.

OK for trunk if bootstrap and reg-test on x86_64 is ok ?

Thanks,
- Tom
2014-06-19  Tom de Vries  <tom@codesourcery.com>

	* final.c (collect_fn_hard_reg_usage): Add separate IOR_HARD_REG_SET for
	get_call_reg_set_usage.

diff --git a/gcc/final.c b/gcc/final.c
index e67e84b..bbeb50d 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -4775,12 +4775,16 @@ collect_fn_hard_reg_usage (void)
       if (!NONDEBUG_INSN_P (insn))
 	continue;
 
-      find_all_hard_reg_sets (insn, &insn_used_regs, false);
+      if (CALL_P (insn))
+	{
+	  if (!get_call_reg_set_usage (insn, &insn_used_regs,
+				       call_used_reg_set))
+	    return;
 
-      if (CALL_P (insn)
-	  && !get_call_reg_set_usage (insn, &insn_used_regs, call_used_reg_set))
-	return;
+	  IOR_HARD_REG_SET (function_used_regs, insn_used_regs);
+	}
 
+      find_all_hard_reg_sets (insn, &insn_used_regs, false);
       IOR_HARD_REG_SET (function_used_regs, insn_used_regs);
     }
 
-- 
1.9.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]