[09/32] Remove global call sets: cfgloopanal.c
diff mbox series

Message ID mptftl2y7l7.fsf@arm.com
State New
Headers show
Series
  • Support multiple ABIs in the same translation unit
Related show

Commit Message

Richard Sandiford Sept. 11, 2019, 7:08 p.m. UTC
...or rather, make the use of the default ABI explicit.  That seems
OK if not ideal for this heuristic.

In practical terms, the code patched here is counting GENERAL_REGS,
which are treated in the same way by all concurrent ABI variants
on AArch64.  It might give bad results if used for interrupt
handlers though.


2019-09-11  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	* cfgloopanal.c: Include regs.h and function-abi.h.
	(init_set_costs): Use default_function_abi to test whether
	a general register is call-clobbered.

Patch
diff mbox series

Index: gcc/cfgloopanal.c
===================================================================
--- gcc/cfgloopanal.c	2019-09-10 19:56:45.313178201 +0100
+++ gcc/cfgloopanal.c	2019-09-11 19:47:53.946054595 +0100
@@ -32,6 +32,8 @@  Software Foundation; either version 3, o
 #include "graphds.h"
 #include "params.h"
 #include "sreal.h"
+#include "regs.h"
+#include "function-abi.h"
 
 struct target_cfgloop default_target_cfgloop;
 #if SWITCHABLE_TARGET
@@ -353,7 +355,10 @@  init_set_costs (void)
 	&& !fixed_regs[i])
       {
 	target_avail_regs++;
-	if (call_used_or_fixed_reg_p (i))
+	/* ??? This is only a rough heuristic.  It doesn't cope well
+	   with alternative ABIs, but that's an optimization rather than
+	   correctness issue.  */
+	if (default_function_abi.clobbers_full_reg_p (i))
 	  target_clobbered_regs++;
       }