diff options
Diffstat (limited to 'gcc/config')
-rw-r--r-- | gcc/config/bfin/bfin.c | 8 | ||||
-rw-r--r-- | gcc/config/c6x/c6x.c | 43 | ||||
-rw-r--r-- | gcc/config/darwin.c | 28 | ||||
-rw-r--r-- | gcc/config/epiphany/resolve-sw-modes.c | 14 | ||||
-rw-r--r-- | gcc/config/i386/i386.c | 20 | ||||
-rw-r--r-- | gcc/config/ia64/ia64.c | 27 | ||||
-rw-r--r-- | gcc/config/mep/mep.c | 86 | ||||
-rw-r--r-- | gcc/config/mips/mips.c | 19 | ||||
-rw-r--r-- | gcc/config/pa/pa.c | 47 | ||||
-rw-r--r-- | gcc/config/rs6000/rs6000-c.c | 26 | ||||
-rw-r--r-- | gcc/config/rs6000/rs6000.c | 16 | ||||
-rw-r--r-- | gcc/config/rx/rx.c | 70 | ||||
-rw-r--r-- | gcc/config/spu/spu-c.c | 6 | ||||
-rw-r--r-- | gcc/config/vms/vms.c | 4 | ||||
-rw-r--r-- | gcc/config/vxworks.c | 9 |
15 files changed, 204 insertions, 219 deletions
diff --git a/gcc/config/bfin/bfin.c b/gcc/config/bfin/bfin.c index 2c01cf7a092..f2d8473946e 100644 --- a/gcc/config/bfin/bfin.c +++ b/gcc/config/bfin/bfin.c @@ -3480,8 +3480,8 @@ hwloop_optimize (hwloop_info loop) insn = BB_END (loop->incoming_src); /* If we have to insert the LSETUP before a jump, count that jump in the length. */ - if (VEC_length (edge, loop->incoming) > 1 - || !(VEC_last (edge, loop->incoming)->flags & EDGE_FALLTHRU)) + if (vec_safe_length (loop->incoming) > 1 + || !(loop->incoming->last ()->flags & EDGE_FALLTHRU)) { gcc_assert (JUMP_P (insn)); insn = PREV_INSN (insn); @@ -3749,8 +3749,8 @@ hwloop_optimize (hwloop_info loop) if (loop->incoming_src) { rtx prev = BB_END (loop->incoming_src); - if (VEC_length (edge, loop->incoming) > 1 - || !(VEC_last (edge, loop->incoming)->flags & EDGE_FALLTHRU)) + if (vec_safe_length (loop->incoming) > 1 + || !(loop->incoming->last ()->flags & EDGE_FALLTHRU)) { gcc_assert (JUMP_P (prev)); prev = PREV_INSN (prev); diff --git a/gcc/config/c6x/c6x.c b/gcc/config/c6x/c6x.c index 32807d8eaca..175e119b688 100644 --- a/gcc/config/c6x/c6x.c +++ b/gcc/config/c6x/c6x.c @@ -119,14 +119,12 @@ typedef struct unsigned int unit_mask; } c6x_sched_insn_info; -DEF_VEC_O(c6x_sched_insn_info); -DEF_VEC_ALLOC_O(c6x_sched_insn_info, heap); /* Record a c6x_sched_insn_info structure for every insn in the function. */ -static VEC(c6x_sched_insn_info, heap) *insn_info; +static vec<c6x_sched_insn_info> insn_info; -#define INSN_INFO_LENGTH (VEC_length (c6x_sched_insn_info, insn_info)) -#define INSN_INFO_ENTRY(N) (VEC_index (c6x_sched_insn_info, insn_info, (N))) +#define INSN_INFO_LENGTH (insn_info).length () +#define INSN_INFO_ENTRY(N) (insn_info[(N)]) static bool done_cfi_sections; @@ -1971,7 +1969,7 @@ c6x_get_unit_specifier (rtx insn) { enum attr_units units; - if (insn_info) + if (insn_info.exists ()) { int unit = INSN_INFO_ENTRY (INSN_UID (insn)).reservation; return c6x_unit_names[unit][0]; @@ -2023,7 +2021,7 @@ c6x_print_unit_specifier_field (FILE *file, rtx insn) return; } - if (insn_info) + if (insn_info.exists ()) { int unit = INSN_INFO_ENTRY (INSN_UID (insn)).reservation; fputs (".", file); @@ -3422,7 +3420,7 @@ try_rename_operands (rtx head, rtx tail, unit_req_table reqs, rtx insn, int i; unsigned tmp_mask; int best_reg, old_reg; - VEC (du_head_p, heap) *involved_chains = NULL; + vec<du_head_p> involved_chains = vec<du_head_p>(); unit_req_table new_reqs; for (i = 0, tmp_mask = op_mask; tmp_mask; i++) @@ -3433,14 +3431,14 @@ try_rename_operands (rtx head, rtx tail, unit_req_table reqs, rtx insn, if (info->op_info[i].n_chains != 1) goto out_fail; op_chain = regrename_chain_from_id (info->op_info[i].heads[0]->id); - VEC_safe_push (du_head_p, heap, involved_chains, op_chain); + involved_chains.safe_push (op_chain); tmp_mask &= ~(1 << i); } - if (VEC_length (du_head_p, involved_chains) > 1) + if (involved_chains.length () > 1) goto out_fail; - this_head = VEC_index (du_head_p, involved_chains, 0); + this_head = involved_chains[0]; if (this_head->cannot_rename) goto out_fail; @@ -3448,8 +3446,7 @@ try_rename_operands (rtx head, rtx tail, unit_req_table reqs, rtx insn, { unsigned int mask1, mask2, mask_changed; int count, side1, side2, req1, req2; - insn_rr_info *this_rr = &VEC_index (insn_rr_info, insn_rr, - INSN_UID (chain->insn)); + insn_rr_info *this_rr = &insn_rr[INSN_UID (chain->insn)]; count = get_unit_reqs (chain->insn, &req1, &side1, &req2, &side2); @@ -3508,7 +3505,7 @@ try_rename_operands (rtx head, rtx tail, unit_req_table reqs, rtx insn, memcpy (reqs, new_reqs, sizeof (unit_req_table)); out_fail: - VEC_free (du_head_p, heap, involved_chains); + involved_chains.release (); } /* Find insns in LOOP which would, if shifted to the other side @@ -3555,7 +3552,7 @@ reshuffle_units (basic_block loop) if (!get_unit_operand_masks (insn, &mask1, &mask2)) continue; - info = &VEC_index (insn_rr_info, insn_rr, INSN_UID (insn)); + info = &insn_rr[INSN_UID (insn)]; if (info->op_info == NULL) continue; @@ -3707,7 +3704,7 @@ insn_set_clock (rtx insn, int cycle) unsigned uid = INSN_UID (insn); if (uid >= INSN_INFO_LENGTH) - VEC_safe_grow (c6x_sched_insn_info, heap, insn_info, uid * 5 / 4 + 10); + insn_info.safe_grow (uid * 5 / 4 + 10); INSN_INFO_ENTRY (uid).clock = cycle; INSN_INFO_ENTRY (uid).new_cond = NULL; @@ -4361,7 +4358,7 @@ c6x_variable_issue (FILE *dump ATTRIBUTE_UNUSED, ss.last_scheduled_iter0 = insn; if (GET_CODE (PATTERN (insn)) != USE && GET_CODE (PATTERN (insn)) != CLOBBER) ss.issued_this_cycle++; - if (insn_info) + if (insn_info.exists ()) { state_t st_after = alloca (dfa_state_size); int curr_clock = ss.curr_sched_clock; @@ -5537,7 +5534,7 @@ hwloop_optimize (hwloop_info loop) gcc_assert (loop->incoming_dest == loop->head); entry_edge = NULL; - FOR_EACH_VEC_ELT (edge, loop->incoming, i, entry_edge) + FOR_EACH_VEC_SAFE_ELT (loop->incoming, i, entry_edge) if (entry_edge->flags & EDGE_FALLTHRU) break; if (entry_edge == NULL) @@ -5777,7 +5774,7 @@ hwloop_optimize (hwloop_info loop) seq = get_insns (); - if (!single_succ_p (entry_bb) || VEC_length (edge, loop->incoming) > 1) + if (!single_succ_p (entry_bb) || vec_safe_length (loop->incoming) > 1) { basic_block new_bb; edge e; @@ -5809,7 +5806,7 @@ hwloop_optimize (hwloop_info loop) end_sequence (); /* Make sure we don't try to schedule this loop again. */ - for (ix = 0; VEC_iterate (basic_block, loop->blocks, ix, bb); ix++) + for (ix = 0; loop->blocks.iterate (ix, &bb); ix++) bb->flags |= BB_DISABLE_SCHEDULE; return true; @@ -5928,7 +5925,7 @@ c6x_reorg (void) { int sz = get_max_uid () * 3 / 2 + 1; - insn_info = VEC_alloc (c6x_sched_insn_info, heap, sz); + insn_info.create (sz); } /* Make sure the real-jump insns we create are not deleted. When modulo- @@ -5993,9 +5990,7 @@ c6x_function_end (FILE *file, const char *fname) { c6x_output_fn_unwind (file); - if (insn_info) - VEC_free (c6x_sched_insn_info, heap, insn_info); - insn_info = NULL; + insn_info.release (); if (!flag_inhibit_size_directive) ASM_OUTPUT_MEASURED_SIZE (file, fname); diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c index e56205b5113..6645270a380 100644 --- a/gcc/config/darwin.c +++ b/gcc/config/darwin.c @@ -1791,10 +1791,8 @@ static unsigned int lto_section_num = 0; typedef struct GTY (()) darwin_lto_section_e { const char *sectname; } darwin_lto_section_e ; -DEF_VEC_O(darwin_lto_section_e); -DEF_VEC_ALLOC_O(darwin_lto_section_e, gc); -static GTY (()) VEC (darwin_lto_section_e, gc) * lto_section_names; +static GTY (()) vec<darwin_lto_section_e, va_gc> *lto_section_names; /* Segment for LTO data. */ #define LTO_SEGMENT_NAME "__GNU_LTO" @@ -1877,8 +1875,8 @@ darwin_asm_named_section (const char *name, TODO: check that we do not revisit sections, that would break the assumption of how this is done. */ if (lto_section_names == NULL) - lto_section_names = VEC_alloc (darwin_lto_section_e, gc, 16); - VEC_safe_push (darwin_lto_section_e, gc, lto_section_names, e); + vec_alloc (lto_section_names, 16); + vec_safe_push (lto_section_names, e); } else if (strncmp (name, "__DWARF,", 8) == 0) darwin_asm_dwarf_section (name, flags, decl); @@ -2635,7 +2633,7 @@ darwin_assemble_visibility (tree decl, int vis) "not supported in this configuration; ignored"); } -/* VEC Used by darwin_asm_dwarf_section. +/* vec used by darwin_asm_dwarf_section. Maybe a hash tab would be better here - but the intention is that this is a very short list (fewer than 16 items) and each entry should (ideally, eventually) only be presented once. @@ -2648,11 +2646,9 @@ typedef struct GTY(()) dwarf_sect_used_entry { } dwarf_sect_used_entry; -DEF_VEC_O(dwarf_sect_used_entry); -DEF_VEC_ALLOC_O(dwarf_sect_used_entry, gc); /* A list of used __DWARF sections. */ -static GTY (()) VEC (dwarf_sect_used_entry, gc) * dwarf_sect_names_table; +static GTY (()) vec<dwarf_sect_used_entry, va_gc> *dwarf_sect_names_table; /* This is called when we are asked to assemble a named section and the name begins with __DWARF,. We keep a list of the section names (without @@ -2675,10 +2671,10 @@ darwin_asm_dwarf_section (const char *name, unsigned int flags, namelen = strchr (sname, ',') - sname; gcc_assert (namelen); if (dwarf_sect_names_table == NULL) - dwarf_sect_names_table = VEC_alloc (dwarf_sect_used_entry, gc, 16); + vec_alloc (dwarf_sect_names_table, 16); else for (i = 0; - VEC_iterate (dwarf_sect_used_entry, dwarf_sect_names_table, i, ref); + dwarf_sect_names_table->iterate (i, &ref); i++) { if (!ref) @@ -2698,7 +2694,7 @@ darwin_asm_dwarf_section (const char *name, unsigned int flags, fprintf (asm_out_file, "Lsection%.*s:\n", namelen, sname); e.count = 1; e.name = xstrdup (sname); - VEC_safe_push (dwarf_sect_used_entry, gc, dwarf_sect_names_table, e); + vec_safe_push (dwarf_sect_names_table, e); } } @@ -2813,7 +2809,7 @@ darwin_file_end (void) } /* Output the names and indices. */ - if (lto_section_names && VEC_length (darwin_lto_section_e, lto_section_names)) + if (lto_section_names && lto_section_names->length ()) { int count; darwin_lto_section_e *ref; @@ -2824,7 +2820,7 @@ darwin_file_end (void) /* Emit the names. */ fprintf (asm_out_file, "\t.section %s,%s,regular,debug\n", LTO_SEGMENT_NAME, LTO_NAMES_SECTION); - FOR_EACH_VEC_ELT (darwin_lto_section_e, lto_section_names, count, ref) + FOR_EACH_VEC_ELT (*lto_section_names, count, ref) { fprintf (asm_out_file, "L_GNU_LTO_NAME%d:\n", count); /* We have to jump through hoops to get the values of the intra-section @@ -2847,7 +2843,7 @@ darwin_file_end (void) fputs ("\t.align\t2\n", asm_out_file); fputs ("# Section offset, Section length, Name offset, Name length\n", asm_out_file); - FOR_EACH_VEC_ELT (darwin_lto_section_e, lto_section_names, count, ref) + FOR_EACH_VEC_ELT (*lto_section_names, count, ref) { fprintf (asm_out_file, "%s L$gnu$lto$offs%d\t;# %s\n", op, count, ref->sectname); @@ -3338,7 +3334,7 @@ darwin_build_constant_cfstring (tree str) if (!desc) { tree var, constructor, field; - VEC(constructor_elt,gc) *v = NULL; + vec<constructor_elt, va_gc> *v = NULL; int length = TREE_STRING_LENGTH (str) - 1; if (darwin_warn_nonportable_cfstrings) diff --git a/gcc/config/epiphany/resolve-sw-modes.c b/gcc/config/epiphany/resolve-sw-modes.c index ec0dfcc00ca..97045537497 100644 --- a/gcc/config/epiphany/resolve-sw-modes.c +++ b/gcc/config/epiphany/resolve-sw-modes.c @@ -56,12 +56,12 @@ resolve_sw_modes (void) { basic_block bb; rtx insn, src; - VEC (basic_block, heap) *todo; + vec<basic_block> todo; sbitmap pushed; bool need_commit = false; bool finalize_fp_sets = (MACHINE_FUNCTION (cfun)->unknown_mode_sets == 0); - todo = VEC_alloc (basic_block, heap, last_basic_block); + todo.create (last_basic_block); pushed = sbitmap_alloc (last_basic_block); bitmap_clear (pushed); if (!finalize_fp_sets) @@ -98,7 +98,7 @@ resolve_sw_modes (void) checking the total frequency of the affected edges. */ selected_mode = (enum attr_fp_mode) epiphany_normal_fp_rounding; - VEC_quick_push (basic_block, todo, bb); + todo.quick_push (bb); bitmap_set_bit (pushed, bb->index); } XVECEXP (XEXP (src, 0), 0, 0) = GEN_INT (selected_mode); @@ -106,9 +106,9 @@ resolve_sw_modes (void) SET_SRC (XVECEXP (PATTERN (insn), 0, 2)) = copy_rtx (src); df_insn_rescan (insn); } - while (VEC_length (basic_block, todo)) + while (todo.length ()) { - basic_block bb = VEC_pop (basic_block, todo); + basic_block bb = todo.pop (); int selected_reg, jilted_reg; enum attr_fp_mode jilted_mode; edge e; @@ -141,7 +141,7 @@ resolve_sw_modes (void) { if (bitmap_bit_p (pushed, succ->index)) continue; - VEC_quick_push (basic_block, todo, succ); + todo.quick_push (succ); bitmap_set_bit (pushed, bb->index); continue; } @@ -154,7 +154,7 @@ resolve_sw_modes (void) insert_insn_on_edge (seq, e); } } - VEC_free (basic_block, heap, todo); + todo.release (); sbitmap_free (pushed); if (need_commit) commit_edge_insertions (); diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 03c6675ba14..4bc105dc856 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -28737,7 +28737,7 @@ dispatch_function_versions (tree dispatch_decl, gimple_seq gseq; int ix; tree ele; - VEC (tree, heap) *fndecls; + vec<tree> *fndecls; unsigned int num_versions = 0; unsigned int actual_versions = 0; unsigned int i; @@ -28754,17 +28754,17 @@ dispatch_function_versions (tree dispatch_decl, && empty_bb != NULL); /*fndecls_p is actually a vector. */ - fndecls = (VEC (tree, heap) *)fndecls_p; + fndecls = static_cast<vec<tree> *> (fndecls_p); /* At least one more version other than the default. */ - num_versions = VEC_length (tree, fndecls); + num_versions = fndecls->length (); gcc_assert (num_versions >= 2); function_version_info = (struct _function_version_info *) XNEWVEC (struct _function_version_info, (num_versions - 1)); /* The first version in the vector is the default decl. */ - default_decl = VEC_index (tree, fndecls, 0); + default_decl = (*fndecls)[0]; push_cfun (DECL_STRUCT_FUNCTION (dispatch_decl)); @@ -28772,7 +28772,7 @@ dispatch_function_versions (tree dispatch_decl, /* Function version dispatch is via IFUNC. IFUNC resolvers fire before constructors, so explicity call __builtin_cpu_init here. */ ifunc_cpu_init_stmt = gimple_build_call_vec ( - ix86_builtins [(int) IX86_BUILTIN_CPU_INIT], NULL); + ix86_builtins [(int) IX86_BUILTIN_CPU_INIT], vec<tree>()); gimple_seq_add_stmt (&gseq, ifunc_cpu_init_stmt); gimple_set_bb (ifunc_cpu_init_stmt, *empty_bb); set_bb_seq (*empty_bb, gseq); @@ -28780,7 +28780,7 @@ dispatch_function_versions (tree dispatch_decl, pop_cfun (); - for (ix = 1; VEC_iterate (tree, fndecls, ix, ele); ++ix) + for (ix = 1; fndecls->iterate (ix, &ele); ++ix) { tree version_decl = ele; tree predicate_chain = NULL_TREE; @@ -29276,7 +29276,7 @@ ix86_generate_version_dispatcher_body (void *node_p) { tree resolver_decl; basic_block empty_bb; - VEC (tree, heap) *fn_ver_vec = NULL; + vec<tree> fn_ver_vec = vec<tree>(); tree default_ver_decl; struct cgraph_node *versn; struct cgraph_node *node; @@ -29306,7 +29306,7 @@ ix86_generate_version_dispatcher_body (void *node_p) push_cfun (DECL_STRUCT_FUNCTION (resolver_decl)); - fn_ver_vec = VEC_alloc (tree, heap, 2); + fn_ver_vec.create (2); for (versn_info = node_version_info->next; versn_info; versn_info = versn_info->next) @@ -29320,10 +29320,10 @@ ix86_generate_version_dispatcher_body (void *node_p) if (DECL_VINDEX (versn->symbol.decl)) error_at (DECL_SOURCE_LOCATION (versn->symbol.decl), "Virtual function multiversioning not supported"); - VEC_safe_push (tree, heap, fn_ver_vec, versn->symbol.decl); + fn_ver_vec.safe_push (versn->symbol.decl); } - dispatch_function_versions (resolver_decl, fn_ver_vec, &empty_bb); + dispatch_function_versions (resolver_decl, &fn_ver_vec, &empty_bb); rebuild_cgraph_edges (); pop_cfun (); diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c index 66f85dede86..9a7528f346a 100644 --- a/gcc/config/ia64/ia64.c +++ b/gcc/config/ia64/ia64.c @@ -5937,21 +5937,22 @@ ia64_option_override (void) { unsigned int i; cl_deferred_option *opt; - VEC(cl_deferred_option,heap) *vec - = (VEC(cl_deferred_option,heap) *) ia64_deferred_options; + vec<cl_deferred_option> *v + = (vec<cl_deferred_option> *) ia64_deferred_options; - FOR_EACH_VEC_ELT (cl_deferred_option, vec, i, opt) - { - switch (opt->opt_index) - { - case OPT_mfixed_range_: - fix_range (opt->arg); - break; + if (v) + FOR_EACH_VEC_ELT (*v, i, opt) + { + switch (opt->opt_index) + { + case OPT_mfixed_range_: + fix_range (opt->arg); + break; - default: - gcc_unreachable (); - } - } + default: + gcc_unreachable (); + } + } if (TARGET_AUTO_PIC) target_flags |= MASK_CONST_GP; diff --git a/gcc/config/mep/mep.c b/gcc/config/mep/mep.c index 79611a8fdb3..a44e521594e 100644 --- a/gcc/config/mep/mep.c +++ b/gcc/config/mep/mep.c @@ -300,54 +300,54 @@ mep_option_override (void) unsigned int i; int j; cl_deferred_option *opt; - VEC(cl_deferred_option,heap) *vec - = (VEC(cl_deferred_option,heap) *) mep_deferred_options; + vec<cl_deferred_option> *v = (vec<cl_deferred_option> *) mep_deferred_options; - FOR_EACH_VEC_ELT (cl_deferred_option, vec, i, opt) - { - switch (opt->opt_index) - { - case OPT_mivc2: - for (j = 0; j < 32; j++) - fixed_regs[j + 48] = 0; - for (j = 0; j < 32; j++) - call_used_regs[j + 48] = 1; - for (j = 6; j < 8; j++) - call_used_regs[j + 48] = 0; + if (v) + FOR_EACH_VEC_ELT (*v, i, opt) + { + switch (opt->opt_index) + { + case OPT_mivc2: + for (j = 0; j < 32; j++) + fixed_regs[j + 48] = 0; + for (j = 0; j < 32; j++) + call_used_regs[j + 48] = 1; + for (j = 6; j < 8; j++) + call_used_regs[j + 48] = 0; #define RN(n,s) reg_names[FIRST_CCR_REGNO + n] = s - RN (0, "$csar0"); - RN (1, "$cc"); - RN (4, "$cofr0"); - RN (5, "$cofr1"); - RN (6, "$cofa0"); - RN (7, "$cofa1"); - RN (15, "$csar1"); - - RN (16, "$acc0_0"); - RN (17, "$acc0_1"); - RN (18, "$acc0_2"); - RN (19, "$acc0_3"); - RN (20, "$acc0_4"); - RN (21, "$acc0_5"); - RN (22, "$acc0_6"); - RN (23, "$acc0_7"); - - RN (24, "$acc1_0"); - RN (25, "$acc1_1"); - RN (26, "$acc1_2"); - RN (27, "$acc1_3"); - RN (28, "$acc1_4"); - RN (29, "$acc1_5"); - RN (30, "$acc1_6"); - RN (31, "$acc1_7"); + RN (0, "$csar0"); + RN (1, "$cc"); + RN (4, "$cofr0"); + RN (5, "$cofr1"); + RN (6, "$cofa0"); + RN (7, "$cofa1"); + RN (15, "$csar1"); + + RN (16, "$acc0_0"); + RN (17, "$acc0_1"); + RN (18, "$acc0_2"); + RN (19, "$acc0_3"); + RN (20, "$acc0_4"); + RN (21, "$acc0_5"); + RN (22, "$acc0_6"); + RN (23, "$acc0_7"); + + RN (24, "$acc1_0"); + RN (25, "$acc1_1"); + RN (26, "$acc1_2"); + RN (27, "$acc1_3"); + RN (28, "$acc1_4"); + RN (29, "$acc1_5"); + RN (30, "$acc1_6"); + RN (31, "$acc1_7"); #undef RN - break; + break; - default: - gcc_unreachable (); - } - } + default: + gcc_unreachable (); + } + } if (flag_pic == 1) warning (OPT_fpic, "-fpic is not supported"); diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index 01f6b6176e1..78c5a884ac7 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -4012,12 +4012,8 @@ struct mips_multi_member { }; typedef struct mips_multi_member mips_multi_member; -/* Vector definitions for the above. */ -DEF_VEC_O(mips_multi_member); -DEF_VEC_ALLOC_O(mips_multi_member, heap); - /* The instructions that make up the current multi-insn sequence. */ -static VEC (mips_multi_member, heap) *mips_multi_members; +static vec<mips_multi_member> mips_multi_members; /* How many instructions (as opposed to labels) are in the current multi-insn sequence. */ @@ -4028,7 +4024,7 @@ static unsigned int mips_multi_num_insns; static void mips_multi_start (void) { - VEC_truncate (mips_multi_member, mips_multi_members, 0); + mips_multi_members.truncate (0); mips_multi_num_insns = 0; } @@ -4038,7 +4034,7 @@ static struct mips_multi_member * mips_multi_add (void) { mips_multi_member empty; - return VEC_safe_push (mips_multi_member, heap, mips_multi_members, empty); + return mips_multi_members.safe_push (empty); } /* Add a normal insn with the given asm format to the current multi-insn @@ -4081,7 +4077,7 @@ mips_multi_add_label (const char *label) static unsigned int mips_multi_last_index (void) { - return VEC_length (mips_multi_member, mips_multi_members) - 1; + return mips_multi_members.length () - 1; } /* Add a copy of an existing instruction to the current multi-insn @@ -4093,8 +4089,7 @@ mips_multi_copy_insn (unsigned int i) struct mips_multi_member *member; member = mips_multi_add (); - memcpy (member, &VEC_index (mips_multi_member, mips_multi_members, i), - sizeof (*member)); + memcpy (member, &mips_multi_members[i], sizeof (*member)); gcc_assert (!member->is_label_p); } @@ -4105,7 +4100,7 @@ mips_multi_copy_insn (unsigned int i) static void mips_multi_set_operand (unsigned int i, unsigned int op, rtx x) { - VEC_index (mips_multi_member, mips_multi_members, i).operands[op] = x; + mips_multi_members[i].operands[op] = x; } /* Write out the asm code for the current multi-insn sequence. */ @@ -4116,7 +4111,7 @@ mips_multi_write (void) struct mips_multi_member *member; unsigned int i; - FOR_EACH_VEC_ELT (mips_multi_member, mips_multi_members, i, member) + FOR_EACH_VEC_ELT (mips_multi_members, i, member) if (member->is_label_p) fprintf (asm_out_file, "%s\n", member->format); else diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c index afcfd1a8d22..8b93aa9e5ad 100644 --- a/gcc/config/pa/pa.c +++ b/gcc/config/pa/pa.c @@ -469,21 +469,22 @@ pa_option_override (void) { unsigned int i; cl_deferred_option *opt; - VEC(cl_deferred_option,heap) *vec - = (VEC(cl_deferred_option,heap) *) pa_deferred_options; + vec<cl_deferred_option> *v + = (vec<cl_deferred_option> *) pa_deferred_options; - FOR_EACH_VEC_ELT (cl_deferred_option, vec, i, opt) - { - switch (opt->opt_index) - { - case OPT_mfixed_range_: - fix_range (opt->arg); - break; + if (v) + FOR_EACH_VEC_ELT (*v, i, opt) + { + switch (opt->opt_index) + { + case OPT_mfixed_range_: + fix_range (opt->arg); + break; - default: - gcc_unreachable (); - } - } + default: + gcc_unreachable (); + } + } /* Unconditional branches in the delay slot are not compatible with dwarf2 call frame information. There is no benefit in using this optimization @@ -4401,7 +4402,7 @@ hppa_pic_save_rtx (void) /* Vector of funcdef numbers. */ -static VEC(int,heap) *funcdef_nos; +static vec<int> funcdef_nos; /* Output deferred profile counters. */ static void @@ -4410,20 +4411,20 @@ output_deferred_profile_counters (void) unsigned int i; int align, n; - if (VEC_empty (int, funcdef_nos)) + if (funcdef_nos.is_empty ()) return; switch_to_section (data_section); align = MIN (BIGGEST_ALIGNMENT, LONG_TYPE_SIZE); ASM_OUTPUT_ALIGN (asm_out_file, floor_log2 (align / BITS_PER_UNIT)); - for (i = 0; VEC_iterate (int, funcdef_nos, i, n); i++) + for (i = 0; funcdef_nos.iterate (i, &n); i++) { targetm.asm_out.internal_label (asm_out_file, "LP", n); assemble_integer (const0_rtx, LONG_TYPE_SIZE / BITS_PER_UNIT, align, 1); } - VEC_free (int, heap, funcdef_nos); + funcdef_nos.release (); } void @@ -4465,7 +4466,7 @@ hppa_profile_hook (int label_no) rtx count_label_rtx, addr, r24; char count_label_name[16]; - VEC_safe_push (int, heap, funcdef_nos, label_no); + funcdef_nos.safe_push (label_no); ASM_GENERATE_INTERNAL_LABEL (count_label_name, "LP", label_no); count_label_rtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (count_label_name)); @@ -9948,11 +9949,9 @@ typedef struct GTY(()) extern_symbol } extern_symbol; /* Define gc'd vector type for extern_symbol. */ -DEF_VEC_O(extern_symbol); -DEF_VEC_ALLOC_O(extern_symbol,gc); /* Vector of extern_symbol pointers. */ -static GTY(()) VEC(extern_symbol,gc) *extern_symbols; +static GTY(()) vec<extern_symbol, va_gc> *extern_symbols; #ifdef ASM_OUTPUT_EXTERNAL_REAL /* Mark DECL (name NAME) as an external reference (assembler output @@ -9964,7 +9963,7 @@ pa_hpux_asm_output_external (FILE *file, tree decl, const char *name) { gcc_assert (file == asm_out_file); extern_symbol p = {decl, name}; - VEC_safe_push (extern_symbol, gc, extern_symbols, p); + vec_safe_push (extern_symbols, p); } /* Output text required at the end of an assembler file. @@ -9982,7 +9981,7 @@ pa_hpux_file_end (void) output_deferred_plabels (); - for (i = 0; VEC_iterate (extern_symbol, extern_symbols, i, p); i++) + for (i = 0; vec_safe_iterate (extern_symbols, i, &p); i++) { tree decl = p->decl; @@ -9991,7 +9990,7 @@ pa_hpux_file_end (void) ASM_OUTPUT_EXTERNAL_REAL (asm_out_file, decl, p->name); } - VEC_free (extern_symbol, gc, extern_symbols); + vec_free (extern_symbols); } #endif diff --git a/gcc/config/rs6000/rs6000-c.c b/gcc/config/rs6000/rs6000-c.c index 295015f6fd0..79da7a62db3 100644 --- a/gcc/config/rs6000/rs6000-c.c +++ b/gcc/config/rs6000/rs6000-c.c @@ -3505,8 +3505,8 @@ tree altivec_resolve_overloaded_builtin (location_t loc, tree fndecl, void *passed_arglist) { - VEC(tree,gc) *arglist = (VEC(tree,gc) *) passed_arglist; - unsigned int nargs = VEC_length (tree, arglist); + vec<tree, va_gc> *arglist = static_cast<vec<tree, va_gc> *> (passed_arglist); + unsigned int nargs = vec_safe_length (arglist); enum rs6000_builtins fcode = (enum rs6000_builtins)DECL_FUNCTION_CODE (fndecl); tree fnargs = TYPE_ARG_TYPES (TREE_TYPE (fndecl)); @@ -3529,7 +3529,7 @@ altivec_resolve_overloaded_builtin (location_t loc, tree fndecl, int size; int i; bool unsigned_p; - VEC(constructor_elt,gc) *vec; + vec<constructor_elt, va_gc> *vec; const char *name = fcode == ALTIVEC_BUILTIN_VEC_SPLATS ? "vec_splats": "vec_promote"; if (nargs == 0) @@ -3549,10 +3549,10 @@ altivec_resolve_overloaded_builtin (location_t loc, tree fndecl, } /* Ignore promote's element argument. */ if (fcode == ALTIVEC_BUILTIN_VEC_PROMOTE - && !INTEGRAL_TYPE_P (TREE_TYPE (VEC_index (tree, arglist, 1)))) + && !INTEGRAL_TYPE_P (TREE_TYPE ((*arglist)[1]))) goto bad; - arg = VEC_index (tree, arglist, 0); + arg = (*arglist)[0]; type = TREE_TYPE (arg); if (!SCALAR_FLOAT_TYPE_P (type) && !INTEGRAL_TYPE_P (type)) @@ -3582,11 +3582,11 @@ altivec_resolve_overloaded_builtin (location_t loc, tree fndecl, goto bad; } arg = save_expr (fold_convert (TREE_TYPE (type), arg)); - vec = VEC_alloc (constructor_elt, gc, size); + vec_alloc (vec, size); for(i = 0; i < size; i++) { constructor_elt elt = {NULL_TREE, arg}; - VEC_quick_push (constructor_elt, vec, elt); + vec->quick_push (elt); } return build_constructor (type, vec); } @@ -3610,8 +3610,8 @@ altivec_resolve_overloaded_builtin (location_t loc, tree fndecl, return error_mark_node; } - arg2 = VEC_index (tree, arglist, 1); - arg1 = VEC_index (tree, arglist, 0); + arg2 = (*arglist)[1]; + arg1 = (*arglist)[0]; arg1_type = TREE_TYPE (arg1); if (TREE_CODE (arg1_type) != VECTOR_TYPE) @@ -3686,10 +3686,10 @@ altivec_resolve_overloaded_builtin (location_t loc, tree fndecl, return error_mark_node; } - arg0 = VEC_index (tree, arglist, 0); - arg1 = VEC_index (tree, arglist, 1); + arg0 = (*arglist)[0]; + arg1 = (*arglist)[1]; arg1_type = TREE_TYPE (arg1); - arg2 = VEC_index (tree, arglist, 2); + arg2 = (*arglist)[2]; if (TREE_CODE (arg1_type) != VECTOR_TYPE) goto bad; @@ -3752,7 +3752,7 @@ altivec_resolve_overloaded_builtin (location_t loc, tree fndecl, fnargs = TREE_CHAIN (fnargs), n++) { tree decl_type = TREE_VALUE (fnargs); - tree arg = VEC_index (tree, arglist, n); + tree arg = (*arglist)[n]; tree type; if (arg == error_mark_node) diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index b37bca935a8..4bde3201a54 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -24928,10 +24928,8 @@ typedef struct branch_island_d { int line_number; } branch_island; -DEF_VEC_O(branch_island); -DEF_VEC_ALLOC_O(branch_island,gc); -static VEC(branch_island,gc) *branch_islands; +static vec<branch_island, va_gc> *branch_islands; /* Remember to generate a branch island for far calls to the given function. */ @@ -24941,7 +24939,7 @@ add_compiler_branch_island (tree label_name, tree function_name, int line_number) { branch_island bi = {function_name, label_name, line_number}; - VEC_safe_push (branch_island, gc, branch_islands, bi); + vec_safe_push (branch_islands, bi); } /* Generate far-jump branch islands for everything recorded in @@ -24955,9 +24953,9 @@ macho_branch_islands (void) { char tmp_buf[512]; - while (!VEC_empty (branch_island, branch_islands)) + while (!vec_safe_is_empty (branch_islands)) { - branch_island *bi = &VEC_last (branch_island, branch_islands); + branch_island *bi = &branch_islands->last (); const char *label = IDENTIFIER_POINTER (bi->label_name); const char *name = IDENTIFIER_POINTER (bi->function_name); char name_buf[512]; @@ -25025,7 +25023,7 @@ macho_branch_islands (void) if (write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG) dbxout_stabd (N_SLINE, bi->line_number); #endif /* DBX_DEBUGGING_INFO || XCOFF_DEBUGGING_INFO */ - VEC_pop (branch_island, branch_islands); + branch_islands->pop (); } } @@ -25038,7 +25036,7 @@ no_previous_def (tree function_name) branch_island *bi; unsigned ix; - FOR_EACH_VEC_ELT (branch_island, branch_islands, ix, bi) + FOR_EACH_VEC_SAFE_ELT (branch_islands, ix, bi) if (function_name == bi->function_name) return 0; return 1; @@ -25053,7 +25051,7 @@ get_prev_label (tree function_name) branch_island *bi; unsigned ix; - FOR_EACH_VEC_ELT (branch_island, branch_islands, ix, bi) + FOR_EACH_VEC_SAFE_ELT (branch_islands, ix, bi) if (function_name == bi->function_name) return bi->label_name; return NULL_TREE; diff --git a/gcc/config/rx/rx.c b/gcc/config/rx/rx.c index 5d31eac9738..8cd9253e4d5 100644 --- a/gcc/config/rx/rx.c +++ b/gcc/config/rx/rx.c @@ -2614,43 +2614,43 @@ rx_option_override (void) { unsigned int i; cl_deferred_option *opt; - VEC(cl_deferred_option,heap) *vec - = (VEC(cl_deferred_option,heap) *) rx_deferred_options; + vec<cl_deferred_option> *v = (vec<cl_deferred_option> *) rx_deferred_options; - FOR_EACH_VEC_ELT (cl_deferred_option, vec, i, opt) - { - switch (opt->opt_index) - { - case OPT_mint_register_: - switch (opt->value) - { - case 4: - fixed_regs[10] = call_used_regs [10] = 1; - /* Fall through. */ - case 3: - fixed_regs[11] = call_used_regs [11] = 1; - /* Fall through. */ - case 2: - fixed_regs[12] = call_used_regs [12] = 1; - /* Fall through. */ - case 1: - fixed_regs[13] = call_used_regs [13] = 1; - /* Fall through. */ - case 0: - rx_num_interrupt_regs = opt->value; - break; - default: - rx_num_interrupt_regs = 0; - /* Error message already given because rx_handle_option - returned false. */ - break; - } - break; + if (v) + FOR_EACH_VEC_ELT (*v, i, opt) + { + switch (opt->opt_index) + { + case OPT_mint_register_: + switch (opt->value) + { + case 4: + fixed_regs[10] = call_used_regs [10] = 1; + /* Fall through. */ + case 3: + fixed_regs[11] = call_used_regs [11] = 1; + /* Fall through. */ + case 2: + fixed_regs[12] = call_used_regs [12] = 1; + /* Fall through. */ + case 1: + fixed_regs[13] = call_used_regs [13] = 1; + /* Fall through. */ + case 0: + rx_num_interrupt_regs = opt->value; + break; + default: + rx_num_interrupt_regs = 0; + /* Error message already given because rx_handle_option + returned false. */ + break; + } + break; - default: - gcc_unreachable (); - } - } + default: + gcc_unreachable (); + } + } /* This target defaults to strict volatile bitfields. */ if (flag_strict_volatile_bitfields < 0 && abi_version_at_least(2)) diff --git a/gcc/config/spu/spu-c.c b/gcc/config/spu/spu-c.c index 905030d5e4f..6fa8d17e467 100644 --- a/gcc/config/spu/spu-c.c +++ b/gcc/config/spu/spu-c.c @@ -93,8 +93,8 @@ spu_resolve_overloaded_builtin (location_t loc, tree fndecl, void *passed_args) #define SCALAR_TYPE_P(t) (INTEGRAL_TYPE_P (t) \ || SCALAR_FLOAT_TYPE_P (t) \ || POINTER_TYPE_P (t)) - VEC(tree,gc) *fnargs = (VEC(tree,gc) *) passed_args; - unsigned int nargs = VEC_length (tree, fnargs); + vec<tree, va_gc> *fnargs = static_cast <vec<tree, va_gc> *> (passed_args); + unsigned int nargs = vec_safe_length (fnargs); int new_fcode, fcode = DECL_FUNCTION_CODE (fndecl); struct spu_builtin_description *desc; tree match = NULL_TREE; @@ -137,7 +137,7 @@ spu_resolve_overloaded_builtin (location_t loc, tree fndecl, void *passed_args) return error_mark_node; } - var = VEC_index (tree, fnargs, p); + var = (*fnargs)[p]; if (TREE_CODE (var) == NON_LVALUE_EXPR) var = TREE_OPERAND (var, 0); diff --git a/gcc/config/vms/vms.c b/gcc/config/vms/vms.c index d23e8a8456a..65bf42acc5f 100644 --- a/gcc/config/vms/vms.c +++ b/gcc/config/vms/vms.c @@ -101,7 +101,7 @@ static const struct vms_crtl_name vms_crtl_names[] = /* List of aliased identifiers. They must be persistent across gc. */ -static GTY(()) VEC(tree,gc) *aliases_id; +static GTY(()) vec<tree, va_gc> *aliases_id; /* Add a CRTL translation. This simply use the transparent alias mechanism, which is platform independent and works with the @@ -120,7 +120,7 @@ vms_add_crtl_xlat (const char *name, size_t nlen, IDENTIFIER_TRANSPARENT_ALIAS (targ) = 1; TREE_CHAIN (targ) = get_identifier_with_length (id_str, id_len); - VEC_safe_push (tree, gc, aliases_id, targ); + vec_safe_push (aliases_id, targ); } /* Do VMS specific stuff on builtins: disable the ones that are not diff --git a/gcc/config/vxworks.c b/gcc/config/vxworks.c index 9eeefc0096f..e3059044d8d 100644 --- a/gcc/config/vxworks.c +++ b/gcc/config/vxworks.c @@ -96,23 +96,24 @@ vxworks_emutls_var_fields (tree type, tree *name) static tree vxworks_emutls_var_init (tree var, tree decl, tree tmpl_addr) { - VEC(constructor_elt,gc) *v = VEC_alloc (constructor_elt, gc, 3); + vec<constructor_elt, va_gc> *v; + vec_alloc (v, 3); tree type = TREE_TYPE (var); tree field = TYPE_FIELDS (type); constructor_elt elt = {field, fold_convert (TREE_TYPE (field), tmpl_addr)}; - VEC_quick_push (constructor_elt, v, elt); + v->quick_push (elt); field = DECL_CHAIN (field); elt.index = field; elt.value = build_int_cst (TREE_TYPE (field), 0); - VEC_quick_push (constructor_elt, v, elt); + v->quick_push (elt); field = DECL_CHAIN (field); elt.index = field; elt.value = fold_convert (TREE_TYPE (field), DECL_SIZE_UNIT (decl)); - VEC_quick_push (constructor_elt, v, elt); + v->quick_push (elt); return build_constructor (type, v); } |