diff options
Diffstat (limited to 'gcc/ada/gcc-interface')
-rw-r--r-- | gcc/ada/gcc-interface/ada-tree.h | 35 | ||||
-rw-r--r-- | gcc/ada/gcc-interface/decl.c | 2 | ||||
-rw-r--r-- | gcc/ada/gcc-interface/misc.c | 2 | ||||
-rw-r--r-- | gcc/ada/gcc-interface/trans.c | 12 | ||||
-rw-r--r-- | gcc/ada/gcc-interface/utils.c | 10 |
5 files changed, 31 insertions, 30 deletions
diff --git a/gcc/ada/gcc-interface/ada-tree.h b/gcc/ada/gcc-interface/ada-tree.h index 60a5595..220ed57 100644 --- a/gcc/ada/gcc-interface/ada-tree.h +++ b/gcc/ada/gcc-interface/ada-tree.h @@ -32,32 +32,37 @@ union GTY((desc ("0"), desc ("tree_node_structure (&%h)"))) generic; }; -/* Ada uses the lang_decl and lang_type fields to hold a tree. */ -struct GTY(()) lang_type { tree t; }; -struct GTY(()) lang_decl { tree t; }; +/* Ada uses the lang_decl and lang_type fields to hold a tree. + FIXME: the variable_size annotation here is needed because these types are + variable-sized in some other frontends. Due to gengtype deficiency the GTY + options of such types have to agree across all frontends. */ +struct GTY((variable_size)) lang_type { tree t; }; +struct GTY((variable_size)) lang_decl { tree t; }; /* Macros to get and set the tree in TYPE_LANG_SPECIFIC. */ #define GET_TYPE_LANG_SPECIFIC(NODE) \ (TYPE_LANG_SPECIFIC (NODE) ? TYPE_LANG_SPECIFIC (NODE)->t : NULL_TREE) -#define SET_TYPE_LANG_SPECIFIC(NODE, X) \ -do { \ - tree tmp = (X); \ - if (!TYPE_LANG_SPECIFIC (NODE)) \ - TYPE_LANG_SPECIFIC (NODE) = GGC_NEW (struct lang_type); \ - TYPE_LANG_SPECIFIC (NODE)->t = tmp; \ +#define SET_TYPE_LANG_SPECIFIC(NODE, X) \ +do { \ + tree tmp = (X); \ + if (!TYPE_LANG_SPECIFIC (NODE)) \ + TYPE_LANG_SPECIFIC (NODE) = ggc_alloc_lang_type \ + (sizeof (struct lang_type)); \ + TYPE_LANG_SPECIFIC (NODE)->t = tmp; \ } while (0) /* Macros to get and set the tree in DECL_LANG_SPECIFIC. */ #define GET_DECL_LANG_SPECIFIC(NODE) \ (DECL_LANG_SPECIFIC (NODE) ? DECL_LANG_SPECIFIC (NODE)->t : NULL_TREE) -#define SET_DECL_LANG_SPECIFIC(NODE, X) \ -do { \ - tree tmp = (X); \ - if (!DECL_LANG_SPECIFIC (NODE)) \ - DECL_LANG_SPECIFIC (NODE) = GGC_NEW (struct lang_decl); \ - DECL_LANG_SPECIFIC (NODE)->t = tmp; \ +#define SET_DECL_LANG_SPECIFIC(NODE, X) \ +do { \ + tree tmp = (X); \ + if (!DECL_LANG_SPECIFIC (NODE)) \ + DECL_LANG_SPECIFIC (NODE) = ggc_alloc_lang_decl \ + (sizeof (struct lang_decl)); \ + DECL_LANG_SPECIFIC (NODE)->t = tmp; \ } while (0) diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index cf9f025..fb4769b 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -7296,7 +7296,7 @@ annotate_value (tree gnu_size) /* Save the result in the cache. */ if (h) { - *h = GGC_NEW (struct tree_int_map); + *h = ggc_alloc_tree_int_map (); (*h)->base.from = gnu_size; (*h)->to = ret; } diff --git a/gcc/ada/gcc-interface/misc.c b/gcc/ada/gcc-interface/misc.c index a80afbd..229663b 100644 --- a/gcc/ada/gcc-interface/misc.c +++ b/gcc/ada/gcc-interface/misc.c @@ -574,7 +574,7 @@ static const char * gnat_printable_name (tree decl, int verbosity) { const char *coded_name = IDENTIFIER_POINTER (DECL_NAME (decl)); - char *ada_name = (char *) ggc_alloc (strlen (coded_name) * 2 + 60); + char *ada_name = (char *) ggc_alloc_atomic (strlen (coded_name) * 2 + 60); __gnat_decode (coded_name, ada_name, 0); diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index 1732069..7a94393 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -1605,7 +1605,7 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute) if (!pa) { - pa = GGC_CNEW (struct parm_attr_d); + pa = ggc_alloc_cleared_parm_attr_d (); pa->id = gnat_param; pa->dim = Dimension; VEC_safe_push (parm_attr, gc, f_parm_attr_cache, pa); @@ -2441,7 +2441,7 @@ Subprogram_Body_to_gnu (Node_Id gnat_node) /* Initialize the information structure for the function. */ allocate_struct_function (gnu_subprog_decl, false); DECL_STRUCT_FUNCTION (gnu_subprog_decl)->language - = GGC_CNEW (struct language_function); + = ggc_alloc_cleared_language_function (); set_cfun (NULL); begin_subprog_body (gnu_subprog_decl); @@ -3626,7 +3626,7 @@ Compilation_Unit_to_gnu (Node_Id gnat_node) /* Save away what we've made so far and record this potential elaboration procedure. */ - info = (struct elab_info *) ggc_alloc (sizeof (struct elab_info)); + info = ggc_alloc_elab_info (); set_current_block_context (gnu_elab_proc_decl); gnat_poplevel (); DECL_SAVED_TREE (gnu_elab_proc_decl) = end_stmt_group (); @@ -5722,7 +5722,7 @@ start_stmt_group (void) if (group) stmt_group_free_list = group->previous; else - group = (struct stmt_group *) ggc_alloc (sizeof (struct stmt_group)); + group = ggc_alloc_stmt_group (); group->previous = current_stmt_group; group->stmt_list = group->block = group->cleanups = NULL_TREE; @@ -7498,7 +7498,7 @@ set_expr_location_from_node (tree node, Node_Id gnat_node) static const char * extract_encoding (const char *name) { - char *encoding = GGC_NEWVEC (char, strlen (name)); + char *encoding = (char *) ggc_alloc_atomic (strlen (name)); get_encoding (name, encoding); return encoding; } @@ -7508,7 +7508,7 @@ extract_encoding (const char *name) static const char * decode_name (const char *name) { - char *decoded = GGC_NEWVEC (char, strlen (name) * 2 + 60); + char *decoded = (char *) ggc_alloc_atomic (strlen (name) * 2 + 60); __gnat_decode (name, decoded, 0); return decoded; } diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c index f10b788..ebb7025 100644 --- a/gcc/ada/gcc-interface/utils.c +++ b/gcc/ada/gcc-interface/utils.c @@ -206,8 +206,7 @@ static void process_attributes (tree, struct attrib *); void init_gnat_to_gnu (void) { - associate_gnat_to_gnu - = (tree *) ggc_alloc_cleared (max_gnat_nodes * sizeof (tree)); + associate_gnat_to_gnu = ggc_alloc_cleared_vec_tree (max_gnat_nodes); } /* GNAT_ENTITY is a GNAT tree node for an entity. GNU_DECL is the GCC tree @@ -257,8 +256,7 @@ present_gnu_tree (Entity_Id gnat_entity) void init_dummy_type (void) { - dummy_node_table - = (tree *) ggc_alloc_cleared (max_gnat_nodes * sizeof (tree)); + dummy_node_table = ggc_alloc_cleared_vec_tree (max_gnat_nodes); } /* Make a dummy type corresponding to GNAT_TYPE. */ @@ -321,9 +319,7 @@ gnat_pushlevel (void) free_binding_level = free_binding_level->chain; } else - newlevel - = (struct gnat_binding_level *) - ggc_alloc (sizeof (struct gnat_binding_level)); + newlevel = ggc_alloc_gnat_binding_level (); /* Use a free BLOCK, if any; otherwise, allocate one. */ if (free_block_chain) |