[2/5,amdgcn] Reinitialize registers for every function
diff mbox series

Message ID 1029c8c6-41fe-4fca-bd49-f3a089f8b5d7@codesourcery.com
State New
Headers show
Series
  • Reduce register usage on AMD GCN
Related show

Commit Message

Kwok Cheung Yeung Nov. 14, 2019, 3:30 p.m. UTC
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  <kcy@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(+)

  static bool

Comments

Andrew Stubbs Nov. 15, 2019, 10:57 a.m. UTC | #1
On 14/11/2019 15:30, Kwok Cheung Yeung wrote:
> 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?

I'm a bit concerned that this sort of thing will break if/when the 
parallel GCC becomes a thing, but I don't see a better way right now, 
and we do need this to work.

OK.

Andrew

Patch
diff mbox series

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 ();
  }