aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2014-01-10 21:25:05 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2014-01-10 21:25:05 +0100
commit5da969605f3461b0df9cbf950a5fc59841a83dde (patch)
tree97abae3357143c7989f23093f58cb9246fa0e2c6 /gcc
parent322b9977d28bbb783c26417ab5f9cfb4cc91e07d (diff)
downloadgcc-5da969605f3461b0df9cbf950a5fc59841a83dde.zip
gcc-5da969605f3461b0df9cbf950a5fc59841a83dde.tar.gz
gcc-5da969605f3461b0df9cbf950a5fc59841a83dde.tar.bz2
target-globals.c (save_target_globals): Allocate < 4KB structs using GC in payload of target_globals struct instead of...
* 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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog11
-rw-r--r--gcc/target-globals.c52
-rw-r--r--gcc/target-globals.h28
3 files changed, 61 insertions, 30 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index edc43e4..6be0557 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/target-globals.c b/gcc/target-globals.c
index f2281dd..8d3eaa8 100644
--- a/gcc/target-globals.c
+++ b/gcc/target-globals.c
@@ -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 ();
diff --git a/gcc/target-globals.h b/gcc/target-globals.h
index cc7eeff..e848a01 100644
--- a/gcc/target-globals.h
+++ b/gcc/target-globals.h
@@ -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;