Commit 0a25f1f5 by Richard Henderson Committed by Mark Mitchell

Makefile.in (GGC, GGC_LIB): New.

	* Makefile.in (GGC, GGC_LIB): New.
	(HOST_RTL): Include ggc-none.o.
	(ggc-simple.o): New target.
	(ggc-none.o): Likewise.
	* tree.h (tree_common): Add gc_mark.
	* rtl.h (struct rtx_def): Steal a bit from code to make gc_mark.
	(struct rtvec_def): Add gc_mark.
	* emit-rtl.c (global_rtl): Update static initializers to contain
	enough initializers.
	* ggc.h, ggc-none.c, ggc-simple.c: New files.
	* toplev.c (gc_time): New variable.
	(all_time): New variable.
	(compile_file): Print gc time.
	(print_time): Calculate percentage of the whole.

From-SVN: r29106
parent 482cbc74
Sat Sep 4 11:19:52 1999 Richard Henderson <rth@cygnus.com>
* Makefile.in (GGC, GGC_LIB): New.
(HOST_RTL): Include ggc-none.o.
(ggc-simple.o): New target.
(ggc-none.o): Likewise.
* tree.h (tree_common): Add gc_mark.
* rtl.h (struct rtx_def): Steal a bit from code to make gc_mark.
(struct rtvec_def): Add gc_mark.
* emit-rtl.c (global_rtl): Update static initializers to contain
enough initializers.
* ggc.h, ggc-none.c, ggc-simple.c: New files.
* toplev.c (gc_time): New variable.
(all_time): New variable.
(compile_file): Print gc time.
(print_time): Calculate percentage of the whole.
Sat Sep 4 13:11:01 1999 Bernd Schmidt <bernds@cygnus.co.uk> Sat Sep 4 13:11:01 1999 Bernd Schmidt <bernds@cygnus.co.uk>
Change obstack memory management and varasm constant pool handling so Change obstack memory management and varasm constant pool handling so
......
...@@ -316,6 +316,12 @@ CLIB= ...@@ -316,6 +316,12 @@ CLIB=
# system library. # system library.
OBSTACK=obstack.o OBSTACK=obstack.o
# The GC method to be used on this system.
GGC=ggc-simple.o
# If a supplementary library is being used for the GC.
GGC_LIB=
# Configure will set these if you need vfprintf and possibly _doprnt support. # Configure will set these if you need vfprintf and possibly _doprnt support.
VFPRINTF=@vfprintf@ VFPRINTF=@vfprintf@
DOPRINT=@doprint@ DOPRINT=@doprint@
...@@ -572,7 +578,7 @@ HOST_LIBS = $(USE_HOST_OBSTACK) $(USE_HOST_ALLOCA) $(USE_HOST_MALLOC) \ ...@@ -572,7 +578,7 @@ HOST_LIBS = $(USE_HOST_OBSTACK) $(USE_HOST_ALLOCA) $(USE_HOST_MALLOC) \
$(HOST_INTLLIBS) $(USE_HOST_VFPRINTF) $(USE_HOST_DOPRINT) \ $(HOST_INTLLIBS) $(USE_HOST_VFPRINTF) $(USE_HOST_DOPRINT) \
$(HOST_CLIB) $(HOST_CLIB)
HOST_RTL = $(HOST_PREFIX)rtl.o $(HOST_PREFIX)bitmap.o HOST_RTL = $(HOST_PREFIX)rtl.o $(HOST_PREFIX)bitmap.o $(HOST_PREFIX)ggc-none.o
HOST_RTLANAL = $(HOST_PREFIX)rtlanal.o HOST_RTLANAL = $(HOST_PREFIX)rtlanal.o
HOST_PRINT = $(HOST_PREFIX)print-rtl.o HOST_PRINT = $(HOST_PREFIX)print-rtl.o
HOST_ERRORS = $(HOST_PREFIX)errors.o HOST_ERRORS = $(HOST_PREFIX)errors.o
...@@ -1424,6 +1430,11 @@ gencheck.o : gencheck.c tree.def $(CONFIG_H) hconfig.h system.h ...@@ -1424,6 +1430,11 @@ gencheck.o : gencheck.c tree.def $(CONFIG_H) hconfig.h system.h
dumpvers: dumpvers.c dumpvers: dumpvers.c
version.o: version.c version.o: version.c
ggc-simple.o: ggc-simple.c $(CONFIG_H) $(RTL_BASE_H) $(TREE_H) flags.h ggc.h
ggc-none.o: ggc-none.c $(CONFIG_H) $(RTL_BASE_H) ggc.h
obstack.o: $(srcdir)/../libiberty/obstack.c $(CONFIG_H) obstack.o: $(srcdir)/../libiberty/obstack.c $(CONFIG_H)
rm -f obstack.c rm -f obstack.c
$(LN_S) $(srcdir)/../libiberty/obstack.c obstack.c $(LN_S) $(srcdir)/../libiberty/obstack.c obstack.c
......
...@@ -93,17 +93,17 @@ static int no_line_numbers; ...@@ -93,17 +93,17 @@ static int no_line_numbers;
struct _global_rtl global_rtl = struct _global_rtl global_rtl =
{ {
{PC, VOIDmode, 0, 0, 0, 0, 0, 0, 0, 0 FLDI }, /* pc_rtx */ {PC, VOIDmode, 0, 0, 0, 0, 0, 0, 0, 0, 0 FLDI }, /* pc_rtx */
{CC0, VOIDmode, 0, 0, 0, 0, 0, 0, 0, 0 FLDI }, /* cc0_rtx */ {CC0, VOIDmode, 0, 0, 0, 0, 0, 0, 0, 0, 0 FLDI }, /* cc0_rtx */
{REG, VOIDmode, 0, 0, 0, 0, 0, 0, 0, 0 FLDI }, /* stack_pointer_rtx */ {REG, VOIDmode, 0, 0, 0, 0, 0, 0, 0, 0, 0 FLDI }, /* stack_pointer_rtx */
{REG, VOIDmode, 0, 0, 0, 0, 0, 0, 0, 0 FLDI }, /* frame_pointer_rtx */ {REG, VOIDmode, 0, 0, 0, 0, 0, 0, 0, 0, 0 FLDI }, /* frame_pointer_rtx */
{REG, VOIDmode, 0, 0, 0, 0, 0, 0, 0, 0 FLDI }, /* hard_frame_pointer_rtx */ {REG, VOIDmode, 0, 0, 0, 0, 0, 0, 0, 0, 0 FLDI }, /* hard_frame_pointer_rtx */
{REG, VOIDmode, 0, 0, 0, 0, 0, 0, 0, 0 FLDI }, /* arg_pointer_rtx */ {REG, VOIDmode, 0, 0, 0, 0, 0, 0, 0, 0, 0 FLDI }, /* arg_pointer_rtx */
{REG, VOIDmode, 0, 0, 0, 0, 0, 0, 0, 0 FLDI }, /* virtual_incoming_args_rtx */ {REG, VOIDmode, 0, 0, 0, 0, 0, 0, 0, 0, 0 FLDI }, /* virtual_incoming_args_rtx */
{REG, VOIDmode, 0, 0, 0, 0, 0, 0, 0, 0 FLDI }, /* virtual_stack_vars_rtx */ {REG, VOIDmode, 0, 0, 0, 0, 0, 0, 0, 0, 0 FLDI }, /* virtual_stack_vars_rtx */
{REG, VOIDmode, 0, 0, 0, 0, 0, 0, 0, 0 FLDI }, /* virtual_stack_dynamic_rtx */ {REG, VOIDmode, 0, 0, 0, 0, 0, 0, 0, 0, 0 FLDI }, /* virtual_stack_dynamic_rtx */
{REG, VOIDmode, 0, 0, 0, 0, 0, 0, 0, 0 FLDI }, /* virtual_outgoing_args_rtx */ {REG, VOIDmode, 0, 0, 0, 0, 0, 0, 0, 0, 0 FLDI }, /* virtual_outgoing_args_rtx */
{REG, VOIDmode, 0, 0, 0, 0, 0, 0, 0, 0 FLDI }, /* virtual_cfa_rtx */ {REG, VOIDmode, 0, 0, 0, 0, 0, 0, 0, 0, 0 FLDI }, /* virtual_cfa_rtx */
}; };
/* We record floating-point CONST_DOUBLEs in each floating-point mode for /* We record floating-point CONST_DOUBLEs in each floating-point mode for
......
/* Null garbage collection for the GNU compiler.
Copyright (C) 1998 Free Software Foundation, Inc.
This file is part of GNU CC.
GNU CC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU CC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* This version is used by the gen* programs, where we don't really
need GC at all. This prevents problems with pulling in all the
tree stuff. */
/* We are used by gengenrtl, before genrtl.h exists. But we don't
need it either. */
#define NO_GENRTL_H
#include "config.h"
#include "system.h"
#include "rtl.h"
#include "ggc.h"
rtx
ggc_alloc_rtx (nslots)
int nslots;
{
int size = sizeof(struct rtx_def) + (nslots - 1) * sizeof(rtunion);
rtx n;
n = (rtx) xmalloc (size);
bzero ((char *) n, size);
return n;
}
rtvec
ggc_alloc_rtvec (nelt)
int nelt;
{
int size = sizeof (struct rtvec_def) + (nelt - 1) * sizeof (rtunion);
rtvec v;
v = (rtvec) xmalloc (size);
bzero ((char *) v, size);
return v;
}
/* Garbage collection for the GNU compiler.
Copyright (C) 1998 Free Software Foundation, Inc.
This file is part of GNU CC.
GNU CC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU CC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include "gansidecl.h"
/* Symbols are marked with `ggc' for `gcc gc' so as not to interfere with
an external gc library that might be linked in. */
/* Startup */
extern void init_ggc PROTO ((void));
/* Allocation. */
struct rtx_def *ggc_alloc_rtx PROTO ((int nslots));
struct rtvec_def *ggc_alloc_rtvec PROTO ((int nelt));
union tree_node *ggc_alloc_tree PROTO ((int length));
char *ggc_alloc_string PROTO ((const char *contents, int length));
/* Invoke the collector. This is really just a hint, but in the case of
the simple collector, the only time it will happen. */
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_rtx_root PROTO ((struct rtx_def **, int nelt));
void ggc_add_tree_root PROTO ((union tree_node **, int nelt));
void ggc_del_root PROTO ((void *base));
/* Mark nodes from the gc_add_root callback. */
void ggc_mark_rtx PROTO ((struct rtx_def *));
void ggc_mark_rtvec PROTO ((struct rtvec_def *));
void ggc_mark_tree PROTO ((union tree_node *));
void ggc_mark_string PROTO ((char *));
/* Callbacks to the languages. */
/* This is the language's opportunity to mark nodes held through
the lang_specific hooks in the tree. */
void lang_mark_tree PROTO ((union tree_node *));
/* And similarly to free that data when the tree node is released. */
void lang_cleanup_tree PROTO ((union tree_node *));
/* Mark functions for various structs scattered about. */
void mark_temp_slot PROTO ((void *));
void mark_function_chain PROTO ((void *));
void mark_eh_state PROTO ((void *));
void mark_stmt_state PROTO ((void *));
void mark_emit_state PROTO ((void *));
void mark_varasm_state PROTO ((void *));
void mark_optab PROTO ((void *));
...@@ -102,13 +102,13 @@ typedef struct rtx_def ...@@ -102,13 +102,13 @@ typedef struct rtx_def
{ {
#ifdef ONLY_INT_FIELDS #ifdef ONLY_INT_FIELDS
#ifdef CODE_FIELD_BUG #ifdef CODE_FIELD_BUG
unsigned int code : 16; unsigned int code : 15;
#else #else
unsigned short code; unsigned short code;
#endif #endif
#else #else
/* The kind of expression this is. */ /* The kind of expression this is. */
enum rtx_code code : 16; enum rtx_code code : 15;
#endif #endif
/* The kind of value the expression has. */ /* The kind of value the expression has. */
#ifdef ONLY_INT_FIELDS #ifdef ONLY_INT_FIELDS
...@@ -171,6 +171,10 @@ typedef struct rtx_def ...@@ -171,6 +171,10 @@ typedef struct rtx_def
1 in a MEM if the MEM refers to a scalar, rather than a member of 1 in a MEM if the MEM refers to a scalar, rather than a member of
an aggregate. */ an aggregate. */
unsigned frame_related : 1; unsigned frame_related : 1;
/* Used by the garbage collector. */
unsigned gc_mark : 1;
/* The first element of the operands of this rtx. /* The first element of the operands of this rtx.
The number of operands and their types are controlled The number of operands and their types are controlled
by the `code' field, according to rtl.def. */ by the `code' field, according to rtl.def. */
...@@ -202,6 +206,7 @@ typedef struct rtx_def ...@@ -202,6 +206,7 @@ typedef struct rtx_def
typedef struct rtvec_def{ typedef struct rtvec_def{
int num_elem; /* number of elements */ int num_elem; /* number of elements */
int gc_mark;
struct rtx_def *elem[1]; struct rtx_def *elem[1];
} *rtvec; } *rtvec;
......
...@@ -54,6 +54,7 @@ Boston, MA 02111-1307, USA. */ ...@@ -54,6 +54,7 @@ Boston, MA 02111-1307, USA. */
#include "expr.h" #include "expr.h"
#include "basic-block.h" #include "basic-block.h"
#include "intl.h" #include "intl.h"
#include "ggc.h"
#ifdef DWARF_DEBUGGING_INFO #ifdef DWARF_DEBUGGING_INFO
#include "dwarfout.h" #include "dwarfout.h"
...@@ -1350,6 +1351,8 @@ int stack_reg_time; ...@@ -1350,6 +1351,8 @@ int stack_reg_time;
int final_time; int final_time;
int symout_time; int symout_time;
int dump_time; int dump_time;
int gc_time;
int all_time;
/* Return time used so far, in microseconds. */ /* Return time used so far, in microseconds. */
...@@ -1429,8 +1432,9 @@ print_time (str, total) ...@@ -1429,8 +1432,9 @@ print_time (str, total)
int total; int total;
{ {
fprintf (stderr, fprintf (stderr,
"time in %s: %d.%06d\n", "time in %s: %d.%06d (%.0f%%)\n",
str, total / 1000000, total % 1000000); str, total / 1000000, total % 1000000,
(double)total / (double)all_time * 100.0);
} }
/* Count an error or warning. Return 1 if the message should be printed. */ /* Count an error or warning. Return 1 if the message should be printed. */
...@@ -3446,9 +3450,11 @@ compile_file (name) ...@@ -3446,9 +3450,11 @@ compile_file (name)
if (! quiet_flag) if (! quiet_flag)
{ {
all_time = get_run_time ();
fprintf (stderr,"\n"); fprintf (stderr,"\n");
print_time ("parse", parse_time);
print_time ("parse", parse_time);
print_time ("integration", integration_time); print_time ("integration", integration_time);
print_time ("jump", jump_time); print_time ("jump", jump_time);
print_time ("cse", cse_time); print_time ("cse", cse_time);
...@@ -3473,6 +3479,7 @@ compile_file (name) ...@@ -3473,6 +3479,7 @@ compile_file (name)
print_time ("varconst", varconst_time); print_time ("varconst", varconst_time);
print_time ("symout", symout_time); print_time ("symout", symout_time);
print_time ("dump", dump_time); print_time ("dump", dump_time);
print_time ("gc", gc_time);
} }
} }
...@@ -3772,7 +3779,7 @@ rest_of_compilation (decl) ...@@ -3772,7 +3779,7 @@ rest_of_compilation (decl)
/* See if we have allocated stack slots that are not directly addressable. /* See if we have allocated stack slots that are not directly addressable.
If so, scan all the insns and create explicit address computation If so, scan all the insns and create explicit address computation
for all references to such slots. */ for all references to such slots. */
/* fixup_stack_slots (); */ /* fixup_stack_slots (); */
/* Find all the EH handlers. */ /* Find all the EH handlers. */
find_exception_handler_labels (); find_exception_handler_labels ();
......
...@@ -194,7 +194,10 @@ struct tree_common ...@@ -194,7 +194,10 @@ struct tree_common
unsigned lang_flag_4 : 1; unsigned lang_flag_4 : 1;
unsigned lang_flag_5 : 1; unsigned lang_flag_5 : 1;
unsigned lang_flag_6 : 1; unsigned lang_flag_6 : 1;
/* There is room for three more flags. */
unsigned gc_mark : 1;
/* There is room for two more flags. */
}; };
/* The following table lists the uses of each of the above flags and /* The following table lists the uses of each of the above flags and
......
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