diff options
-rw-r--r-- | gcc/ChangeLog | 36 | ||||
-rw-r--r-- | gcc/combine.c | 109 | ||||
-rw-r--r-- | gcc/config/gofast.h | 60 | ||||
-rw-r--r-- | gcc/config/sparc/sol2.h | 18 | ||||
-rw-r--r-- | gcc/config/sparc/sparc.h | 38 | ||||
-rw-r--r-- | gcc/except.c | 2 | ||||
-rw-r--r-- | gcc/expr.h | 3 | ||||
-rw-r--r-- | gcc/function.c | 2 | ||||
-rw-r--r-- | gcc/gcse.c | 3 | ||||
-rw-r--r-- | gcc/ggc-simple.c | 21 | ||||
-rw-r--r-- | gcc/ggc.h | 4 | ||||
-rw-r--r-- | gcc/loop.c | 1 | ||||
-rw-r--r-- | gcc/optabs.c | 274 | ||||
-rw-r--r-- | gcc/rtl.h | 1 | ||||
-rw-r--r-- | gcc/toplev.c | 1 | ||||
-rw-r--r-- | gcc/varasm.c | 94 |
16 files changed, 394 insertions, 273 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ffd9ae5..589c724 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,39 @@ +Wed Sep 8 23:53:22 1999 Richard Henderson <rth@cygnus.com> + + * combine.c (SUBST): Break out to a real function do_SUBST. + (SUBST_INT): Likewise. + * gcse.c (free_pre_mem): Free `temp_bitmap'. + (pre_insert): Free `inserted'. + * loop.c (basic_induction_var): Always set `location'. + + * function.c (expand_function_end): Add initial_trampoline as a root. + * rtl.h (init_varasm_once): Declare. + * toplev.c (compile_file): Call it. + * ggc-simple.c (ggc_mark_string_ptr): New. + (ggc_add_string_root): New. + (ggc_collect): Disable collection avoidance temporarily. + * ggc.h (ggc_add_string_root): Declare. + * except.c (create_rethrow_ref): Use ggc_alloc_string. + * optabs.c (init_libfuncs): Likewise. + * varasm.c (named_section): Use ggc_alloc_string. + (make_function_rtl): Likewise. + (make_decl_rtl): Likewise. + (assemble_static_space): Likewise. + (assemble_trampoline_template): Likewise. + (output_constant_def): Likewise. + (force_const_mem): Likewise. + (mark_const_hash_entry): New. + (mark_pool_sym_hash_table): New. + (mark_varasm_state): Use it. + (init_varasm_once): New. + + * expr.h (init_one_libfunc): Declare. + * optabs.c (init_one_libfunc): New. + (init_optabs): Use it. + * config/gofast.h: Likewise. + * config/sparc/sol2.h (INIT_SUBTARGET_OPTABS): Likewise. + * config/sparc/sparc.h (INIT_TARGET_OPTABS): Likewise. + Thu Sep 9 13:46:06 1999 Geoffrey Keating <geoffk@cygnus.com> * Makefile.in (cppexp.o): Depend on cpphash.h. diff --git a/gcc/combine.c b/gcc/combine.c index 97e1375..b0646c2 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -338,58 +338,13 @@ struct undobuf static struct undobuf undobuf; -/* Substitute NEWVAL, an rtx expression, into INTO, a place in some - insn. The substitution can be undone by undo_all. If INTO is already - set to NEWVAL, do not record this change. Because computing NEWVAL might - also call SUBST, we have to compute it before we put anything into - the undo table. */ - -#define SUBST(INTO, NEWVAL) \ - do { rtx _new = (NEWVAL); \ - struct undo *_buf; \ - \ - if (undobuf.frees) \ - _buf = undobuf.frees, undobuf.frees = _buf->next; \ - else \ - _buf = (struct undo *) xmalloc (sizeof (struct undo)); \ - \ - _buf->is_int = 0; \ - _buf->where.r = &INTO; \ - _buf->old_contents.r = INTO; \ - INTO = _new; \ - if (_buf->old_contents.r == INTO) \ - _buf->next = undobuf.frees, undobuf.frees = _buf; \ - else \ - _buf->next = undobuf.undos, undobuf.undos = _buf; \ - } while (0) - -/* Similar to SUBST, but NEWVAL is an int expression. Note that substitution - for the value of a HOST_WIDE_INT value (including CONST_INT) is - not safe. */ - -#define SUBST_INT(INTO, NEWVAL) \ - do { struct undo *_buf; \ - \ - if (undobuf.frees) \ - _buf = undobuf.frees, undobuf.frees = _buf->next; \ - else \ - _buf = (struct undo *) xmalloc (sizeof (struct undo)); \ - \ - _buf->is_int = 1; \ - _buf->where.i = (int *) &INTO; \ - _buf->old_contents.i = INTO; \ - INTO = NEWVAL; \ - if (_buf->old_contents.i == INTO) \ - _buf->next = undobuf.frees, undobuf.frees = _buf; \ - else \ - _buf->next = undobuf.undos, undobuf.undos = _buf; \ - } while (0) - /* Number of times the pseudo being substituted for was found and replaced. */ static int n_occurrences; +static void do_SUBST PROTO((rtx *, rtx)); +static void do_SUBST_INT PROTO((int *, int)); static void init_reg_last_arrays PROTO((void)); static void setup_incoming_promotions PROTO((void)); static void set_nonzero_bits_and_sign_copies PROTO((rtx, rtx)); @@ -453,6 +408,66 @@ static void distribute_links PROTO((rtx)); static void mark_used_regs_combine PROTO((rtx)); static int insn_cuid PROTO((rtx)); +/* Substitute NEWVAL, an rtx expression, into INTO, a place in some + insn. The substitution can be undone by undo_all. If INTO is already + set to NEWVAL, do not record this change. Because computing NEWVAL might + also call SUBST, we have to compute it before we put anything into + the undo table. */ + +static void +do_SUBST(into, newval) + rtx *into, newval; +{ + struct undo *buf; + rtx oldval = *into; + + if (oldval == newval) + return; + + if (undobuf.frees) + buf = undobuf.frees, undobuf.frees = buf->next; + else + buf = (struct undo *) xmalloc (sizeof (struct undo)); + + buf->is_int = 0; + buf->where.r = into; + buf->old_contents.r = oldval; + *into = newval; + + buf->next = undobuf.undos, undobuf.undos = buf; +} + +#define SUBST(INTO, NEWVAL) do_SUBST(&(INTO), (NEWVAL)) + +/* Similar to SUBST, but NEWVAL is an int expression. Note that substitution + for the value of a HOST_WIDE_INT value (including CONST_INT) is + not safe. */ + +static void +do_SUBST_INT(into, newval) + int *into, newval; +{ + struct undo *buf; + int oldval = *into; + + if (oldval == newval) + return; + + if (undobuf.frees) + buf = undobuf.frees, undobuf.frees = buf->next; + else + buf = (struct undo *) xmalloc (sizeof (struct undo)); + + buf->is_int = 1; + buf->where.i = into; + buf->old_contents.i = oldval; + *into = newval; + + buf->next = undobuf.undos, undobuf.undos = buf; +} + +#define SUBST_INT(INTO, NEWVAL) do_SUBST_INT(&(INTO), (NEWVAL)) + /* Main entry point for combiner. F is the first insn of the function. NREGS is the first unused pseudo-reg number. */ diff --git a/gcc/config/gofast.h b/gcc/config/gofast.h index 26d2327..dd09ea1 100644 --- a/gcc/config/gofast.h +++ b/gcc/config/gofast.h @@ -44,33 +44,33 @@ Boston, MA 02111-1307, USA. */ } while (0) #define GOFAST_RENAME_LIBCALLS \ - add_optab->handlers[(int) SFmode].libfunc = gen_rtx_SYMBOL_REF (Pmode, "fpadd"); \ - add_optab->handlers[(int) DFmode].libfunc = gen_rtx_SYMBOL_REF (Pmode, "dpadd"); \ - sub_optab->handlers[(int) SFmode].libfunc = gen_rtx_SYMBOL_REF (Pmode, "fpsub"); \ - sub_optab->handlers[(int) DFmode].libfunc = gen_rtx_SYMBOL_REF (Pmode, "dpsub"); \ - smul_optab->handlers[(int) SFmode].libfunc = gen_rtx_SYMBOL_REF (Pmode, "fpmul"); \ - smul_optab->handlers[(int) DFmode].libfunc = gen_rtx_SYMBOL_REF (Pmode, "dpmul"); \ - flodiv_optab->handlers[(int) SFmode].libfunc = gen_rtx_SYMBOL_REF (Pmode, "fpdiv"); \ - flodiv_optab->handlers[(int) DFmode].libfunc = gen_rtx_SYMBOL_REF (Pmode, "dpdiv"); \ - cmp_optab->handlers[(int) SFmode].libfunc = gen_rtx_SYMBOL_REF (Pmode, "fpcmp"); \ - cmp_optab->handlers[(int) DFmode].libfunc = gen_rtx_SYMBOL_REF (Pmode, "dpcmp"); \ + add_optab->handlers[(int) SFmode].libfunc = init_one_libfunc ("fpadd"); \ + add_optab->handlers[(int) DFmode].libfunc = init_one_libfunc ("dpadd"); \ + sub_optab->handlers[(int) SFmode].libfunc = init_one_libfunc ("fpsub"); \ + sub_optab->handlers[(int) DFmode].libfunc = init_one_libfunc ("dpsub"); \ + smul_optab->handlers[(int) SFmode].libfunc = init_one_libfunc ("fpmul"); \ + smul_optab->handlers[(int) DFmode].libfunc = init_one_libfunc ("dpmul"); \ + flodiv_optab->handlers[(int) SFmode].libfunc = init_one_libfunc ("fpdiv"); \ + flodiv_optab->handlers[(int) DFmode].libfunc = init_one_libfunc ("dpdiv"); \ + cmp_optab->handlers[(int) SFmode].libfunc = init_one_libfunc ("fpcmp"); \ + cmp_optab->handlers[(int) DFmode].libfunc = init_one_libfunc ("dpcmp"); \ \ - extendsfdf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, "fptodp"); \ - truncdfsf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, "dptofp"); \ + extendsfdf2_libfunc = init_one_libfunc ("fptodp"); \ + truncdfsf2_libfunc = init_one_libfunc ("dptofp"); \ \ - eqsf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, "fpcmp"); \ - nesf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, "fpcmp"); \ - gtsf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, "fpcmp"); \ - gesf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, "fpcmp"); \ - ltsf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, "fpcmp"); \ - lesf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, "fpcmp"); \ + eqsf2_libfunc = init_one_libfunc ("fpcmp"); \ + nesf2_libfunc = init_one_libfunc ("fpcmp"); \ + gtsf2_libfunc = init_one_libfunc ("fpcmp"); \ + gesf2_libfunc = init_one_libfunc ("fpcmp"); \ + ltsf2_libfunc = init_one_libfunc ("fpcmp"); \ + lesf2_libfunc = init_one_libfunc ("fpcmp"); \ \ - eqdf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, "dpcmp"); \ - nedf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, "dpcmp"); \ - gtdf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, "dpcmp"); \ - gedf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, "dpcmp"); \ - ltdf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, "dpcmp"); \ - ledf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, "dpcmp"); \ + eqdf2_libfunc = init_one_libfunc ("dpcmp"); \ + nedf2_libfunc = init_one_libfunc ("dpcmp"); \ + gtdf2_libfunc = init_one_libfunc ("dpcmp"); \ + gedf2_libfunc = init_one_libfunc ("dpcmp"); \ + ltdf2_libfunc = init_one_libfunc ("dpcmp"); \ + ledf2_libfunc = init_one_libfunc ("dpcmp"); \ \ eqxf2_libfunc = NULL_RTX; \ nexf2_libfunc = NULL_RTX; \ @@ -86,11 +86,11 @@ Boston, MA 02111-1307, USA. */ lttf2_libfunc = NULL_RTX; \ letf2_libfunc = NULL_RTX; \ \ - floatsisf_libfunc = gen_rtx (SYMBOL_REF, Pmode, "sitofp"); \ - floatsidf_libfunc = gen_rtx (SYMBOL_REF, Pmode, "litodp"); \ - fixsfsi_libfunc = gen_rtx (SYMBOL_REF, Pmode, "fptosi"); \ - fixdfsi_libfunc = gen_rtx (SYMBOL_REF, Pmode, "dptoli"); \ - fixunssfsi_libfunc = gen_rtx (SYMBOL_REF, Pmode, "fptoui"); \ - fixunsdfsi_libfunc = gen_rtx (SYMBOL_REF, Pmode, "dptoul"); \ + floatsisf_libfunc = init_one_libfunc ("sitofp"); \ + floatsidf_libfunc = init_one_libfunc ("litodp"); \ + fixsfsi_libfunc = init_one_libfunc ("fptosi"); \ + fixdfsi_libfunc = init_one_libfunc ("dptoli"); \ + fixunssfsi_libfunc = init_one_libfunc ("fptoui"); \ + fixunsdfsi_libfunc = init_one_libfunc ("dptoul"); \ /* End of GOFAST_RENAME_LIBCALLS */ diff --git a/gcc/config/sparc/sol2.h b/gcc/config/sparc/sol2.h index c6091b2..92e44d6 100644 --- a/gcc/config/sparc/sol2.h +++ b/gcc/config/sparc/sol2.h @@ -194,15 +194,15 @@ Boston, MA 02111-1307, USA. */ #define UMODDI3_LIBCALL "__urem64" #undef INIT_SUBTARGET_OPTABS -#define INIT_SUBTARGET_OPTABS \ - fixsfdi_libfunc = gen_rtx_SYMBOL_REF (Pmode, \ - TARGET_ARCH64 ? "__ftol" : "__ftoll"); \ - fixunssfdi_libfunc = gen_rtx_SYMBOL_REF (Pmode, \ - TARGET_ARCH64 ? "__ftoul" : "__ftoull"); \ - fixdfdi_libfunc = gen_rtx_SYMBOL_REF (Pmode, \ - TARGET_ARCH64 ? "__dtol" : "__dtoll"); \ - fixunsdfdi_libfunc = gen_rtx_SYMBOL_REF (Pmode, \ - TARGET_ARCH64 ? "__dtoul" : "__dtoull") +#define INIT_SUBTARGET_OPTABS \ + fixsfdi_libfunc \ + = init_one_libfunc (TARGET_ARCH64 ? "__ftol" : "__ftoll"); \ + fixunssfdi_libfunc \ + = init_one_libfunc (TARGET_ARCH64 ? "__ftoul" : "__ftoull"); \ + fixdfdi_libfunc \ + = init_one_libfunc (TARGET_ARCH64 ? "__dtol" : "__dtoll"); \ + fixunsdfdi_libfunc \ + = init_one_libfunc (TARGET_ARCH64 ? "__dtoul" : "__dtoull") /* No weird SPARC variants on Solaris */ #undef TARGET_LIVE_G0 diff --git a/gcc/config/sparc/sparc.h b/gcc/config/sparc/sparc.h index 43583b7..6957a12 100644 --- a/gcc/config/sparc/sparc.h +++ b/gcc/config/sparc/sparc.h @@ -2637,32 +2637,32 @@ do { \ #define INIT_TARGET_OPTABS \ do { \ add_optab->handlers[(int) TFmode].libfunc \ - = gen_rtx_SYMBOL_REF (Pmode, ADDTF3_LIBCALL); \ + = init_one_libfunc (ADDTF3_LIBCALL); \ sub_optab->handlers[(int) TFmode].libfunc \ - = gen_rtx_SYMBOL_REF (Pmode, SUBTF3_LIBCALL); \ + = init_one_libfunc (SUBTF3_LIBCALL); \ neg_optab->handlers[(int) TFmode].libfunc \ - = gen_rtx_SYMBOL_REF (Pmode, NEGTF2_LIBCALL); \ + = init_one_libfunc (NEGTF2_LIBCALL); \ smul_optab->handlers[(int) TFmode].libfunc \ - = gen_rtx_SYMBOL_REF (Pmode, MULTF3_LIBCALL); \ + = init_one_libfunc (MULTF3_LIBCALL); \ flodiv_optab->handlers[(int) TFmode].libfunc \ - = gen_rtx_SYMBOL_REF (Pmode, DIVTF3_LIBCALL); \ - eqtf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, EQTF2_LIBCALL); \ - netf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, NETF2_LIBCALL); \ - gttf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, GTTF2_LIBCALL); \ - getf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, GETF2_LIBCALL); \ - lttf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, LTTF2_LIBCALL); \ - letf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, LETF2_LIBCALL); \ - trunctfsf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, TRUNCTFSF2_LIBCALL); \ - trunctfdf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, TRUNCTFDF2_LIBCALL); \ - extendsftf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, EXTENDSFTF2_LIBCALL); \ - extenddftf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, EXTENDDFTF2_LIBCALL); \ - floatsitf_libfunc = gen_rtx_SYMBOL_REF (Pmode, FLOATSITF2_LIBCALL); \ - fixtfsi_libfunc = gen_rtx_SYMBOL_REF (Pmode, FIX_TRUNCTFSI2_LIBCALL); \ + = init_one_libfunc (DIVTF3_LIBCALL); \ + eqtf2_libfunc = init_one_libfunc (EQTF2_LIBCALL); \ + netf2_libfunc = init_one_libfunc (NETF2_LIBCALL); \ + gttf2_libfunc = init_one_libfunc (GTTF2_LIBCALL); \ + getf2_libfunc = init_one_libfunc (GETF2_LIBCALL); \ + lttf2_libfunc = init_one_libfunc (LTTF2_LIBCALL); \ + letf2_libfunc = init_one_libfunc (LETF2_LIBCALL); \ + trunctfsf2_libfunc = init_one_libfunc (TRUNCTFSF2_LIBCALL); \ + trunctfdf2_libfunc = init_one_libfunc (TRUNCTFDF2_LIBCALL); \ + extendsftf2_libfunc = init_one_libfunc (EXTENDSFTF2_LIBCALL); \ + extenddftf2_libfunc = init_one_libfunc (EXTENDDFTF2_LIBCALL); \ + floatsitf_libfunc = init_one_libfunc (FLOATSITF2_LIBCALL); \ + fixtfsi_libfunc = init_one_libfunc (FIX_TRUNCTFSI2_LIBCALL); \ fixunstfsi_libfunc \ - = gen_rtx_SYMBOL_REF (Pmode, FIXUNS_TRUNCTFSI2_LIBCALL); \ + = init_one_libfunc (FIXUNS_TRUNCTFSI2_LIBCALL); \ if (TARGET_FPU) \ sqrt_optab->handlers[(int) TFmode].libfunc \ - = gen_rtx_SYMBOL_REF (Pmode, "_Q_sqrt"); \ + = init_one_libfunc ("_Q_sqrt"); \ INIT_SUBTARGET_OPTABS; \ } while (0) diff --git a/gcc/except.c b/gcc/except.c index 4bb2adb..ca2c89d 100644 --- a/gcc/except.c +++ b/gcc/except.c @@ -494,7 +494,7 @@ create_rethrow_ref (region_num) end_temporary_allocation (); ASM_GENERATE_INTERNAL_LABEL (buf, "LRTH", region_num); - ptr = (char *) obstack_copy0 (&permanent_obstack, buf, strlen (buf)); + ptr = ggc_alloc_string (buf, -1); def = gen_rtx_SYMBOL_REF (Pmode, ptr); SYMBOL_REF_NEED_ADJUST (def) = 1; @@ -828,6 +828,9 @@ extern void expand_float PROTO((rtx, rtx, int)); /* Generate code for a FIX_EXPR. */ extern void expand_fix PROTO((rtx, rtx, int)); +/* Call this to initialize an optab function entry. */ +extern rtx init_one_libfunc PROTO ((const char *)); + /* Call this once to initialize the contents of the optabs appropriately for the current target machine. */ extern void init_optabs PROTO((void)); diff --git a/gcc/function.c b/gcc/function.c index 4ce2dd5..3f14350 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -6066,6 +6066,8 @@ expand_function_end (filename, line, end_bindings) initial_trampoline = gen_rtx_MEM (BLKmode, assemble_trampoline_template ()); resume_temporary_allocation (); + + ggc_add_rtx_root (&initial_trampoline, 1); } #endif @@ -4086,6 +4086,7 @@ free_pre_mem () free (comp); free (antloc); + free (temp_bitmap); free (pre_optimal); free (pre_redundant); free (transpout); @@ -4412,6 +4413,8 @@ pre_insert (index_map) } } } + + sbitmap_vector_free (inserted); } /* Copy the result of INSN to REG. diff --git a/gcc/ggc-simple.c b/gcc/ggc-simple.c index 4858934..e4064a8 100644 --- a/gcc/ggc-simple.c +++ b/gcc/ggc-simple.c @@ -125,6 +125,7 @@ static void ggc_free_rtx PROTO ((struct ggc_rtx *r)); static void ggc_free_tree PROTO ((struct ggc_tree *t)); static void ggc_mark_rtx_ptr PROTO ((void *elt)); static void ggc_mark_tree_ptr PROTO ((void *elt)); +static void ggc_mark_string_ptr PROTO ((void *elt)); static void ggc_mark_tree_varray_ptr PROTO ((void *elt)); static void ggc_mark_tree_hash_table_ptr PROTO ((void *elt)); static boolean ggc_mark_tree_hash_table_entry PROTO ((struct hash_entry *, @@ -691,7 +692,7 @@ ggc_collect () struct ggc_any *a, **ap; int time, n_rtxs, n_trees, n_vecs, n_strings, n_anys; -#ifndef ENABLE_CHECKING +#if 0 /* See if it's even worth our while. */ if (ggc_chain->bytes_alloced_since_gc < 64*1024) return; @@ -883,6 +884,14 @@ ggc_add_tree_root (base, nelt) ggc_add_root (base, nelt, sizeof(tree), ggc_mark_tree_ptr); } +void +ggc_add_string_root (base, nelt) + char **base; + int nelt; +{ + ggc_add_root (base, nelt, sizeof(char *), ggc_mark_string_ptr); +} + /* Add V (a varray full of trees) to the list of GC roots. */ void @@ -943,6 +952,16 @@ ggc_mark_tree_ptr (elt) } /* Type-correct function to pass to ggc_add_root. It just forwards + ELT (which is really a char **) to ggc_mark_string. */ + +static void +ggc_mark_string_ptr (elt) + void *elt; +{ + ggc_mark_string (*(char **)elt); +} + +/* Type-correct function to pass to ggc_add_root. It just forwards ELT (which is really a varray_type *) to ggc_mark_tree_varray. */ static void @@ -64,10 +64,10 @@ void *ggc_alloc PROTO ((size_t)); void ggc_collect PROTO ((void)); /* Manipulate global roots that are needed between calls to gc. */ -void ggc_add_root PROTO ((void *base, int nelt, int size, - void (*)(void *))); +void ggc_add_root PROTO ((void *base, int nelt, int size, void (*)(void *))); void ggc_add_rtx_root PROTO ((struct rtx_def **, int nelt)); void ggc_add_tree_root PROTO ((union tree_node **, int nelt)); +void ggc_add_string_root PROTO ((char **, int nelt)); void ggc_add_tree_varray_root PROTO ((struct varray_head_tag **, int nelt)); void ggc_add_tree_hash_table_root PROTO ((struct hash_table **, int nelt)); void ggc_del_root PROTO ((void *base)); @@ -6000,6 +6000,7 @@ basic_induction_var (x, mode, dest_reg, p, inc_val, mult_val, location) rtx insn, set = 0; code = GET_CODE (x); + *location = NULL_RTX; switch (code) { case PLUS: diff --git a/gcc/optabs.c b/gcc/optabs.c index 312dfce..91e757b 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -4308,7 +4308,7 @@ init_libfuncs (optable, first_mode, last_mode, opname, suffix) register const char *mname = GET_MODE_NAME(mode); register unsigned mname_len = strlen (mname); register char *libfunc_name - = (char *) xmalloc (2 + opname_len + mname_len + 1 + 1); + = ggc_alloc_string (NULL, 2 + opname_len + mname_len + 1 + 1); register char *p; register const char *q; @@ -4321,6 +4321,7 @@ init_libfuncs (optable, first_mode, last_mode, opname, suffix) *p++ = tolower ((unsigned char)*q); *p++ = suffix; *p++ = '\0'; + optable->handlers[(int) mode].libfunc = gen_rtx_SYMBOL_REF (Pmode, libfunc_name); } @@ -4354,6 +4355,15 @@ init_floating_libfuncs (optable, opname, suffix) init_libfuncs (optable, SFmode, TFmode, opname, suffix); } +rtx +init_one_libfunc (name) + register const char *name; +{ + if (ggc_p) + name = ggc_alloc_string (name, -1); + return gen_rtx_SYMBOL_REF (Pmode, name); +} + /* Mark ARG (which is really an OPTAB *) for GC. */ void @@ -4511,189 +4521,189 @@ init_optabs () #ifdef MULSI3_LIBCALL smul_optab->handlers[(int) SImode].libfunc - = gen_rtx_SYMBOL_REF (Pmode, MULSI3_LIBCALL); + = init_one_libfunc (MULSI3_LIBCALL); #endif #ifdef MULDI3_LIBCALL smul_optab->handlers[(int) DImode].libfunc - = gen_rtx_SYMBOL_REF (Pmode, MULDI3_LIBCALL); + = init_one_libfunc (MULDI3_LIBCALL); #endif #ifdef DIVSI3_LIBCALL sdiv_optab->handlers[(int) SImode].libfunc - = gen_rtx_SYMBOL_REF (Pmode, DIVSI3_LIBCALL); + = init_one_libfunc (DIVSI3_LIBCALL); #endif #ifdef DIVDI3_LIBCALL sdiv_optab->handlers[(int) DImode].libfunc - = gen_rtx_SYMBOL_REF (Pmode, DIVDI3_LIBCALL); + = init_one_libfunc (DIVDI3_LIBCALL); #endif #ifdef UDIVSI3_LIBCALL udiv_optab->handlers[(int) SImode].libfunc - = gen_rtx_SYMBOL_REF (Pmode, UDIVSI3_LIBCALL); + = init_one_libfunc (UDIVSI3_LIBCALL); #endif #ifdef UDIVDI3_LIBCALL udiv_optab->handlers[(int) DImode].libfunc - = gen_rtx_SYMBOL_REF (Pmode, UDIVDI3_LIBCALL); + = init_one_libfunc (UDIVDI3_LIBCALL); #endif #ifdef MODSI3_LIBCALL smod_optab->handlers[(int) SImode].libfunc - = gen_rtx_SYMBOL_REF (Pmode, MODSI3_LIBCALL); + = init_one_libfunc (MODSI3_LIBCALL); #endif #ifdef MODDI3_LIBCALL smod_optab->handlers[(int) DImode].libfunc - = gen_rtx_SYMBOL_REF (Pmode, MODDI3_LIBCALL); + = init_one_libfunc (MODDI3_LIBCALL); #endif #ifdef UMODSI3_LIBCALL umod_optab->handlers[(int) SImode].libfunc - = gen_rtx_SYMBOL_REF (Pmode, UMODSI3_LIBCALL); + = init_one_libfunc (UMODSI3_LIBCALL); #endif #ifdef UMODDI3_LIBCALL umod_optab->handlers[(int) DImode].libfunc - = gen_rtx_SYMBOL_REF (Pmode, UMODDI3_LIBCALL); + = init_one_libfunc (UMODDI3_LIBCALL); #endif /* Use cabs for DC complex abs, since systems generally have cabs. Don't define any libcall for SCmode, so that cabs will be used. */ abs_optab->handlers[(int) DCmode].libfunc - = gen_rtx_SYMBOL_REF (Pmode, "cabs"); + = init_one_libfunc ("cabs"); /* The ffs function operates on `int'. */ #ifndef INT_TYPE_SIZE #define INT_TYPE_SIZE BITS_PER_WORD #endif ffs_optab->handlers[(int) mode_for_size (INT_TYPE_SIZE, MODE_INT, 0)].libfunc - = gen_rtx_SYMBOL_REF (Pmode, "ffs"); - - extendsfdf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__extendsfdf2"); - extendsfxf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__extendsfxf2"); - extendsftf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__extendsftf2"); - extenddfxf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__extenddfxf2"); - extenddftf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__extenddftf2"); - - truncdfsf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__truncdfsf2"); - truncxfsf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__truncxfsf2"); - trunctfsf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__trunctfsf2"); - truncxfdf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__truncxfdf2"); - trunctfdf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__trunctfdf2"); - - memcpy_libfunc = gen_rtx_SYMBOL_REF (Pmode, "memcpy"); - bcopy_libfunc = gen_rtx_SYMBOL_REF (Pmode, "bcopy"); - memcmp_libfunc = gen_rtx_SYMBOL_REF (Pmode, "memcmp"); - bcmp_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__gcc_bcmp"); - memset_libfunc = gen_rtx_SYMBOL_REF (Pmode, "memset"); - bzero_libfunc = gen_rtx_SYMBOL_REF (Pmode, "bzero"); - - throw_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__throw"); - rethrow_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__rethrow"); - sjthrow_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__sjthrow"); - sjpopnthrow_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__sjpopnthrow"); - terminate_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__terminate"); - eh_rtime_match_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__eh_rtime_match"); + = init_one_libfunc ("ffs"); + + extendsfdf2_libfunc = init_one_libfunc ("__extendsfdf2"); + extendsfxf2_libfunc = init_one_libfunc ("__extendsfxf2"); + extendsftf2_libfunc = init_one_libfunc ("__extendsftf2"); + extenddfxf2_libfunc = init_one_libfunc ("__extenddfxf2"); + extenddftf2_libfunc = init_one_libfunc ("__extenddftf2"); + + truncdfsf2_libfunc = init_one_libfunc ("__truncdfsf2"); + truncxfsf2_libfunc = init_one_libfunc ("__truncxfsf2"); + trunctfsf2_libfunc = init_one_libfunc ("__trunctfsf2"); + truncxfdf2_libfunc = init_one_libfunc ("__truncxfdf2"); + trunctfdf2_libfunc = init_one_libfunc ("__trunctfdf2"); + + memcpy_libfunc = init_one_libfunc ("memcpy"); + bcopy_libfunc = init_one_libfunc ("bcopy"); + memcmp_libfunc = init_one_libfunc ("memcmp"); + bcmp_libfunc = init_one_libfunc ("__gcc_bcmp"); + memset_libfunc = init_one_libfunc ("memset"); + bzero_libfunc = init_one_libfunc ("bzero"); + + throw_libfunc = init_one_libfunc ("__throw"); + rethrow_libfunc = init_one_libfunc ("__rethrow"); + sjthrow_libfunc = init_one_libfunc ("__sjthrow"); + sjpopnthrow_libfunc = init_one_libfunc ("__sjpopnthrow"); + terminate_libfunc = init_one_libfunc ("__terminate"); + eh_rtime_match_libfunc = init_one_libfunc ("__eh_rtime_match"); #ifndef DONT_USE_BUILTIN_SETJMP - setjmp_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__builtin_setjmp"); - longjmp_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__builtin_longjmp"); + setjmp_libfunc = init_one_libfunc ("__builtin_setjmp"); + longjmp_libfunc = init_one_libfunc ("__builtin_longjmp"); #else - setjmp_libfunc = gen_rtx_SYMBOL_REF (Pmode, "setjmp"); - longjmp_libfunc = gen_rtx_SYMBOL_REF (Pmode, "longjmp"); + setjmp_libfunc = init_one_libfunc ("setjmp"); + longjmp_libfunc = init_one_libfunc ("longjmp"); #endif - eqhf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__eqhf2"); - nehf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__nehf2"); - gthf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__gthf2"); - gehf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__gehf2"); - lthf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__lthf2"); - lehf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__lehf2"); - - eqsf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__eqsf2"); - nesf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__nesf2"); - gtsf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__gtsf2"); - gesf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__gesf2"); - ltsf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__ltsf2"); - lesf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__lesf2"); - - eqdf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__eqdf2"); - nedf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__nedf2"); - gtdf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__gtdf2"); - gedf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__gedf2"); - ltdf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__ltdf2"); - ledf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__ledf2"); - - eqxf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__eqxf2"); - nexf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__nexf2"); - gtxf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__gtxf2"); - gexf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__gexf2"); - ltxf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__ltxf2"); - lexf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__lexf2"); - - eqtf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__eqtf2"); - netf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__netf2"); - gttf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__gttf2"); - getf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__getf2"); - lttf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__lttf2"); - letf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__letf2"); - - floatsisf_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__floatsisf"); - floatdisf_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__floatdisf"); - floattisf_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__floattisf"); - - floatsidf_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__floatsidf"); - floatdidf_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__floatdidf"); - floattidf_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__floattidf"); - - floatsixf_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__floatsixf"); - floatdixf_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__floatdixf"); - floattixf_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__floattixf"); - - floatsitf_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__floatsitf"); - floatditf_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__floatditf"); - floattitf_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__floattitf"); - - fixsfsi_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__fixsfsi"); - fixsfdi_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__fixsfdi"); - fixsfti_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__fixsfti"); - - fixdfsi_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__fixdfsi"); - fixdfdi_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__fixdfdi"); - fixdfti_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__fixdfti"); - - fixxfsi_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__fixxfsi"); - fixxfdi_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__fixxfdi"); - fixxfti_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__fixxfti"); - - fixtfsi_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__fixtfsi"); - fixtfdi_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__fixtfdi"); - fixtfti_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__fixtfti"); - - fixunssfsi_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__fixunssfsi"); - fixunssfdi_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__fixunssfdi"); - fixunssfti_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__fixunssfti"); - - fixunsdfsi_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__fixunsdfsi"); - fixunsdfdi_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__fixunsdfdi"); - fixunsdfti_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__fixunsdfti"); - - fixunsxfsi_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__fixunsxfsi"); - fixunsxfdi_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__fixunsxfdi"); - fixunsxfti_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__fixunsxfti"); - - fixunstfsi_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__fixunstfsi"); - fixunstfdi_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__fixunstfdi"); - fixunstfti_libfunc = gen_rtx_SYMBOL_REF (Pmode, "__fixunstfti"); + eqhf2_libfunc = init_one_libfunc ("__eqhf2"); + nehf2_libfunc = init_one_libfunc ("__nehf2"); + gthf2_libfunc = init_one_libfunc ("__gthf2"); + gehf2_libfunc = init_one_libfunc ("__gehf2"); + lthf2_libfunc = init_one_libfunc ("__lthf2"); + lehf2_libfunc = init_one_libfunc ("__lehf2"); + + eqsf2_libfunc = init_one_libfunc ("__eqsf2"); + nesf2_libfunc = init_one_libfunc ("__nesf2"); + gtsf2_libfunc = init_one_libfunc ("__gtsf2"); + gesf2_libfunc = init_one_libfunc ("__gesf2"); + ltsf2_libfunc = init_one_libfunc ("__ltsf2"); + lesf2_libfunc = init_one_libfunc ("__lesf2"); + + eqdf2_libfunc = init_one_libfunc ("__eqdf2"); + nedf2_libfunc = init_one_libfunc ("__nedf2"); + gtdf2_libfunc = init_one_libfunc ("__gtdf2"); + gedf2_libfunc = init_one_libfunc ("__gedf2"); + ltdf2_libfunc = init_one_libfunc ("__ltdf2"); + ledf2_libfunc = init_one_libfunc ("__ledf2"); + + eqxf2_libfunc = init_one_libfunc ("__eqxf2"); + nexf2_libfunc = init_one_libfunc ("__nexf2"); + gtxf2_libfunc = init_one_libfunc ("__gtxf2"); + gexf2_libfunc = init_one_libfunc ("__gexf2"); + ltxf2_libfunc = init_one_libfunc ("__ltxf2"); + lexf2_libfunc = init_one_libfunc ("__lexf2"); + + eqtf2_libfunc = init_one_libfunc ("__eqtf2"); + netf2_libfunc = init_one_libfunc ("__netf2"); + gttf2_libfunc = init_one_libfunc ("__gttf2"); + getf2_libfunc = init_one_libfunc ("__getf2"); + lttf2_libfunc = init_one_libfunc ("__lttf2"); + letf2_libfunc = init_one_libfunc ("__letf2"); + + floatsisf_libfunc = init_one_libfunc ("__floatsisf"); + floatdisf_libfunc = init_one_libfunc ("__floatdisf"); + floattisf_libfunc = init_one_libfunc ("__floattisf"); + + floatsidf_libfunc = init_one_libfunc ("__floatsidf"); + floatdidf_libfunc = init_one_libfunc ("__floatdidf"); + floattidf_libfunc = init_one_libfunc ("__floattidf"); + + floatsixf_libfunc = init_one_libfunc ("__floatsixf"); + floatdixf_libfunc = init_one_libfunc ("__floatdixf"); + floattixf_libfunc = init_one_libfunc ("__floattixf"); + + floatsitf_libfunc = init_one_libfunc ("__floatsitf"); + floatditf_libfunc = init_one_libfunc ("__floatditf"); + floattitf_libfunc = init_one_libfunc ("__floattitf"); + + fixsfsi_libfunc = init_one_libfunc ("__fixsfsi"); + fixsfdi_libfunc = init_one_libfunc ("__fixsfdi"); + fixsfti_libfunc = init_one_libfunc ("__fixsfti"); + + fixdfsi_libfunc = init_one_libfunc ("__fixdfsi"); + fixdfdi_libfunc = init_one_libfunc ("__fixdfdi"); + fixdfti_libfunc = init_one_libfunc ("__fixdfti"); + + fixxfsi_libfunc = init_one_libfunc ("__fixxfsi"); + fixxfdi_libfunc = init_one_libfunc ("__fixxfdi"); + fixxfti_libfunc = init_one_libfunc ("__fixxfti"); + + fixtfsi_libfunc = init_one_libfunc ("__fixtfsi"); + fixtfdi_libfunc = init_one_libfunc ("__fixtfdi"); + fixtfti_libfunc = init_one_libfunc ("__fixtfti"); + + fixunssfsi_libfunc = init_one_libfunc ("__fixunssfsi"); + fixunssfdi_libfunc = init_one_libfunc ("__fixunssfdi"); + fixunssfti_libfunc = init_one_libfunc ("__fixunssfti"); + + fixunsdfsi_libfunc = init_one_libfunc ("__fixunsdfsi"); + fixunsdfdi_libfunc = init_one_libfunc ("__fixunsdfdi"); + fixunsdfti_libfunc = init_one_libfunc ("__fixunsdfti"); + + fixunsxfsi_libfunc = init_one_libfunc ("__fixunsxfsi"); + fixunsxfdi_libfunc = init_one_libfunc ("__fixunsxfdi"); + fixunsxfti_libfunc = init_one_libfunc ("__fixunsxfti"); + + fixunstfsi_libfunc = init_one_libfunc ("__fixunstfsi"); + fixunstfdi_libfunc = init_one_libfunc ("__fixunstfdi"); + fixunstfti_libfunc = init_one_libfunc ("__fixunstfti"); /* For check-memory-usage. */ - chkr_check_addr_libfunc = gen_rtx_SYMBOL_REF (Pmode, "chkr_check_addr"); - chkr_set_right_libfunc = gen_rtx_SYMBOL_REF (Pmode, "chkr_set_right"); - chkr_copy_bitmap_libfunc = gen_rtx_SYMBOL_REF (Pmode, "chkr_copy_bitmap"); - chkr_check_exec_libfunc = gen_rtx_SYMBOL_REF (Pmode, "chkr_check_exec"); - chkr_check_str_libfunc = gen_rtx_SYMBOL_REF (Pmode, "chkr_check_str"); + chkr_check_addr_libfunc = init_one_libfunc ("chkr_check_addr"); + chkr_set_right_libfunc = init_one_libfunc ("chkr_set_right"); + chkr_copy_bitmap_libfunc = init_one_libfunc ("chkr_copy_bitmap"); + chkr_check_exec_libfunc = init_one_libfunc ("chkr_check_exec"); + chkr_check_str_libfunc = init_one_libfunc ("chkr_check_str"); /* For function entry/exit instrumentation. */ profile_function_entry_libfunc - = gen_rtx_SYMBOL_REF (Pmode, "__cyg_profile_func_enter"); + = init_one_libfunc ("__cyg_profile_func_enter"); profile_function_exit_libfunc - = gen_rtx_SYMBOL_REF (Pmode, "__cyg_profile_func_exit"); + = init_one_libfunc ("__cyg_profile_func_exit"); #ifdef HAVE_conditional_trap init_traps (); @@ -1652,6 +1652,7 @@ extern int set_dominates_use PROTO ((int, int, int, rtx, rtx)); extern void bss_section PROTO ((void)); extern int in_data_section PROTO ((void)); extern int supports_one_only PROTO ((void)); +extern void init_varasm_once PROTO ((void)); /* In rtl.c */ extern void init_rtl PROTO ((void)); diff --git a/gcc/toplev.c b/gcc/toplev.c index 73a77bc..f104e85 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -2893,6 +2893,7 @@ compile_file (name) init_alias_once (); init_function_once (); init_stor_layout_once (); + init_varasm_once (); /* The following initialization functions need to generate rtl, so provide a dummy function context for them. */ diff --git a/gcc/varasm.c b/gcc/varasm.c index 8c0b5a1..887fc78 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -187,6 +187,7 @@ static void asm_output_aligned_bss PROTO((FILE *, tree, char *, int, int)); #endif #endif /* BSS_SECTION_ASM_OP */ static void mark_pool_constant PROTO((struct pool_constant *)); +static void mark_pool_sym_hash_table PROTO((struct pool_sym **)); static enum in_section { no_section, in_text, in_data, in_named #ifdef BSS_SECTION_ASM_OP @@ -313,8 +314,7 @@ named_section (decl, name, reloc) abort (); #endif - in_named_name = obstack_alloc (&permanent_obstack, strlen (name) + 1); - strcpy (in_named_name, name); + in_named_name = ggc_alloc_string (name, -1); in_section = in_named; } } @@ -528,7 +528,7 @@ make_function_rtl (decl) name = IDENTIFIER_POINTER (DECL_NAME (decl)); ASM_FORMAT_PRIVATE_NAME (label, name, var_labelno); - name = obstack_copy0 (saveable_obstack, label, strlen (label)); + name = ggc_alloc_string (label, -1); var_labelno++; } else @@ -539,10 +539,12 @@ make_function_rtl (decl) is not prefixed. */ if (flag_prefix_function_name) { - new_name = (char *) alloca (strlen (name) + CHKR_PREFIX_SIZE + 1); - strcpy (new_name, CHKR_PREFIX); - strcpy (new_name + CHKR_PREFIX_SIZE, name); - name = obstack_copy0 (saveable_obstack, new_name, strlen (new_name)); + size_t name_len = strlen (name); + + new_name = ggc_alloc_string (NULL, name_len + CHKR_PREFIX_SIZE); + memcpy (new_name, CHKR_PREFIX, CHKR_PREFIX_SIZE); + memcpy (new_name + CHKR_PREFIX_SIZE, name, name_len + 1); + name = new_name; } } @@ -678,10 +680,11 @@ make_decl_rtl (decl, asmspec, top_level) if (reg_number == -2) { /* ASMSPEC is given, and not the name of a register. */ - name = (char *) obstack_alloc (saveable_obstack, - strlen (asmspec) + 2); + size_t len = strlen (asmspec); + + name = ggc_alloc_string (NULL, len + 1); name[0] = '*'; - strcpy (&name[1], asmspec); + memcpy (&name[1], asmspec, len + 1); } /* For a duplicate declaration, we can be called twice on the @@ -771,7 +774,7 @@ make_decl_rtl (decl, asmspec, top_level) char *label; ASM_FORMAT_PRIVATE_NAME (label, name, var_labelno); - name = obstack_copy0 (saveable_obstack, label, strlen (label)); + name = ggc_alloc_string (label, -1); var_labelno++; } @@ -783,13 +786,13 @@ make_decl_rtl (decl, asmspec, top_level) prefixed. */ if (flag_prefix_function_name && TREE_CODE (decl) == FUNCTION_DECL) { + size_t name_len = strlen (name); char *new_name; - new_name = (char *) alloca (strlen (name) + CHKR_PREFIX_SIZE - + 1); - strcpy (new_name, CHKR_PREFIX); - strcpy (new_name + CHKR_PREFIX_SIZE, name); - name = obstack_copy0 (saveable_obstack, - new_name, strlen (new_name)); + + new_name = ggc_alloc_string (NULL, name_len + CHKR_PREFIX_SIZE); + memcpy (new_name, CHKR_PREFIX, CHKR_PREFIX_SIZE); + memcpy (new_name + CHKR_PREFIX_SIZE, name, name_len + 1); + name = new_name; } DECL_RTL (decl) = gen_rtx_MEM (DECL_MODE (decl), @@ -1770,10 +1773,7 @@ assemble_static_space (size) ASM_GENERATE_INTERNAL_LABEL (name, "LF", const_labelno); ++const_labelno; - - namestring = (char *) obstack_alloc (saveable_obstack, - strlen (name) + 2); - strcpy (namestring, name); + namestring = ggc_alloc_string (name, -1); x = gen_rtx_SYMBOL_REF (Pmode, namestring); @@ -1829,8 +1829,7 @@ assemble_trampoline_template () /* Record the rtl to refer to it. */ ASM_GENERATE_INTERNAL_LABEL (label, "LTRAMP", 0); - name - = (char *) obstack_copy0 (&permanent_obstack, label, strlen (label)); + name = ggc_alloc_string (label, -1); return gen_rtx_SYMBOL_REF (Pmode, name); } #endif @@ -2304,6 +2303,21 @@ struct constant_descriptor #define MAX_HASH_TABLE 1009 static struct constant_descriptor *const_hash_table[MAX_HASH_TABLE]; +/* Mark a const_hash_table descriptor for GC. */ + +static void +mark_const_hash_entry (ptr) + void *ptr; +{ + struct constant_descriptor *desc = * (struct constant_descriptor **) ptr; + + while (desc) + { + ggc_mark_string (desc->label); + desc = desc->next; + } +} + /* Compute a hash code for a constant expression. */ static int @@ -3003,15 +3017,9 @@ output_constant_def (exp) desc = record_constant (exp); desc->next = const_hash_table[hash]; - desc->label - = (char *) obstack_copy0 (&permanent_obstack, label, strlen (label)); + desc->label = ggc_alloc_string (label, -1); const_hash_table[hash] = desc; } - else - { - /* Create a string containing the label name, in LABEL. */ - ASM_GENERATE_INTERNAL_LABEL (label, "LC", const_labelno); - } /* We have a symbol name; construct the SYMBOL_REF and the MEM. */ @@ -3200,6 +3208,20 @@ mark_pool_constant (pc) } } +/* Mark PPS for GC. */ + +static void +mark_pool_sym_hash_table (pps) + struct pool_sym **pps; +{ + struct pool_sym *ps; + int i; + + for (i = 0; i < MAX_RTX_HASH_TABLE; ++i) + for (ps = pps[i]; ps ; ps = ps->next) + ggc_mark_string (ps->label); +} + /* Mark P for GC. */ void @@ -3207,6 +3229,7 @@ mark_varasm_state (p) struct varasm_status *p; { mark_pool_constant (p->x_first_pool); + mark_pool_sym_hash_table (p->x_const_rtx_sym_hash_table); ggc_mark_rtx (p->x_const_double_chain); } @@ -3548,8 +3571,7 @@ force_const_mem (mode, x) ++const_labelno; - desc->label = found - = (char *) obstack_copy0 (saveable_obstack, label, strlen (label)); + desc->label = found = ggc_alloc_string (label, -1); /* Add label to symbol hash table. */ hash = SYMHASH (found); @@ -4538,3 +4560,11 @@ make_decl_one_only (decl) else abort (); } + +void +init_varasm_once () +{ + ggc_add_root (const_hash_table, MAX_HASH_TABLE, sizeof(const_hash_table[0]), + mark_const_hash_entry); + ggc_add_string_root (&in_named_name, 1); +} |