The set of fixed registers is adjusted by the TARGET_CONDITIONAL_REGISTER_USAGE hook, but this needs to be done on a per-function basis, whereas the hook is normally called once during GCC initialization before any functions have been processed (which means the majority of the current implementation is actually dead code!). I have added a call to reinit_regs in gcn_init_cumulative_args to setup the available registers for each function.

Okay for trunk?

Kwok

2019-11-14  Kwok Cheung Yeung  <k...@codesourcery.com>

        gcc/
        * config/gcn/gcn.c (gcn_init_cumulative_args): Call reinit_regs.
---
 gcc/config/gcn/gcn.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gcc/config/gcn/gcn.c b/gcc/config/gcn/gcn.c
index 2c08771..09dfabb 100644
--- a/gcc/config/gcn/gcn.c
+++ b/gcc/config/gcn/gcn.c
@@ -2434,6 +2434,8 @@ gcn_init_cumulative_args (CUMULATIVE_ARGS *cum /* Argument info to init */ ,
   cfun->machine->args = cum->args;
   if (!caller && cfun->machine->normal_function)
     gcn_detect_incoming_pointer_arg (fndecl);
+
+  reinit_regs ();
 }

 static bool
--
2.8.1

Reply via email to