From b7286a11d1a842e8a75c928aca151e1c04413043 Mon Sep 17 00:00:00 2001 From: Geoffrey Keating Date: Thu, 14 Nov 2002 17:46:31 +0000 Subject: Index: ChangeLog 2002-11-13 Geoffrey Keating * Makefile.in (GTFILES): Add cpplib.h. * c-common.h (struct c_common_identifier): Don't skip 'node' field. * c-decl.c (build_compound_literal): Don't use var_labelno. * cpplib.h (struct cpp_hashnode): Use gengtype to mark. * dwarf2asm.c (dw2_force_const_mem): Don't use const_labelno. * varasm.c (const_labelno): Use gengtype to mark. (var_labelno): Likewise. (in_section): Likewise. (in_named_name): Likewise. (struct in_named_entry): Likewise. (in_named_htab): Likewise. (set_named_section_flags): Use GGC to allocate struct in_named_entry. (init_varasm_once): Use GGC to allocate in_named_htab. * config/darwin.c (current_pic_label_num): Mark for PCH. Index: testsuite/ChangeLog 2002-11-13 Geoffrey Keating * gcc.dg/pch/pch.exp: Ensure that .hp doesn't exist before running test. * gcc.dg/pch: Include *.hp not *.h. * gcc.dg/pch/system-1.h: New. * gcc.dg/pch/system-1.c: New. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/pch-branch@59106 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 17 +++++++++++++++++ gcc/Makefile.in | 2 +- gcc/c-common.h | 2 +- gcc/c-decl.c | 8 +++++--- gcc/config/darwin.c | 2 +- gcc/cpplib.h | 18 +++++++++++------- gcc/dwarf2asm.c | 7 ++++--- gcc/testsuite/ChangeLog | 8 ++++++++ gcc/testsuite/gcc.dg/pch/common-1.c | 2 +- gcc/testsuite/gcc.dg/pch/decl-1.c | 2 +- gcc/testsuite/gcc.dg/pch/decl-2.c | 2 +- gcc/testsuite/gcc.dg/pch/decl-3.c | 2 +- gcc/testsuite/gcc.dg/pch/decl-4.c | 2 +- gcc/testsuite/gcc.dg/pch/decl-5.c | 2 +- gcc/testsuite/gcc.dg/pch/global-1.c | 2 +- gcc/testsuite/gcc.dg/pch/inline-1.c | 2 +- gcc/testsuite/gcc.dg/pch/inline-2.c | 2 +- gcc/testsuite/gcc.dg/pch/pch.exp | 1 + gcc/testsuite/gcc.dg/pch/static-1.c | 2 +- gcc/testsuite/gcc.dg/pch/static-2.c | 2 +- gcc/testsuite/gcc.dg/pch/system-1.c | 6 ++++++ gcc/testsuite/gcc.dg/pch/system-1.h | 2 ++ gcc/varasm.c | 21 +++++++++++---------- 23 files changed, 79 insertions(+), 37 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/pch/system-1.c create mode 100644 gcc/testsuite/gcc.dg/pch/system-1.h diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e8dcd8c450c..2161ed45cd9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,20 @@ +2002-11-13 Geoffrey Keating + + * Makefile.in (GTFILES): Add cpplib.h. + * c-common.h (struct c_common_identifier): Don't skip 'node' field. + * c-decl.c (build_compound_literal): Don't use var_labelno. + * cpplib.h (struct cpp_hashnode): Use gengtype to mark. + * dwarf2asm.c (dw2_force_const_mem): Don't use const_labelno. + * varasm.c (const_labelno): Use gengtype to mark. + (var_labelno): Likewise. + (in_section): Likewise. + (in_named_name): Likewise. + (struct in_named_entry): Likewise. + (in_named_htab): Likewise. + (set_named_section_flags): Use GGC to allocate struct in_named_entry. + (init_varasm_once): Use GGC to allocate in_named_htab. + * config/darwin.c (current_pic_label_num): Mark for PCH. + 2002-11-11 Geoffrey Keating * ggc-simple.c (init_ggc_pch): New stub procedure. diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 7a31b900f46..d76b20a8e98 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -1838,7 +1838,7 @@ s-preds: genpreds$(build_exeext) $(srcdir)/move-if-change $(STAMP) s-preds GTFILES = $(GCONFIG_H) \ - $(HASHTAB_H) $(SPLAY_TREE_H) \ + $(HASHTAB_H) $(SPLAY_TREE_H) $(srcdir)/cpplib.h \ $(srcdir)/location.h $(srcdir)/bitmap.h $(srcdir)/function.h \ $(srcdir)/rtl.h $(srcdir)/optabs.h $(srcdir)/tree.h $(srcdir)/libfuncs.h \ $(srcdir)/hashtable.h $(srcdir)/real.h \ diff --git a/gcc/c-common.h b/gcc/c-common.h index a9f57e0829c..d6f135baec6 100644 --- a/gcc/c-common.h +++ b/gcc/c-common.h @@ -181,7 +181,7 @@ enum c_tree_index struct c_common_identifier GTY(()) { struct tree_common common; - struct cpp_hashnode GTY ((skip (""))) node; + struct cpp_hashnode node; }; #define wchar_type_node c_global_trees[CTI_WCHAR_TYPE] diff --git a/gcc/c-decl.c b/gcc/c-decl.c index e5a43fe0f25..6d53e70b65e 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -3211,6 +3211,8 @@ clear_parm_order () current_binding_level->parm_order = NULL_TREE; } +static GTY(()) int compound_literal_number; + /* Build a COMPOUND_LITERAL_EXPR. TYPE is the type given in the compound literal, which may be an incomplete array type completed by the initializer; INIT is a CONSTRUCTOR that initializes the compound @@ -3258,10 +3260,10 @@ build_compound_literal (type, init) /* This decl needs a name for the assembler output. We also need a unique suffix to be added to the name. */ char *name; - extern int var_labelno; - ASM_FORMAT_PRIVATE_NAME (name, "__compound_literal", var_labelno); - var_labelno++; + ASM_FORMAT_PRIVATE_NAME (name, "__compound_literal", + compound_literal_number); + compound_literal_number++; DECL_NAME (decl) = get_identifier (name); DECL_DEFER_OUTPUT (decl) = 1; DECL_COMDAT (decl) = 1; diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c index 3722950f634..59ed9dc4339 100644 --- a/gcc/config/darwin.c +++ b/gcc/config/darwin.c @@ -221,7 +221,7 @@ machopic_define_name (name) static char function_base[32]; -static int current_pic_label_num; +static GTY(()) int current_pic_label_num; const char * machopic_function_base_name () diff --git a/gcc/cpplib.h b/gcc/cpplib.h index ee1395384da..e82099df314 100644 --- a/gcc/cpplib.h +++ b/gcc/cpplib.h @@ -482,7 +482,7 @@ enum builtin_type /* The common part of an identifier node shared amongst all 3 C front ends. Also used to store CPP identifiers, which are a superset of identifiers in the grammatical sense. */ -struct cpp_hashnode +struct cpp_hashnode GTY(()) { struct ht_identifier ident; unsigned short arg_index; /* Macro argument index. */ @@ -491,13 +491,17 @@ struct cpp_hashnode ENUM_BITFIELD(node_type) type : 8; /* CPP node type. */ unsigned char flags; /* CPP flags. */ - union + union cpp_hashnode_u { - cpp_macro *macro; /* If a macro. */ - struct answer *answers; /* Answers to an assertion. */ - enum cpp_ttype operator; /* Code for a named operator. */ - enum builtin_type builtin; /* Code for a builtin macro. */ - } value; + /* If a macro. */ + cpp_macro * GTY((skip (""))) macro; + /* Answers to an assertion. */ + struct answer * GTY ((skip (""))) answers; + /* Code for a named operator. */ + enum cpp_ttype GTY ((tag ("0"))) operator; + /* Code for a builtin macro. */ + enum builtin_type GTY ((tag ("1"))) builtin; + } GTY ((desc ("0"))) value; }; /* Call this first to get a handle to pass to other functions. */ diff --git a/gcc/dwarf2asm.c b/gcc/dwarf2asm.c index c856c0f3c26..711678fd078 100644 --- a/gcc/dwarf2asm.c +++ b/gcc/dwarf2asm.c @@ -692,6 +692,8 @@ static int dw2_output_indirect_constant_1 PARAMS ((splay_tree_node, void *)); static GTY((param1_is (char *), param2_is (tree))) splay_tree indirect_pool; +static GTY(()) int dw2_const_labelno; + #if defined(HAVE_GAS_HIDDEN) && defined(SUPPORTS_ONE_ONLY) # define USE_LINKONCE_INDIRECT 1 #else @@ -739,11 +741,10 @@ dw2_force_const_mem (x) } else { - extern int const_labelno; char label[32]; - ASM_GENERATE_INTERNAL_LABEL (label, "LC", const_labelno); - ++const_labelno; + ASM_GENERATE_INTERNAL_LABEL (label, "LDFCM", dw2_const_labelno); + ++dw2_const_labelno; id = get_identifier (label); decl = build_decl (VAR_DECL, id, ptr_type_node); DECL_ARTIFICIAL (decl) = 1; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f6d7e8401c9..025e433f938 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2002-11-13 Geoffrey Keating + + * gcc.dg/pch/pch.exp: Ensure that .hp doesn't exist before + running test. + * gcc.dg/pch: Include *.hp not *.h. + * gcc.dg/pch/system-1.h: New. + * gcc.dg/pch/system-1.c: New. + 2002-11-11 Geoffrey Keating * gcc.dg/pch/pch.exp: Compare .s files with/without PCH, diff --git a/gcc/testsuite/gcc.dg/pch/common-1.c b/gcc/testsuite/gcc.dg/pch/common-1.c index ec573102853..dcf148a2a72 100644 --- a/gcc/testsuite/gcc.dg/pch/common-1.c +++ b/gcc/testsuite/gcc.dg/pch/common-1.c @@ -1,3 +1,3 @@ -#include "common-1.h" +#include "common-1.hp" int foo2 = 3; int zz = 2; diff --git a/gcc/testsuite/gcc.dg/pch/decl-1.c b/gcc/testsuite/gcc.dg/pch/decl-1.c index 5d6bb1d4aaf..e4120704d9b 100644 --- a/gcc/testsuite/gcc.dg/pch/decl-1.c +++ b/gcc/testsuite/gcc.dg/pch/decl-1.c @@ -1,2 +1,2 @@ -#include "decl-1.h" +#include "decl-1.hp" int main(void) { return foo; } diff --git a/gcc/testsuite/gcc.dg/pch/decl-2.c b/gcc/testsuite/gcc.dg/pch/decl-2.c index 72b6538b932..c374a17e3f7 100644 --- a/gcc/testsuite/gcc.dg/pch/decl-2.c +++ b/gcc/testsuite/gcc.dg/pch/decl-2.c @@ -1,2 +1,2 @@ -#include "decl-2.h" +#include "decl-2.hp" int main(void) { return fun (1, 2); } diff --git a/gcc/testsuite/gcc.dg/pch/decl-3.c b/gcc/testsuite/gcc.dg/pch/decl-3.c index c12abbb1cf4..9c95b9ad08e 100644 --- a/gcc/testsuite/gcc.dg/pch/decl-3.c +++ b/gcc/testsuite/gcc.dg/pch/decl-3.c @@ -1,4 +1,4 @@ -#include "decl-3.h" +#include "decl-3.hp" foo_p bar (void) { diff --git a/gcc/testsuite/gcc.dg/pch/decl-4.c b/gcc/testsuite/gcc.dg/pch/decl-4.c index 61affdbc0c8..3efe3829ffc 100644 --- a/gcc/testsuite/gcc.dg/pch/decl-4.c +++ b/gcc/testsuite/gcc.dg/pch/decl-4.c @@ -1,4 +1,4 @@ -#include "decl-4.h" +#include "decl-4.hp" int bar (foo_p f) { diff --git a/gcc/testsuite/gcc.dg/pch/decl-5.c b/gcc/testsuite/gcc.dg/pch/decl-5.c index 705c2fe0df1..f94b33a1363 100644 --- a/gcc/testsuite/gcc.dg/pch/decl-5.c +++ b/gcc/testsuite/gcc.dg/pch/decl-5.c @@ -1,2 +1,2 @@ -#include "decl-5.h" +#include "decl-5.hp" static int (*t)(void) = foo; diff --git a/gcc/testsuite/gcc.dg/pch/global-1.c b/gcc/testsuite/gcc.dg/pch/global-1.c index c1cff5f1c53..4cab062345e 100644 --- a/gcc/testsuite/gcc.dg/pch/global-1.c +++ b/gcc/testsuite/gcc.dg/pch/global-1.c @@ -1,2 +1,2 @@ -#include "global-1.h" +#include "global-1.hp" const int bar = 3; diff --git a/gcc/testsuite/gcc.dg/pch/inline-1.c b/gcc/testsuite/gcc.dg/pch/inline-1.c index 38fad39c459..7fc32d7f766 100644 --- a/gcc/testsuite/gcc.dg/pch/inline-1.c +++ b/gcc/testsuite/gcc.dg/pch/inline-1.c @@ -1,4 +1,4 @@ -#include "inline-1.h" +#include "inline-1.hp" int bar(int a, int b) { return foo(a) + b; diff --git a/gcc/testsuite/gcc.dg/pch/inline-2.c b/gcc/testsuite/gcc.dg/pch/inline-2.c index 59b238a3b7a..7792c828b92 100644 --- a/gcc/testsuite/gcc.dg/pch/inline-2.c +++ b/gcc/testsuite/gcc.dg/pch/inline-2.c @@ -1,4 +1,4 @@ -#include "inline-2.h" +#include "inline-2.hp" extern inline char bar(int a) { diff --git a/gcc/testsuite/gcc.dg/pch/pch.exp b/gcc/testsuite/gcc.dg/pch/pch.exp index b4701f7817e..69422ca3ef0 100644 --- a/gcc/testsuite/gcc.dg/pch/pch.exp +++ b/gcc/testsuite/gcc.dg/pch/pch.exp @@ -40,6 +40,7 @@ foreach test [lsort [glob -nocomplain $srcdir/$subdir/*.c]] { catch { file delete "$bname.h.pch" } catch { file delete "$bname.s" } catch { file delete "$bname.s-pch" } + catch { file delete "$bname.hp" } # We don't try to use the loop-optimizing options, since they are highly # unlikely to make any difference to PCH. diff --git a/gcc/testsuite/gcc.dg/pch/static-1.c b/gcc/testsuite/gcc.dg/pch/static-1.c index 33a13912045..c1816e949b4 100644 --- a/gcc/testsuite/gcc.dg/pch/static-1.c +++ b/gcc/testsuite/gcc.dg/pch/static-1.c @@ -1,4 +1,4 @@ -#include "static-1.h" +#include "static-1.hp" static int bar(void) { static int counter; diff --git a/gcc/testsuite/gcc.dg/pch/static-2.c b/gcc/testsuite/gcc.dg/pch/static-2.c index 23e9af12679..afda874e279 100644 --- a/gcc/testsuite/gcc.dg/pch/static-2.c +++ b/gcc/testsuite/gcc.dg/pch/static-2.c @@ -1,4 +1,4 @@ -#include "static-2.h" +#include "static-2.hp" int bar(void) { static int counter; diff --git a/gcc/testsuite/gcc.dg/pch/system-1.c b/gcc/testsuite/gcc.dg/pch/system-1.c new file mode 100644 index 00000000000..096fe593e06 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pch/system-1.c @@ -0,0 +1,6 @@ +#include "system-1.hp" +int main(void) +{ + puts ("hello world!"); + exit (0); +} diff --git a/gcc/testsuite/gcc.dg/pch/system-1.h b/gcc/testsuite/gcc.dg/pch/system-1.h new file mode 100644 index 00000000000..fbfff34edb0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pch/system-1.h @@ -0,0 +1,2 @@ +#include +#include diff --git a/gcc/varasm.c b/gcc/varasm.c index c36aac0bd61..ba1ef460c02 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -105,12 +105,12 @@ struct varasm_status GTY(()) /* Number for making the label on the next constant that is stored in memory. */ -int const_labelno; +static GTY(()) int const_labelno; /* Number for making the label on the next static variable internal to a function. */ -int var_labelno; +static GTY(()) int var_labelno; /* Carry information from ASM_DECLARE_OBJECT_NAME to ASM_FINISH_DECLARE_OBJECT. */ @@ -177,7 +177,7 @@ static bool asm_emit_uninitialised PARAMS ((tree, const char*, int, int)); static void resolve_unique_section PARAMS ((tree, int, int)); static void mark_weak PARAMS ((tree)); -static enum in_section { no_section, in_text, in_data, in_named +enum in_section { no_section, in_text, in_data, in_named #ifdef BSS_SECTION_ASM_OP , in_bss #endif @@ -193,7 +193,8 @@ static enum in_section { no_section, in_text, in_data, in_named #ifdef EXTRA_SECTIONS , EXTRA_SECTIONS #endif -} in_section = no_section; +}; +static GTY(()) enum in_section in_section = no_section; /* Return a nonzero value if DECL has a section attribute. */ #ifndef IN_NAMED_SECTION @@ -203,18 +204,18 @@ static enum in_section { no_section, in_text, in_data, in_named #endif /* Text of section name when in_section == in_named. */ -static const char *in_named_name; +static GTY(()) const char *in_named_name; /* Hash table of flags that have been used for a particular named section. */ -struct in_named_entry +struct in_named_entry GTY(()) { const char *name; unsigned int flags; bool declared; }; -static htab_t in_named_htab; +static GTY((param_is (struct in_named_entry))) htab_t in_named_htab; /* Define functions like text_section for any extra sections. */ #ifdef EXTRA_SECTION_FUNCTIONS @@ -387,7 +388,7 @@ set_named_section_flags (section, flags) if (!entry) { - entry = (struct in_named_entry *) xmalloc (sizeof (*entry)); + entry = (struct in_named_entry *) ggc_alloc (sizeof (*entry)); *slot = entry; entry->name = ggc_strdup (section); entry->flags = flags; @@ -4721,8 +4722,8 @@ init_varasm_once () { const_str_htab = htab_create_ggc (128, const_str_htab_hash, const_str_htab_eq, NULL); - in_named_htab = htab_create (31, in_named_entry_hash, - in_named_entry_eq, NULL); + in_named_htab = htab_create_ggc (31, in_named_entry_hash, + in_named_entry_eq, NULL); const_alias_set = new_alias_set (); } -- cgit v1.2.3