Commit 76095e2f by Richard Henderson Committed by Richard Henderson

combine.c (SUBST): Break out to a real function do_SUBST.

        * 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.

From-SVN: r29226
parent e1b3e07d
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.
......
......@@ -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. */
......
......@@ -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 */
......@@ -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
......
......@@ -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)
......
......@@ -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));
......
......@@ -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.
......
......@@ -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:
......
......@@ -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));
......
......@@ -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. */
......
......@@ -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);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment