mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-08 16:47:25 +08:00
Makefile.in (C_AND_OBJC_OBJS): Remove ggc-callbacks.o.
* Makefile.in (C_AND_OBJC_OBJS): Remove ggc-callbacks.o. (c-parse.o, c-decl.o, c-lang.o, c-lex.o, c-common.o, $(out_object_file)): Depend on ggc.h. * c-common.c: Include "ggc.h". (combine_strings): If doing GC, use ggc_alloc_string. * c-decl.c: Include "ggc.h". (ggc_p): Define with value 0. (mark_binding_level): New function. (init_decl_processing): Add GC roots. (mark_c_function_context): New function. (lang_mark_false_label_stack): New function. (lang_mark_tree): New function. (lang_cleanup_tree): New function. * c-lang.c: Include "ggc.h". (lang_init): Call c_parse_init. * c-lex.c: Include "ggc.h". (check_linenum): If doing GC, don't copy filenames to permanent obstack. * c-parse.in: Include "ggc.h". (c_parse_init): New function. * c-tree.h (c_parse_init, mark_c_function_context): Declare. * objc/Make-lang.in (objc-parse.o): Depend on ggc.h. * except.c (mark_eh_state): Mark more state. * function.c (mark_function_state): Likewise. * ggc-simple.c (ggc_alloc_rtvec): Bring in sync with non-gc version. (ggc_alloc_string) [GGC_DUMP]: Fix typo. * toplev.c (mark_file_stack): New function. (compile_file): If doing GC, use ggc_alloc_string on input filename. (main): Add root for input_file_stack. * i386.c: Include "ggc.h". (ix86_mark_machine_status): New function. (override_options): Set mark_machine_status. From-SVN: r29143
This commit is contained in:
parent
2e28f042c0
commit
1526a0606b
@ -659,7 +659,7 @@ SUBDIR_FLAGS_TO_PASS = $(ORDINARY_FLAGS_TO_PASS) \
|
||||
|
||||
# Language-specific object files for C and Objective C.
|
||||
C_AND_OBJC_OBJS = c-lex.o c-pragma.o c-decl.o c-typeck.o c-convert.o \
|
||||
c-aux-info.o c-common.o c-iterate.o ggc-callbacks.o @extra_c_objs@
|
||||
c-aux-info.o c-common.o c-iterate.o @extra_c_objs@
|
||||
|
||||
# Language-specific object files for C.
|
||||
C_OBJS = c-parse.o c-lang.o $(C_AND_OBJC_OBJS)
|
||||
@ -1312,7 +1312,7 @@ s-crt0: $(CRT0_S) $(MCRT0_S) $(GCC_PASSES) $(CONFIG_H)
|
||||
|
||||
# C language specific files.
|
||||
|
||||
c-parse.o : $(srcdir)/c-parse.c $(CONFIG_H) $(TREE_H) c-lex.h \
|
||||
c-parse.o : $(srcdir)/c-parse.c $(CONFIG_H) $(TREE_H) c-lex.h ggc.h \
|
||||
$(srcdir)/c-parse.h c-tree.h c-common.h input.h flags.h system.h toplev.h
|
||||
$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c $(srcdir)/c-parse.c
|
||||
$(srcdir)/c-parse.h: $(srcdir)/c-parse.c
|
||||
@ -1330,15 +1330,15 @@ $(srcdir)/c-gperf.h: c-parse.gperf
|
||||
-k1,3,$$ $(srcdir)/c-parse.gperf >tmp-gperf.h
|
||||
$(srcdir)/move-if-change tmp-gperf.h $(srcdir)/c-gperf.h
|
||||
|
||||
c-decl.o : c-decl.c $(CONFIG_H) system.h $(TREE_H) c-tree.h c-common.h \
|
||||
c-decl.o : c-decl.c $(CONFIG_H) system.h $(TREE_H) c-tree.h c-common.h ggc.h \
|
||||
c-lex.h flags.h function.h output.h toplev.h defaults.h
|
||||
c-typeck.o : c-typeck.c $(CONFIG_H) system.h $(TREE_H) c-tree.h c-common.h \
|
||||
flags.h intl.h output.h $(EXPR_H) $(RTL_H) toplev.h
|
||||
c-lang.o : c-lang.c $(CONFIG_H) system.h $(TREE_H) c-tree.h c-common.h \
|
||||
c-lang.o : c-lang.c $(CONFIG_H) system.h $(TREE_H) c-tree.h c-common.h ggc.h \
|
||||
c-lex.h toplev.h output.h function.h
|
||||
c-lex.o : c-lex.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) c-lex.h c-tree.h \
|
||||
c-common.h $(srcdir)/c-parse.h $(srcdir)/c-gperf.h c-pragma.h input.h \
|
||||
intl.h flags.h toplev.h output.h mbchar.h
|
||||
intl.h flags.h toplev.h output.h mbchar.h ggc.h
|
||||
c-aux-info.o : c-aux-info.c $(CONFIG_H) system.h $(TREE_H) c-tree.h \
|
||||
c-common.h flags.h toplev.h
|
||||
c-convert.o : c-convert.c $(CONFIG_H) system.h $(TREE_H) flags.h toplev.h
|
||||
@ -1395,7 +1395,7 @@ s-under: $(GCC_PASSES)
|
||||
# A file used by all variants of C.
|
||||
|
||||
c-common.o : c-common.c $(CONFIG_H) system.h $(TREE_H) c-tree.h c-lex.h \
|
||||
c-common.h flags.h toplev.h output.h c-pragma.h $(RTL_H)
|
||||
c-common.h flags.h toplev.h output.h c-pragma.h $(RTL_H) ggc.h
|
||||
|
||||
# Language-independent files.
|
||||
|
||||
@ -1602,7 +1602,7 @@ reg-stack.o : reg-stack.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) recog.h \
|
||||
dyn-string.o: dyn-string.c dyn-string.h $(CONFIG_H) system.h
|
||||
lists.o: lists.c $(CONFIG_H) system.h toplev.h $(RTL_H)
|
||||
|
||||
$(out_object_file): $(out_file) $(CONFIG_H) $(TREE_H) \
|
||||
$(out_object_file): $(out_file) $(CONFIG_H) $(TREE_H) ggc.h \
|
||||
$(RTL_H) $(REGS_H) hard-reg-set.h real.h insn-config.h conditions.h \
|
||||
insn-flags.h output.h insn-attr.h insn-codes.h system.h toplev.h function.h
|
||||
$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(out_file)
|
||||
|
@ -29,6 +29,7 @@ Boston, MA 02111-1307, USA. */
|
||||
#include "output.h"
|
||||
#include "c-pragma.h"
|
||||
#include "rtl.h"
|
||||
#include "ggc.h"
|
||||
|
||||
#if USE_CPPLIB
|
||||
#include "cpplib.h"
|
||||
@ -347,7 +348,7 @@ combine_strings (strings)
|
||||
if (wide_flag)
|
||||
length = length * wchar_bytes + wide_length;
|
||||
|
||||
p = savealloc (length);
|
||||
p = ggc_p ? ggc_alloc_string (NULL, length) : savealloc (length);
|
||||
|
||||
/* Copy the individual strings into the new combined string.
|
||||
If the combined string is wide, convert the chars to ints
|
||||
|
106
gcc/c-decl.c
106
gcc/c-decl.c
@ -36,6 +36,7 @@ Boston, MA 02111-1307, USA. */
|
||||
#include "c-lex.h"
|
||||
#include "toplev.h"
|
||||
#include "defaults.h"
|
||||
#include "ggc.h"
|
||||
|
||||
#if USE_CPPLIB
|
||||
#include "cpplib.h"
|
||||
@ -105,6 +106,9 @@ enum decl_context
|
||||
#define WCHAR_TYPE "int"
|
||||
#endif
|
||||
|
||||
/* Don't do GC. */
|
||||
int ggc_p = 0;
|
||||
|
||||
/* a node which has tree code ERROR_MARK, and whose type is itself.
|
||||
All erroneous expressions are replaced with this node. All functions
|
||||
that accept nodes as arguments should avoid generating error messages
|
||||
@ -342,6 +346,7 @@ tree static_ctors, static_dtors;
|
||||
/* Forward declarations. */
|
||||
|
||||
static struct binding_level * make_binding_level PROTO((void));
|
||||
static void mark_binding_level PROTO((void *));
|
||||
static void clear_limbo_values PROTO((tree));
|
||||
static int duplicate_decls PROTO((tree, tree, int));
|
||||
static int redeclaration_error_message PROTO((tree, tree));
|
||||
@ -2928,6 +2933,25 @@ lookup_name_current_level (name)
|
||||
return t;
|
||||
}
|
||||
|
||||
/* Mark ARG for GC. */
|
||||
void
|
||||
mark_binding_level (arg)
|
||||
void *arg;
|
||||
{
|
||||
struct binding_level *level = *(struct binding_level **) arg;
|
||||
|
||||
while (level)
|
||||
{
|
||||
ggc_mark_tree (level->names);
|
||||
ggc_mark_tree (level->tags);
|
||||
ggc_mark_tree (level->shadowed);
|
||||
ggc_mark_tree (level->blocks);
|
||||
ggc_mark_tree (level->this_block);
|
||||
ggc_mark_tree (level->parm_order);
|
||||
level = level->level_chain;
|
||||
}
|
||||
}
|
||||
|
||||
/* Create the predefined scalar types of C,
|
||||
and some nodes representing standard constants (0, 1, (void *) 0).
|
||||
Initialize the global binding level.
|
||||
@ -3222,6 +3246,31 @@ init_decl_processing ()
|
||||
incomplete_decl_finalize_hook = finish_incomplete_decl;
|
||||
|
||||
lang_get_alias_set = c_get_alias_set;
|
||||
|
||||
/* Record our roots. */
|
||||
|
||||
ggc_add_tree_root (c_global_trees, CTI_MAX);
|
||||
ggc_add_tree_root (¤t_function_decl, 1);
|
||||
ggc_add_tree_root (&error_mark_node, 1);
|
||||
ggc_add_tree_root (&ptr_type_node, 1);
|
||||
ggc_add_tree_root (&va_list_type_node, 1);
|
||||
ggc_add_tree_root (&void_type_node, 1);
|
||||
ggc_add_tree_root (&char_type_node, 1);
|
||||
ggc_add_tree_root (&integer_type_node, 1);
|
||||
ggc_add_tree_root (&unsigned_type_node, 1);
|
||||
ggc_add_tree_root (&integer_one_node, 1);
|
||||
ggc_add_tree_root (&integer_zero_node, 1);
|
||||
ggc_add_tree_root (&named_labels, 1);
|
||||
ggc_add_tree_root (&null_pointer_node, 1);
|
||||
ggc_add_tree_root (&size_one_node, 1);
|
||||
ggc_add_tree_root (&size_zero_node, 1);
|
||||
ggc_add_tree_root (&shadowed_labels, 1);
|
||||
ggc_add_root (¤t_binding_level, 1, sizeof current_binding_level,
|
||||
mark_binding_level);
|
||||
ggc_add_root (&label_level_chain, 1, sizeof label_level_chain,
|
||||
mark_binding_level);
|
||||
ggc_add_tree_root (&static_ctors, 1);
|
||||
ggc_add_tree_root (&static_dtors, 1);
|
||||
}
|
||||
|
||||
/* Return a definition for a builtin function named NAME and whose data type
|
||||
@ -7048,6 +7097,21 @@ pop_c_function_context (f)
|
||||
f->language = 0;
|
||||
}
|
||||
|
||||
/* Mark the language specific parts of F for GC. */
|
||||
void
|
||||
mark_c_function_context (f)
|
||||
struct function *f;
|
||||
{
|
||||
struct language_function *p = f->language;
|
||||
|
||||
if (p == 0)
|
||||
return;
|
||||
|
||||
ggc_mark_tree (p->shadowed_labels);
|
||||
ggc_mark_tree (p->named_labels);
|
||||
mark_binding_level (&p->binding_level);
|
||||
}
|
||||
|
||||
/* integrate_decl_tree calls this function, but since we don't use the
|
||||
DECL_LANG_SPECIFIC field, this is a no-op. */
|
||||
|
||||
@ -7056,3 +7120,45 @@ copy_lang_decl (node)
|
||||
tree node ATTRIBUTE_UNUSED;
|
||||
{
|
||||
}
|
||||
|
||||
/* Mark ARG for GC. */
|
||||
void
|
||||
lang_mark_false_label_stack (arg)
|
||||
struct label_node *arg;
|
||||
{
|
||||
/* C doesn't use false_label_stack. It better be NULL. */
|
||||
if (arg != NULL)
|
||||
abort();
|
||||
}
|
||||
|
||||
/* Mark the language specific bits in T for GC. */
|
||||
void
|
||||
lang_mark_tree (t)
|
||||
tree t;
|
||||
{
|
||||
if (TREE_CODE (t) == IDENTIFIER_NODE)
|
||||
{
|
||||
struct lang_identifier *i = (struct lang_identifier *) t;
|
||||
ggc_mark_tree (i->global_value);
|
||||
ggc_mark_tree (i->local_value);
|
||||
ggc_mark_tree (i->label_value);
|
||||
ggc_mark_tree (i->implicit_decl);
|
||||
ggc_mark_tree (i->error_locus);
|
||||
ggc_mark_tree (i->limbo_value);
|
||||
}
|
||||
}
|
||||
|
||||
/* Free the language specific bits in T for GC. */
|
||||
void
|
||||
lang_cleanup_tree (t)
|
||||
tree t;
|
||||
{
|
||||
if (TREE_CODE_CLASS (TREE_CODE (t)) == 't'
|
||||
&& TYPE_LANG_SPECIFIC (t) != NULL)
|
||||
{
|
||||
#if 0
|
||||
/* This is currently allocated with an obstack. This will change. */
|
||||
free (TYPE_LANG_SPECIFIC (t));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ Boston, MA 02111-1307, USA. */
|
||||
#include "c-lex.h"
|
||||
#include "toplev.h"
|
||||
#include "output.h"
|
||||
#include "ggc.h"
|
||||
|
||||
#if USE_CPPLIB
|
||||
#include "cpplib.h"
|
||||
@ -72,6 +73,9 @@ lang_init ()
|
||||
|
||||
save_lang_status = &push_c_function_context;
|
||||
restore_lang_status = &pop_c_function_context;
|
||||
mark_lang_status = &mark_c_function_context;
|
||||
|
||||
c_parse_init ();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -32,6 +32,7 @@ Boston, MA 02111-1307, USA. */
|
||||
#include "c-pragma.h"
|
||||
#include "toplev.h"
|
||||
#include "intl.h"
|
||||
#include "ggc.h"
|
||||
|
||||
/* MULTIBYTE_CHARS support only works for native compilers.
|
||||
??? Ideally what we want is to model widechar support after
|
||||
@ -752,7 +753,7 @@ linenum:
|
||||
goto skipline;
|
||||
}
|
||||
|
||||
if (!TREE_PERMANENT (yylval.ttype))
|
||||
if (! ggc_p && !TREE_PERMANENT (yylval.ttype))
|
||||
{
|
||||
input_filename
|
||||
= (char *) permalloc (TREE_STRING_LENGTH (yylval.ttype) + 1);
|
||||
|
785
gcc/c-parse.c
785
gcc/c-parse.c
File diff suppressed because it is too large
Load Diff
@ -46,7 +46,8 @@ end ifc
|
||||
#include "flags.h"
|
||||
#include "output.h"
|
||||
#include "toplev.h"
|
||||
|
||||
#include "ggc.h"
|
||||
|
||||
#ifdef MULTIBYTE_CHARS
|
||||
#include <locale.h>
|
||||
#endif
|
||||
@ -245,6 +246,16 @@ end ifobjc
|
||||
|
||||
#define YYPRINT(FILE,YYCHAR,YYLVAL) yyprint(FILE,YYCHAR,YYLVAL)
|
||||
extern void yyprint PROTO ((FILE *, int, YYSTYPE));
|
||||
|
||||
/* Add GC roots for variables local to this file. */
|
||||
void
|
||||
c_parse_init ()
|
||||
{
|
||||
ggc_add_tree_root (&declspec_stack, 1);
|
||||
ggc_add_tree_root (¤t_declspecs, 1);
|
||||
ggc_add_tree_root (&prefix_attributes, 1);
|
||||
}
|
||||
|
||||
%}
|
||||
|
||||
%%
|
||||
|
@ -42,7 +42,8 @@ Boston, MA 02111-1307, USA. */
|
||||
#include "flags.h"
|
||||
#include "output.h"
|
||||
#include "toplev.h"
|
||||
|
||||
#include "ggc.h"
|
||||
|
||||
#ifdef MULTIBYTE_CHARS
|
||||
#include <locale.h>
|
||||
#endif
|
||||
@ -207,6 +208,16 @@ static int undeclared_variable_notice;
|
||||
|
||||
#define YYPRINT(FILE,YYCHAR,YYLVAL) yyprint(FILE,YYCHAR,YYLVAL)
|
||||
extern void yyprint PROTO ((FILE *, int, YYSTYPE));
|
||||
|
||||
/* Add GC roots for variables local to this file. */
|
||||
void
|
||||
c_parse_init ()
|
||||
{
|
||||
ggc_add_tree_root (&declspec_stack, 1);
|
||||
ggc_add_tree_root (¤t_declspecs, 1);
|
||||
ggc_add_tree_root (&prefix_attributes, 1);
|
||||
}
|
||||
|
||||
%}
|
||||
|
||||
%%
|
||||
|
@ -174,6 +174,9 @@ extern tree maybe_objc_method_name PROTO((tree));
|
||||
extern int recognize_objc_keyword PROTO((void));
|
||||
extern tree build_objc_string PROTO((int, const char *));
|
||||
|
||||
/* in c-parse.in */
|
||||
extern void c_parse_init PROTO((void));
|
||||
|
||||
/* in c-aux-info.c */
|
||||
extern void gen_aux_info_record PROTO((tree, int, int, int));
|
||||
|
||||
@ -222,6 +225,7 @@ extern tree lookup_name_current_level_global PROTO((tree));
|
||||
extern tree maybe_build_cleanup PROTO((tree));
|
||||
extern void parmlist_tags_warning PROTO((void));
|
||||
extern void pending_xref_error PROTO((void));
|
||||
extern void mark_c_function_context PROTO((struct function *));
|
||||
extern void push_c_function_context PROTO((struct function *));
|
||||
extern void pop_c_function_context PROTO((struct function *));
|
||||
extern void pop_label_level PROTO((void));
|
||||
|
@ -38,6 +38,7 @@ Boston, MA 02111-1307, USA. */
|
||||
#include "expr.h"
|
||||
#include "toplev.h"
|
||||
#include "basic-block.h"
|
||||
#include "ggc.h"
|
||||
|
||||
#ifdef EXTRA_CONSTRAINT
|
||||
/* If EXTRA_CONSTRAINT is defined, then the 'S'
|
||||
@ -248,6 +249,7 @@ static void ix86_reorder_insn PROTO ((rtx *, rtx *));
|
||||
static rtx * ix86_pent_find_pair PROTO ((rtx *, rtx *, enum attr_pent_pair,
|
||||
rtx));
|
||||
static void ix86_init_machine_status PROTO ((struct function *));
|
||||
static void ix86_mark_machine_status PROTO ((struct function *));
|
||||
|
||||
struct ix86_address
|
||||
{
|
||||
@ -353,6 +355,7 @@ override_options ()
|
||||
|
||||
/* Arrange to set up i386_stack_locals for all functions. */
|
||||
init_machine_status = ix86_init_machine_status;
|
||||
mark_machine_status = ix86_mark_machine_status;
|
||||
|
||||
/* Validate registers in register allocation order. */
|
||||
if (ix86_reg_alloc_order)
|
||||
@ -4962,7 +4965,7 @@ ix86_expand_strlensi_unroll_1 (out, align_rtx, scratch)
|
||||
|
||||
static void
|
||||
ix86_init_machine_status (p)
|
||||
struct function *p;
|
||||
struct function *p;
|
||||
{
|
||||
enum machine_mode mode;
|
||||
int n;
|
||||
@ -4975,6 +4978,20 @@ ix86_init_machine_status (p)
|
||||
ix86_stack_locals[(int) mode][n] = NULL_RTX;
|
||||
}
|
||||
|
||||
/* Mark machine specific bits of P for GC. */
|
||||
static void
|
||||
ix86_mark_machine_status (p)
|
||||
struct function *p;
|
||||
{
|
||||
enum machine_mode mode;
|
||||
int n;
|
||||
|
||||
for (mode = VOIDmode; (int) mode < (int) MAX_MACHINE_MODE;
|
||||
mode = (enum machine_mode) ((int) mode + 1))
|
||||
for (n = 0; n < MAX_386_STACK_LOCALS; n++)
|
||||
ggc_mark_rtx (p->machine->stack_locals[(int) mode][n]);
|
||||
}
|
||||
|
||||
/* Return a MEM corresponding to a stack slot with mode MODE.
|
||||
Allocate a new slot if necessary.
|
||||
|
||||
|
@ -65,7 +65,7 @@ cc1obj$(exeext): $(P) $(OBJS) $(OBJC_OBJS) $(LIBDEPS)
|
||||
# Objective C language specific files.
|
||||
|
||||
objc-parse.o : $(srcdir)/objc/objc-parse.c \
|
||||
$(CONFIG_H) $(TREE_H) $(srcdir)/toplev.h \
|
||||
$(CONFIG_H) $(TREE_H) $(srcdir)/toplev.h $(srcdir)/ggc.h \
|
||||
$(srcdir)/c-lex.h $(srcdir)/c-tree.h $(srcdir)/c-common.h \
|
||||
$(srcdir)/input.h $(srcdir)/flags.h $(srcdir)/output.h \
|
||||
$(srcdir)/objc/objc-act.h system.h
|
||||
|
Loading…
Reference in New Issue
Block a user