]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
target-globals.c (save_target_globals): Allocate < 4KB structs using GC in payload...
authorJakub Jelinek <jakub@redhat.com>
Fri, 10 Jan 2014 20:25:05 +0000 (21:25 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 10 Jan 2014 20:25:05 +0000 (21:25 +0100)
* target-globals.c (save_target_globals): Allocate < 4KB structs using
GC in payload of target_globals struct instead of allocating them on
the heap and the larger structs separately using GC.
* target-globals.h (struct target_globals): Make regs, hard_regs,
reload, expmed, ira, ira_int and lra_fields GTY((atomic)) instead
of GTY((skip)) and change type to void *.
(reset_target_globals): Cast loads from those fields to corresponding
types.

From-SVN: r206539

gcc/ChangeLog
gcc/target-globals.c
gcc/target-globals.h

index edc43e404b29fa010a7663ae216957a2b1516d5e..6be05570c14a93602164362f253e2d1bf4225ad3 100644 (file)
@@ -1,3 +1,14 @@
+2014-01-10  Jakub Jelinek  <jakub@redhat.com>
+
+       * target-globals.c (save_target_globals): Allocate < 4KB structs using
+       GC in payload of target_globals struct instead of allocating them on
+       the heap and the larger structs separately using GC.
+       * target-globals.h (struct target_globals): Make regs, hard_regs,
+       reload, expmed, ira, ira_int and lra_fields GTY((atomic)) instead
+       of GTY((skip)) and change type to void *.
+       (reset_target_globals): Cast loads from those fields to corresponding
+       types.
+
 2014-01-10  Steve Ellcey  <sellcey@mips.com>
 
        PR plugins/59335
index f2281ddba04a73e09de801f40e518c28b6c53e53..8d3eaa89041e5479c020c0e18cb2eedb36069110 100644 (file)
@@ -68,24 +68,44 @@ struct target_globals *
 save_target_globals (void)
 {
   struct target_globals *g;
-
-  g = ggc_alloc_target_globals ();
-  g->flag_state = XCNEW (struct target_flag_state);
-  g->regs = XCNEW (struct target_regs);
+  struct target_globals_extra {
+    struct target_globals g;
+    struct target_flag_state flag_state;
+    struct target_optabs optabs;
+    struct target_cfgloop cfgloop;
+    struct target_builtins builtins;
+    struct target_gcse gcse;
+    struct target_bb_reorder bb_reorder;
+    struct target_lower_subreg lower_subreg;
+  } *p;
+  p = (struct target_globals_extra *)
+      ggc_internal_cleared_alloc_stat (sizeof (struct target_globals_extra)
+                                      PASS_MEM_STAT);
+  g = (struct target_globals *) p;
+  g->flag_state = &p->flag_state;
+  g->regs = ggc_internal_cleared_alloc_stat (sizeof (struct target_regs)
+                                            PASS_MEM_STAT);
   g->rtl = ggc_alloc_cleared_target_rtl ();
-  g->hard_regs = XCNEW (struct target_hard_regs);
-  g->reload = XCNEW (struct target_reload);
-  g->expmed = XCNEW (struct target_expmed);
-  g->optabs = XCNEW (struct target_optabs);
+  g->hard_regs
+    = ggc_internal_cleared_alloc_stat (sizeof (struct target_hard_regs)
+                                      PASS_MEM_STAT);
+  g->reload = ggc_internal_cleared_alloc_stat (sizeof (struct target_reload)
+                                              PASS_MEM_STAT);
+  g->expmed =  ggc_internal_cleared_alloc_stat (sizeof (struct target_expmed)
+                                               PASS_MEM_STAT);
+  g->optabs = &p->optabs;
   g->libfuncs = ggc_alloc_cleared_target_libfuncs ();
-  g->cfgloop = XCNEW (struct target_cfgloop);
-  g->ira = XCNEW (struct target_ira);
-  g->ira_int = XCNEW (struct target_ira_int);
-  g->lra_int = XCNEW (struct target_lra_int);
-  g->builtins = XCNEW (struct target_builtins);
-  g->gcse = XCNEW (struct target_gcse);
-  g->bb_reorder = XCNEW (struct target_bb_reorder);
-  g->lower_subreg = XCNEW (struct target_lower_subreg);
+  g->cfgloop = &p->cfgloop;
+  g->ira = ggc_internal_cleared_alloc_stat (sizeof (struct target_ira)
+                                           PASS_MEM_STAT);
+  g->ira_int = ggc_internal_cleared_alloc_stat (sizeof (struct target_ira_int)
+                                               PASS_MEM_STAT);
+  g->lra_int = ggc_internal_cleared_alloc_stat (sizeof (struct target_lra_int)
+                                               PASS_MEM_STAT);
+  g->builtins = &p->builtins;
+  g->gcse = &p->gcse;
+  g->bb_reorder = &p->bb_reorder;
+  g->lower_subreg = &p->lower_subreg;
   restore_target_globals (g);
   init_reg_sets ();
   target_reinit ();
index cc7eeff1d211b8fea37b4060d1cafffc856a50d6..e848a01677c08127b66f17506e671d0dc879c5f2 100644 (file)
@@ -41,17 +41,17 @@ extern struct target_lower_subreg *this_target_lower_subreg;
 
 struct GTY(()) target_globals {
   struct target_flag_state *GTY((skip)) flag_state;
-  struct target_regs *GTY((skip)) regs;
+  void *GTY((atomic)) regs;
   struct target_rtl *rtl;
-  struct target_hard_regs *GTY((skip)) hard_regs;
-  struct target_reload *GTY((skip)) reload;
-  struct target_expmed *GTY((skip)) expmed;
+  void *GTY((atomic)) hard_regs;
+  void *GTY((atomic)) reload;
+  void *GTY((atomic)) expmed;
   struct target_optabs *GTY((skip)) optabs;
   struct target_libfuncs *libfuncs;
   struct target_cfgloop *GTY((skip)) cfgloop;
-  struct target_ira *GTY((skip)) ira;
-  struct target_ira_int *GTY((skip)) ira_int;
-  struct target_lra_int *GTY((skip)) lra_int;
+  void *GTY((atomic)) ira;
+  void *GTY((atomic)) ira_int;
+  void *GTY((atomic)) lra_int;
   struct target_builtins *GTY((skip)) builtins;
   struct target_gcse *GTY((skip)) gcse;
   struct target_bb_reorder *GTY((skip)) bb_reorder;
@@ -68,17 +68,17 @@ static inline void
 restore_target_globals (struct target_globals *g)
 {
   this_target_flag_state = g->flag_state;
-  this_target_regs = g->regs;
+  this_target_regs = (struct target_regs *) g->regs;
   this_target_rtl = g->rtl;
-  this_target_hard_regs = g->hard_regs;
-  this_target_reload = g->reload;
-  this_target_expmed = g->expmed;
+  this_target_hard_regs = (struct target_hard_regs *) g->hard_regs;
+  this_target_reload = (struct target_reload *) g->reload;
+  this_target_expmed = (struct target_expmed *) g->expmed;
   this_target_optabs = g->optabs;
   this_target_libfuncs = g->libfuncs;
   this_target_cfgloop = g->cfgloop;
-  this_target_ira = g->ira;
-  this_target_ira_int = g->ira_int;
-  this_target_lra_int = g->lra_int;
+  this_target_ira = (struct target_ira *) g->ira;
+  this_target_ira_int = (struct target_ira_int *) g->ira_int;
+  this_target_lra_int = (struct target_lra_int *) g->lra_int;
   this_target_builtins = g->builtins;
   this_target_gcse = g->gcse;
   this_target_bb_reorder = g->bb_reorder;