diff options
author | zack <zack@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-04-07 06:03:17 +0000 |
---|---|---|
committer | zack <zack@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-04-07 06:03:17 +0000 |
commit | 295e387a04a57eea2a4932d20328369452399388 (patch) | |
tree | 85a5a4cad3cfe432c546c4df2134dac37924265c | |
parent | 6fcaa06776757d517ee0abf333c03d431e182bea (diff) | |
download | gcc-295e387a04a57eea2a4932d20328369452399388.tar.gz |
* tree.c (tree_size): For all 'c' and 'x' nodes, look directly
at the sizes of the relevant structures, rather than relying
on TREE_CODE_LENGTH. Call lang_hooks.tree_size to get the
sizes of any such we don't know about. Use
lang_hooks.identifier_size for IDENTIFIER_NODE.
(initializer_zerop): Use CONSTRUCTOR_ELTS.
* tree.def: Update commentary. Make fourth element of
the definition for all 'c' and 'x' nodes zero.
* langhooks.h: New hook, tree_size / LANG_HOOKS_TREE_SIZE.
* langhooks-def.h: Update to match.
* langhooks.c: New default, lhd_tree_size.
* c-common.def (SRCLOC): Kill.
* c-pretty-print.c (pp_c_postfix_expression [case SRCLOC]):
Remove entirely - was already #if-ed out.
ada:
* ada-tree.def: Make fourth element for GNAT_LOOP_ID zero.
* misc.c (gnat_tree_size): New function.
(LANG_HOOKS_TREE_SIZE): Override.
cp:
* cp-tree.def: Make fourth element for all 'c' and 'x' nodes zero.
* cp-lang.c (cp_tree_size): New function.
(LANG_HOOKS_TREE_SIZE): Override.
* cp-tree.h (SOURCE_LOCUS, SRCLOC_FILE, SRCLOC_LINE, struct
tree_srcloc, TS_CP_COMMON, TS_CP_SRCLOC): Kill.
(union lang_tree_node): Remove common and srcloc members.
(build_srcloc_here): Don't prototype.
* decl.c (cp_tree_node_structure): Kill SRCLOC case.
* pt.c (pending_templates): Correct comment.
* tree.c (build_srcloc, build_srcloc_here): Kill.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@65323 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 257 | ||||
-rw-r--r-- | gcc/ada/ChangeLog | 14 | ||||
-rw-r--r-- | gcc/ada/ada-tree.def | 2 | ||||
-rw-r--r-- | gcc/ada/misc.c | 16 | ||||
-rw-r--r-- | gcc/c-common.def | 3 | ||||
-rw-r--r-- | gcc/c-pretty-print.c | 24 | ||||
-rw-r--r-- | gcc/cp/ChangeLog | 16 | ||||
-rw-r--r-- | gcc/cp/cp-lang.c | 21 | ||||
-rw-r--r-- | gcc/cp/cp-tree.def | 21 | ||||
-rw-r--r-- | gcc/cp/cp-tree.h | 16 | ||||
-rw-r--r-- | gcc/cp/decl.c | 1 | ||||
-rw-r--r-- | gcc/cp/pt.c | 9 | ||||
-rw-r--r-- | gcc/cp/tree.c | 21 | ||||
-rw-r--r-- | gcc/langhooks-def.h | 3 | ||||
-rw-r--r-- | gcc/langhooks.c | 11 | ||||
-rw-r--r-- | gcc/langhooks.h | 5 | ||||
-rw-r--r-- | gcc/tree.c | 46 | ||||
-rw-r--r-- | gcc/tree.def | 34 |
18 files changed, 274 insertions, 246 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0b7d3295119..292c63e8ed3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,33 +1,54 @@ 2003-04-06 Zack Weinberg <zack@codesourcery.com> + * tree.c (tree_size): For all 'c' and 'x' nodes, look directly + at the sizes of the relevant structures, rather than relying + on TREE_CODE_LENGTH. Call lang_hooks.tree_size to get the + sizes of any such we don't know about. Use + lang_hooks.identifier_size for IDENTIFIER_NODE. + + (initializer_zerop): Use CONSTRUCTOR_ELTS. + * tree.def: Update commentary. Make fourth element of + the definition for all 'c' and 'x' nodes zero. + + * langhooks.h: New hook, tree_size / LANG_HOOKS_TREE_SIZE. + * langhooks-def.h: Update to match. + * langhooks.c: New default, lhd_tree_size. + + * c-common.def (SRCLOC): Kill. + * c-pretty-print.c (pp_c_postfix_expression [case SRCLOC]): + Remove entirely - was already #if-ed out. + + +2003-04-06 Zack Weinberg <zack@codesourcery.com> + * mklibgcc.in: Use a here document to avoid running afoul of shells that generate control-A from "echo \1". 2003-04-06 Aldy Hernandez <aldyh@redhat.com> - * doc/invoke.texi (RS/6000 and PowerPC Options): Document -mspe - option. + * doc/invoke.texi (RS/6000 and PowerPC Options): Document -mspe + option. - * config/rs6000/eabispe.h (SUBSUBTARGET_OVERRIDE_OPTIONS): Set - rs6000_spe. + * config/rs6000/eabispe.h (SUBSUBTARGET_OVERRIDE_OPTIONS): Set + rs6000_spe. - * config/rs6000/eabi.h (TARGET_E500): Define. + * config/rs6000/eabi.h (TARGET_E500): Define. - * config/rs6000/rs6000.h (TARGET_E500): Define. - (TARGET_OPTIONS): Add spe= option. - Declare rs6000_spe and rs6000_spe_string extern. + * config/rs6000/rs6000.h (TARGET_E500): Define. + (TARGET_OPTIONS): Add spe= option. + Declare rs6000_spe and rs6000_spe_string extern. - * config/rs6000/rs6000.c (branch_positive_comparison_operator): - Change TARGET_SPE to TARGET_E500. - (ccr_bit): Change TARGET_SPE to TARGET_E500. Check for - !TARGET_FPRS. - (print_operand): Same. - (rs6000_generate_compare): Same. - (output_cbranch): Same. - (rs6000_spe): Declare. - (rs6000_spe_string): Declare. - (rs6000_override_options): Call rs6000_parse_spe_option. - (rs6000_parse_spe_option): New. + * config/rs6000/rs6000.c (branch_positive_comparison_operator): + Change TARGET_SPE to TARGET_E500. + (ccr_bit): Change TARGET_SPE to TARGET_E500. Check for + !TARGET_FPRS. + (print_operand): Same. + (rs6000_generate_compare): Same. + (output_cbranch): Same. + (rs6000_spe): Declare. + (rs6000_spe_string): Declare. + (rs6000_override_options): Call rs6000_parse_spe_option. + (rs6000_parse_spe_option): New. 2003-04-06 Steven Bosscher <steven@gcc.gnu.org> @@ -150,15 +171,15 @@ Fri Apr 4 17:43:52 2003 Olivier Hainque <hainque@act-europe.fr> - * emit-rtl.c (get_mem_attrs): Adjust alignment tests determining - use of default attributes to agree MEM_ALIGN macro. + * emit-rtl.c (get_mem_attrs): Adjust alignment tests determining + use of default attributes to agree MEM_ALIGN macro. Fri Apr 4 17:33:24 2003 Joel Brobecker <brobecker@gnat.com> - * dbxout.c (dbxout_type): When printing type index of range type + * dbxout.c (dbxout_type): When printing type index of range type whose bounds are printed in octal format, print type of parent type if it exists so enumerated type descriptions are not transformed - into unsigned types. + into unsigned types. 2003-04-04 Kazu Hirata <kazu@cs.umass.edu> @@ -307,7 +328,7 @@ Thu Apr 3 17:08:09 2003 J"orn Rennecke <joern.rennecke@superh.com> 2003-04-03 Nick Clifton <nickc@redhat.com> * config/sparc/sol2-bi.h (ASM_CPU64_DEFAULT_SPEC): Add -TSO. - (DEF_ARCH64_SPEC): Likewise. + (DEF_ARCH64_SPEC): Likewise. Thu Apr 3 09:53:40 CEST 2003 Jan Hubicka <jh@suse.cz> @@ -367,8 +388,8 @@ Thu Apr 3 00:18:49 CEST 2003 Jan Hubicka <jh@suse.cz> 2003-04-02 Richard Henderson <rth@redhat.com> - * dwarf2out.c (output_call_frame_info): Ignore fde->nothrow as an - optimization when flag_exceptions not enabled. + * dwarf2out.c (output_call_frame_info): Ignore fde->nothrow as an + optimization when flag_exceptions not enabled. 2003-04-02 Vladimir Makarov <vmakarov@redhat.com> @@ -394,42 +415,42 @@ Thu Apr 3 00:18:49 CEST 2003 Jan Hubicka <jh@suse.cz> 2003-04-01 Richard Henderson <rth@redhat.com> - * except.c (convert_from_eh_region_ranges_1): Smash REG_EH_REGION - notes for nothrow calls if flag_forced_unwind_exceptions. - (build_post_landing_pads): Mind flag_forced_unwind_exceptions. - (sjlj_find_directly_reachable_regions): Likewise. - (reachable_handlers): Likewise. - (can_throw_external): Likewise. - (collect_one_action_chain): Record cleanups after catch-all and - must-not-throw if flag_forced_unwind_exceptions. - * flags.h (flag_forced_unwind_exceptions): Declare. - * toplev.c (flag_forced_unwind_exceptions): New. - (lang_independent_options): Add it. + * except.c (convert_from_eh_region_ranges_1): Smash REG_EH_REGION + notes for nothrow calls if flag_forced_unwind_exceptions. + (build_post_landing_pads): Mind flag_forced_unwind_exceptions. + (sjlj_find_directly_reachable_regions): Likewise. + (reachable_handlers): Likewise. + (can_throw_external): Likewise. + (collect_one_action_chain): Record cleanups after catch-all and + must-not-throw if flag_forced_unwind_exceptions. + * flags.h (flag_forced_unwind_exceptions): Declare. + * toplev.c (flag_forced_unwind_exceptions): New. + (lang_independent_options): Add it. * doc/invoke.text: Add it. 2003-04-01 David Mosberger <davidm@hpl.hp.com> - * config/ia64/crti.asm: Clean up trailing whitespace. - Remove trailing hashes (#) from identifiers. + * config/ia64/crti.asm: Clean up trailing whitespace. + Remove trailing hashes (#) from identifiers. - * config/ia64/crtn.asm: Ditto. + * config/ia64/crtn.asm: Ditto. - * config/ia64/crtend.asm: Remove trailing hashes (#) from - identifiers. - (__do_global_ctors_aux): Align to 32-byte boundary. Add unwind - directives. Drop explicit bundling---it just makes the code - harder to read. Don't save/restore gp needlessly. + * config/ia64/crtend.asm: Remove trailing hashes (#) from + identifiers. + (__do_global_ctors_aux): Align to 32-byte boundary. Add unwind + directives. Drop explicit bundling---it just makes the code + harder to read. Don't save/restore gp needlessly. - * config/ia64/crtbegin.asm: Remove trailing hashes (#) from - identifiers (they're only needed if the identifier would clash - with a register name otherwise). - (__do_global_dtors_aux): Align to 32-byte boundary. Add unwind - directives. Drop explicit bundling---it just makes the code - harder to read. - (__do_jv_register_classes): Ditto. - (.fini_array): Remove "progbits" (newer - assemblers don't like wrong section-types). - (.init_array): Ditto. + * config/ia64/crtbegin.asm: Remove trailing hashes (#) from + identifiers (they're only needed if the identifier would clash + with a register name otherwise). + (__do_global_dtors_aux): Align to 32-byte boundary. Add unwind + directives. Drop explicit bundling---it just makes the code + harder to read. + (__do_jv_register_classes): Ditto. + (.fini_array): Remove "progbits" (newer + assemblers don't like wrong section-types). + (.init_array): Ditto. 2003-04-01 Roger Sayle <roger@eyesopen.com> @@ -546,56 +567,56 @@ Tue Apr 1 18:18:23 CEST 2003 Jan Hubicka <jh@suse.cz> 2003-02-31 Aldy Hernandez <aldyh@redhat.com> - * testsuite/gcc.c-torture/execute/simd-3.c: New. - - * expr.c (expand_expr): Handle VECTOR_CST. - (const_vector_from_tree): New. - - * varasm.c (output_constant): Handle VECTOR_CST. - - * c-typeck.c (digest_init): Build a vector constant from a - VECTOR_TYPE. - - * config/rs6000/rs6000.c: Remove prototype for - easy_vector_constant. - (easy_vector_constant): Add mode parameter. Rewrite to handle - more easy constants. - (rs6000_emit_move): Pass mode to easy_vector_constant. - Call emit_easy_vector_insn for SPE V2SI vector constant moves. - (emit_easy_vector_insn): New. - (easy_vector_same): New. - (EASY_VECTOR_15): New macro. - (EASY_VECTOR_15_ADD_SELF): New macro. - (bdesc_2arg): Rename to xorv2si3. - (easy_vector_constant_add_self): New. - (input_operand): Allow vector constants. - - * config/rs6000/rs6000.h (PREDICATE_CODES): Add - easy_vector_constant, easy_vector_constant_add_self. - (EXTRA_CONSTRAINT): Add 'W'. - - * config/rs6000/rs6000-protos.h: Add prototype for - easy_vector_constant, emit_easy_vector_insn. - - * config/rs6000/altivec.md (xorv8hi3): New. - (xorv16qi3): New. - Remove all _const0 patterns. - (movv4si_internal): Rewrite to use code. Add vector constant to - vector alternative. Add splitter. - (movv8hi_internal): Same. - (movv16qi_internal): Same. - (movv4sf_internal): Same. - Change the unspecs for vspltis* to use constants. - - * config/rs6000/spe.md ("xorv4hi3"): New. - ("spe_evxor"): Rename to xorv2si3. - ("xorv1di3"): New. - Remove all _const0 patterns. - (movv2si_internal): Rewrite to use code. Add vector constant to - alternatives. Add splitter. - (movv4hi_internal): Add vector constant to alternatives. - (movv1di_internal): Same. - (movv2sf_internal): Same. + * testsuite/gcc.c-torture/execute/simd-3.c: New. + + * expr.c (expand_expr): Handle VECTOR_CST. + (const_vector_from_tree): New. + + * varasm.c (output_constant): Handle VECTOR_CST. + + * c-typeck.c (digest_init): Build a vector constant from a + VECTOR_TYPE. + + * config/rs6000/rs6000.c: Remove prototype for + easy_vector_constant. + (easy_vector_constant): Add mode parameter. Rewrite to handle + more easy constants. + (rs6000_emit_move): Pass mode to easy_vector_constant. + Call emit_easy_vector_insn for SPE V2SI vector constant moves. + (emit_easy_vector_insn): New. + (easy_vector_same): New. + (EASY_VECTOR_15): New macro. + (EASY_VECTOR_15_ADD_SELF): New macro. + (bdesc_2arg): Rename to xorv2si3. + (easy_vector_constant_add_self): New. + (input_operand): Allow vector constants. + + * config/rs6000/rs6000.h (PREDICATE_CODES): Add + easy_vector_constant, easy_vector_constant_add_self. + (EXTRA_CONSTRAINT): Add 'W'. + + * config/rs6000/rs6000-protos.h: Add prototype for + easy_vector_constant, emit_easy_vector_insn. + + * config/rs6000/altivec.md (xorv8hi3): New. + (xorv16qi3): New. + Remove all _const0 patterns. + (movv4si_internal): Rewrite to use code. Add vector constant to + vector alternative. Add splitter. + (movv8hi_internal): Same. + (movv16qi_internal): Same. + (movv4sf_internal): Same. + Change the unspecs for vspltis* to use constants. + + * config/rs6000/spe.md ("xorv4hi3"): New. + ("spe_evxor"): Rename to xorv2si3. + ("xorv1di3"): New. + Remove all _const0 patterns. + (movv2si_internal): Rewrite to use code. Add vector constant to + alternatives. Add splitter. + (movv4hi_internal): Add vector constant to alternatives. + (movv1di_internal): Same. + (movv2sf_internal): Same. 2003-03-31 Mark Mitchell <mark@codesourcery.com> @@ -759,8 +780,8 @@ Tue Apr 1 18:18:23 CEST 2003 Jan Hubicka <jh@suse.cz> 2003-03-30 Richard Henderson <rth@redhat.com> PR opt/10011, opt/10252: - * toplev.c (rest_of_compilation): Run purge_builtin_constant_p - before post-gcse cse pass. + * toplev.c (rest_of_compilation): Run purge_builtin_constant_p + before post-gcse cse pass. 2003-03-30 Roger Sayle <roger@eyesopen.com> @@ -786,8 +807,8 @@ Tue Apr 1 18:18:23 CEST 2003 Jan Hubicka <jh@suse.cz> 2003-03-30 Gabriel Dos Reis <gdr@integrable-solutions.net> - * Makefile.in (STRICT_WARN): Don't warn for ISO C constructs. - (STRICT2_WARN): Likewise. + * Makefile.in (STRICT_WARN): Don't warn for ISO C constructs. + (STRICT2_WARN): Likewise. 2003-03-30 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> @@ -910,7 +931,7 @@ Tue Apr 1 18:18:23 CEST 2003 Jan Hubicka <jh@suse.cz> (load_mems): Adjust replace_loop_mems call. 2003-03-28 Eric Botcazou <ebotcazou@libertysurf.fr> - Richard Henderson <rth@redhat.com> + Richard Henderson <rth@redhat.com> PR target/10114 and PR target/10084 * dwarf2out.c (mem_loc_descriptor): Handle LO_SUM. @@ -961,13 +982,13 @@ Tue Apr 1 18:18:23 CEST 2003 Jan Hubicka <jh@suse.cz> 2003-03-27 David Mosberger <davidm@hpl.hp.com> - * unwind-libunwind.c (uw_frame_state_for): Adjust for libunwind - v0.9 API change: replace read of UNW_REG_HANDLER with - unw_get_proc_info(). - (_Unwind_GetLanguageSpecificData): Replace read of UNW_REG_LSDA - with unw_get_proc_info(). - (_Unwind_GetRegionStart): Replace UNW_REG_PROC_START with - unw_get_proc_info(). + * unwind-libunwind.c (uw_frame_state_for): Adjust for libunwind + v0.9 API change: replace read of UNW_REG_HANDLER with + unw_get_proc_info(). + (_Unwind_GetLanguageSpecificData): Replace read of UNW_REG_LSDA + with unw_get_proc_info(). + (_Unwind_GetRegionStart): Replace UNW_REG_PROC_START with + unw_get_proc_info(). 2003-03-27 Vladimir Makarov <vmakarov@redhat.com> @@ -993,7 +1014,7 @@ Tue Apr 1 18:18:23 CEST 2003 Jan Hubicka <jh@suse.cz> 2003-03-26 Vladimir Makarov <vmakarov@redhat.com> - * config/rs6000/8540.md: New file. + * config/rs6000/8540.md: New file. * config/rs6000/{40x.md, 603.md, 6xx.md, 7450.md, 7xx.md, mpc.md, power4.md, rios1.md, rios2.md, rs64.md}: Add mult_compare to diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 2b8bf05bb77..1993f767b7b 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,9 @@ +2003-04-06 Zack Weinberg <zack@codesourcery.com> + + * ada-tree.def: Make fourth element for GNAT_LOOP_ID zero. + * misc.c (gnat_tree_size): New function. + (LANG_HOOKS_TREE_SIZE): Override. + 2003-04-03 Jason Merrill <jason@redhat.com> * misc.c (gnat_adjust_rli): #if 0. @@ -90,10 +96,10 @@ 2003-01-29 Laurent Guerby <guerby@acm.org> - PR ada/8344 - * final.c: rename to adafinal.c to avoid file name conflicts with gcc file. - * Makefile.in: match previous change. - * Make-lang.in: match previous change. + PR ada/8344 + * final.c: rename to adafinal.c to avoid file name conflicts with gcc file. + * Makefile.in: match previous change. + * Make-lang.in: match previous change. 2003-01-29 Joel Sherrill <joel@OARcorp.com> diff --git a/gcc/ada/ada-tree.def b/gcc/ada/ada-tree.def index ec515498acf..b6172c037d7 100644 --- a/gcc/ada/ada-tree.def +++ b/gcc/ada/ada-tree.def @@ -77,4 +77,4 @@ DEFTREECODE (GNAT_NOP_EXPR, "gnat_nop_expr", '1', 1) ??? This should be redone at some point. */ -DEFTREECODE (GNAT_LOOP_ID, "gnat_loop_id", 'x', 1) +DEFTREECODE (GNAT_LOOP_ID, "gnat_loop_id", 'x', 0) diff --git a/gcc/ada/misc.c b/gcc/ada/misc.c index 1a5c9dbd252..93a52eb338a 100644 --- a/gcc/ada/misc.c +++ b/gcc/ada/misc.c @@ -79,6 +79,7 @@ extern FILE *asm_out_file; extern int save_argc; extern char **save_argv; +static size_t gnat_tree_size PARAMS ((enum tree_code)); static bool gnat_init PARAMS ((void)); static void gnat_init_options PARAMS ((void)); static int gnat_decode_option PARAMS ((int, char **)); @@ -98,6 +99,8 @@ static rtx gnat_expand_expr PARAMS ((tree, rtx, enum machine_mode, #define LANG_HOOKS_NAME "GNU Ada" #undef LANG_HOOKS_IDENTIFIER_SIZE #define LANG_HOOKS_IDENTIFIER_SIZE sizeof (struct tree_identifier) +#undef LANG_HOOKS_TREE_SIZE +#define LANG_HOOKS_TREE_SIZE gnat_tree_size #undef LANG_HOOKS_INIT #define LANG_HOOKS_INIT gnat_init #undef LANG_HOOKS_INIT_OPTIONS @@ -335,6 +338,19 @@ internal_error_function (msgid, ap) Compiler_Abort (fp, -1); } +/* Langhook for tree_size: determine size of our 'x' and 'c' nodes. */ +static size_t +gnat_tree_size (enum tree_code code) +{ + switch (code) + { + case GNAT_LOOP_ID: return sizeof (struct tree_loop_id); + default: + abort (); + } + /* NOTREACHED */ +} + /* Perform all the initialization steps that are language-specific. */ static bool diff --git a/gcc/c-common.def b/gcc/c-common.def index 802238a65a2..dfdec8c4df0 100644 --- a/gcc/c-common.def +++ b/gcc/c-common.def @@ -25,9 +25,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA /* Tree nodes relevant to both C and C++. These were originally in cp-tree.def in the cp subdir. */ -/* A node to remember a source position. */ -DEFTREECODE (SRCLOC, "srcloc", 'x', 2) - DEFTREECODE (SIZEOF_EXPR, "sizeof_expr", '1', 1) DEFTREECODE (ARROW_EXPR, "arrow_expr", 'e', 1) DEFTREECODE (ALIGNOF_EXPR, "alignof_expr", '1', 1) diff --git a/gcc/c-pretty-print.c b/gcc/c-pretty-print.c index 685b46d434f..65023996272 100644 --- a/gcc/c-pretty-print.c +++ b/gcc/c-pretty-print.c @@ -718,30 +718,6 @@ pp_c_postfix_expression (ppi, e) pp_initializer (ppi, e); break; -#if 0 - case SRCLOC: - pp_left_paren (ppi); - pp_identifier (ppi, "__location__"); - pp_right_paren (ppi); - pp_whitespace (ppi); - pp_left_brace (ppi); - pp_dot (ppi); - pp_identifier (ppi, "file"); - pp_whitespace (ppi); - pp_equal (ppi); - pp_c_whitespace (ppi); - pp_c_expression (ppi, SRCLOC_FILE (e)); - pp_separate_with (ppi, ','); - pp_dot (ppi); - pp_identifier (ppi, "line"); - pp_whitespace (ppi); - pp_equal (ppi); - pp_c_whitespace (ppi); - pp_c_expression (ppi, SRCLOC_LINE (e)); - pp_right_brace (ppi); - break; -#endif - case VA_ARG_EXPR: pp_c_identifier (ppi, "__builtin_va_arg"); pp_c_left_paren (ppi); diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index ce68f07756a..8311500c56b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,19 @@ 2003-04-06 Zack Weinberg <zack@codesourcery.com> + * cp-tree.def: Make fourth element for all 'c' and 'x' nodes zero. + * cp-lang.c (cp_tree_size): New function. + (LANG_HOOKS_TREE_SIZE): Override. + + * cp-tree.h (SOURCE_LOCUS, SRCLOC_FILE, SRCLOC_LINE, struct + tree_srcloc, TS_CP_COMMON, TS_CP_SRCLOC): Kill. + (union lang_tree_node): Remove common and srcloc members. + (build_srcloc_here): Don't prototype. + * decl.c (cp_tree_node_structure): Kill SRCLOC case. + * pt.c (pending_templates): Correct comment. + * tree.c (build_srcloc, build_srcloc_here): Kill. + +2003-04-06 Zack Weinberg <zack@codesourcery.com> + * call.c: Include intl.h. (print_z_candidate): Always use inform; get rid of errfn argument. Reorganize so that all the strings get picked up @@ -3897,7 +3911,7 @@ 2002-08-11 Gabriel Dos Reis <gdr@nerim.net> - * decl.c (duplicate_decls): Replace DECL_SOURCE_FILE + + * decl.c (duplicate_decls): Replace DECL_SOURCE_FILE DECL_SOURCE_LINE with DECL_SOURCE_LOCATION. * optimize.c (maybe_clone_body): Likewise. * pt.c (tsubst_enum): Likewise. diff --git a/gcc/cp/cp-lang.c b/gcc/cp/cp-lang.c index b35c31c0763..0caa3360a77 100644 --- a/gcc/cp/cp-lang.c +++ b/gcc/cp/cp-lang.c @@ -34,10 +34,13 @@ static HOST_WIDE_INT cxx_get_alias_set (tree); static bool ok_to_generate_alias_set_for_type (tree); static bool cxx_warn_unused_global_decl (tree); static tree cp_expr_size (tree); +static size_t cp_tree_size (enum tree_code); static bool cp_var_mod_type_p (tree); #undef LANG_HOOKS_NAME #define LANG_HOOKS_NAME "GNU C++" +#undef LANG_HOOKS_TREE_SIZE +#define LANG_HOOKS_TREE_SIZE cp_tree_size #undef LANG_HOOKS_INIT #define LANG_HOOKS_INIT cxx_init #undef LANG_HOOKS_FINISH @@ -318,6 +321,24 @@ cp_expr_size (tree exp) return lhd_expr_size (exp); } +/* Langhook for tree_size: determine size of our 'x' and 'c' nodes. */ +static size_t +cp_tree_size (enum tree_code code) +{ + switch (code) + { + case PTRMEM_CST: return sizeof (struct ptrmem_cst); + case BASELINK: return sizeof (struct tree_baselink); + case TEMPLATE_PARM_INDEX: return sizeof (template_parm_index); + case DEFAULT_ARG: return sizeof (struct tree_default_arg); + case OVERLOAD: return sizeof (struct tree_overload); + case WRAPPER: return sizeof (struct tree_wrapper); + default: + abort (); + } + /* NOTREACHED */ +} + /* Returns true if T is a variably modified type, in the sense of C99. This routine needs only check cases that cannot be handled by the language-independent logic in tree-inline.c. */ diff --git a/gcc/cp/cp-tree.def b/gcc/cp/cp-tree.def index e95d5935b70..2d340f3d8d6 100644 --- a/gcc/cp/cp-tree.def +++ b/gcc/cp/cp-tree.def @@ -47,7 +47,7 @@ DEFTREECODE (OFFSET_REF, "offset_ref", 'r', 2) /* A pointer-to-member constant. For a pointer-to-member constant `X::Y' The PTRMEM_CST_CLASS is the RECORD_TYPE for `X' and the PTRMEM_CST_MEMBER is the _DECL for `Y'. */ -DEFTREECODE (PTRMEM_CST, "ptrmem_cst", 'c', 2) +DEFTREECODE (PTRMEM_CST, "ptrmem_cst", 'c', 0) /* For NEW_EXPR, operand 0 is the placement list. Operand 1 is the new-declarator. @@ -105,7 +105,7 @@ DEFTREECODE (ALIAS_DECL, "alias_decl", 'd', 0) the type of the expression. This type is either a FUNCTION_TYPE, METHOD_TYPE, or `unknown_type_node' indicating that the function is overloaded. */ -DEFTREECODE (BASELINK, "baselink", 'x', 3) +DEFTREECODE (BASELINK, "baselink", 'x', 0) /* Template definition. The following fields have the specified uses, although there are other macros in cp-tree.h that should be used for @@ -157,16 +157,7 @@ DEFTREECODE (TEMPLATE_DECL, "template_decl", 'd', 0) The LEVEL is the level of the parameter when we are worrying about the types of things; the ORIG_LEVEL is the level when we are worrying about instantiating things. */ -DEFTREECODE (TEMPLATE_PARM_INDEX, "template_parm_index", 'x', - /* The addition of (sizeof(tree) - 1) in the next expression - is to handle the case when padding pushes us past an even - multiple of sizeof(tree). */ - /* We used to try to calculate this using - 1+3*sizeof(HOST_WIDE_INT), but that fails if alignment - makes it bigger. */ - ((sizeof (template_parm_index) - sizeof (struct tree_common)) - + sizeof (tree) - 1) - / sizeof (tree)) +DEFTREECODE (TEMPLATE_PARM_INDEX, "template_parm_index", 'x', 0) /* Index into a template parameter list. This parameter must be a type. The TYPE_FIELDS value will be a TEMPLATE_PARM_INDEX. */ @@ -212,7 +203,7 @@ DEFTREECODE (USING_DECL, "using_decl", 'd', 0) DEFTREECODE (USING_STMT, "using_directive", 'e', 1) /* An un-parsed default argument. Looks like an IDENTIFIER_NODE. */ -DEFTREECODE (DEFAULT_ARG, "default_arg", 'x', 2) +DEFTREECODE (DEFAULT_ARG, "default_arg", 'x', 0) /* A template-id, like foo<int>. The first operand is the template. The second is the TREE_LIST or TREE_VEC of explicitly specified @@ -224,11 +215,11 @@ DEFTREECODE (TEMPLATE_ID_EXPR, "template_id_expr", 'e', 2) /* A list-like node for chaining overloading candidates. TREE_TYPE is the original name, and the parameter is the FUNCTION_DECL. */ -DEFTREECODE (OVERLOAD, "overload", 'x', 1) +DEFTREECODE (OVERLOAD, "overload", 'x', 0) /* A generic wrapper for something not tree that we want to include in tree structure. */ -DEFTREECODE (WRAPPER, "wrapper", 'x', 1) +DEFTREECODE (WRAPPER, "wrapper", 'x', 0) /* Used to represent deferred name lookup for dependent names while parsing a template declaration. The first argument is an diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 92a227fb194..2986d6b6ae3 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -353,17 +353,6 @@ struct tree_wrapper GTY(()) struct z_candidate *z_c; }; -#define SOURCE_LOCUS(NODE) \ - (((struct tree_srcloc*)SRCLOC_CHECK (NODE))->locus) -#define SRCLOC_FILE(NODE) SOURCE_LOCUS (NODE).file -#define SRCLOC_LINE(NODE) SOURCE_LOCUS (NODE).line - -struct tree_srcloc GTY(()) -{ - struct tree_common common; - location_t locus; -}; - /* Macros for access to language-specific slots in an identifier. */ #define IDENTIFIER_NAMESPACE_BINDINGS(NODE) \ @@ -466,7 +455,6 @@ struct tree_default_arg GTY (()) }; enum cp_tree_node_structure_enum { - TS_CP_COMMON, TS_CP_GENERIC, TS_CP_IDENTIFIER, TS_CP_TPI, @@ -475,7 +463,6 @@ enum cp_tree_node_structure_enum { TS_CP_OVERLOAD, TS_CP_BASELINK, TS_CP_WRAPPER, - TS_CP_SRCLOC, TS_CP_DEFAULT_ARG, LAST_TS_CP_ENUM }; @@ -484,7 +471,6 @@ enum cp_tree_node_structure_enum { union lang_tree_node GTY((desc ("cp_tree_node_structure (&%h)"), chain_next ("(union lang_tree_node *)TREE_CHAIN (&%h.generic)"))) { - struct tree_common GTY ((tag ("TS_CP_COMMON"))) common; union tree_node GTY ((tag ("TS_CP_GENERIC"), desc ("tree_node_structure (&%h)"))) generic; struct template_parm_index_s GTY ((tag ("TS_CP_TPI"))) tpi; @@ -492,7 +478,6 @@ union lang_tree_node GTY((desc ("cp_tree_node_structure (&%h)"), struct tree_overload GTY ((tag ("TS_CP_OVERLOAD"))) overload; struct tree_baselink GTY ((tag ("TS_CP_BASELINK"))) baselink; struct tree_wrapper GTY ((tag ("TS_CP_WRAPPER"))) wrapper; - struct tree_srcloc GTY ((tag ("TS_CP_SRCLOC"))) srcloc; struct tree_default_arg GTY ((tag ("TS_CP_DEFAULT_ARG"))) default_arg; struct lang_identifier GTY ((tag ("TS_CP_IDENTIFIER"))) identifier; }; @@ -4212,7 +4197,6 @@ extern tree decl_namespace_context (tree); extern tree lvalue_type (tree); extern tree error_type (tree); extern tree build_zc_wrapper (struct z_candidate *); -extern tree build_srcloc_here (void); extern int varargs_function_p (tree); extern int really_overloaded_fn (tree); extern int cp_tree_equal (tree, tree); diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 376db755d9d..4734d76d006 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -14405,7 +14405,6 @@ cp_tree_node_structure (union lang_tree_node * t) case PTRMEM_CST: return TS_CP_PTRMEM; case BASELINK: return TS_CP_BASELINK; case WRAPPER: return TS_CP_WRAPPER; - case SRCLOC: return TS_CP_SRCLOC; default: return TS_CP_GENERIC; } } diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index a79b8a57846..b5ea239c51e 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -49,11 +49,10 @@ typedef int (*tree_fn_t) PARAMS ((tree, void*)); /* The PENDING_TEMPLATES is a TREE_LIST of templates whose instantiations have been deferred, either because their definitions - were not yet available, or because we were putting off doing the - work. The TREE_PURPOSE of each entry is a SRCLOC indicating where - the instantiate request occurred; the TREE_VALUE is either a DECL - (for a function or static data member), or a TYPE (for a class) - indicating what we are hoping to instantiate. */ + were not yet available, or because we were putting off doing the work. + The TREE_PURPOSE of each entry is either a DECL (for a function or + static data member), or a TYPE (for a class) indicating what we are + hoping to instantiate. The TREE_VALUE is not used. */ static GTY(()) tree pending_templates; static GTY(()) tree last_pending_template; diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index a5858bf2b4a..97d297a8c31 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -43,7 +43,6 @@ static hashval_t list_hash_pieces PARAMS ((tree, tree, tree)); static hashval_t list_hash PARAMS ((const void *)); static cp_lvalue_kind lvalue_p_1 PARAMS ((tree, int, int)); static tree no_linkage_helper PARAMS ((tree *, int *, void *)); -static tree build_srcloc PARAMS ((const char *, int)); static tree mark_local_for_remap_r PARAMS ((tree *, int *, void *)); static tree cp_unsave_r PARAMS ((tree *, int *, void *)); static tree build_target_expr PARAMS ((tree, tree)); @@ -1824,26 +1823,6 @@ build_zc_wrapper (ptr) return t; } -static tree -build_srcloc (file, line) - const char *file; - int line; -{ - tree t; - - t = make_node (SRCLOC); - SRCLOC_FILE (t) = file; - SRCLOC_LINE (t) = line; - - return t; -} - -tree -build_srcloc_here () -{ - return build_srcloc (input_filename, lineno); -} - /* The type of ARG when used as an lvalue. */ tree diff --git a/gcc/langhooks-def.h b/gcc/langhooks-def.h index 4315eab91e7..1c2244a6276 100644 --- a/gcc/langhooks-def.h +++ b/gcc/langhooks-def.h @@ -65,6 +65,7 @@ extern bool lhd_warn_unused_global_decl PARAMS ((tree)); extern void lhd_incomplete_type_error PARAMS ((tree, tree)); extern tree lhd_type_promotes_to PARAMS ((tree)); extern tree lhd_expr_size PARAMS ((tree)); +extern size_t lhd_tree_size PARAMS ((enum tree_code)); /* Declarations of default tree inlining hooks. */ tree lhd_tree_inlining_walk_subtrees PARAMS ((tree *, int *, @@ -116,6 +117,7 @@ void write_global_declarations PARAMS ((void)); #define LANG_HOOKS_PRINT_ERROR_FUNCTION lhd_print_error_function #define LANG_HOOKS_DECL_PRINTABLE_NAME lhd_decl_printable_name #define LANG_HOOKS_EXPR_SIZE lhd_expr_size +#define LANG_HOOKS_TREE_SIZE lhd_tree_size #define LANG_HOOKS_FUNCTION_INIT lhd_do_nothing_f #define LANG_HOOKS_FUNCTION_FINAL lhd_do_nothing_f @@ -238,6 +240,7 @@ int lhd_tree_dump_type_quals PARAMS ((tree)); #define LANG_HOOKS_INITIALIZER { \ LANG_HOOKS_NAME, \ LANG_HOOKS_IDENTIFIER_SIZE, \ + LANG_HOOKS_TREE_SIZE, \ LANG_HOOKS_INIT_OPTIONS, \ LANG_HOOKS_DECODE_OPTION, \ LANG_HOOKS_POST_OPTIONS, \ diff --git a/gcc/langhooks.c b/gcc/langhooks.c index 16592a9b3f7..d4f3e3584d6 100644 --- a/gcc/langhooks.c +++ b/gcc/langhooks.c @@ -458,6 +458,17 @@ lhd_expr_size (exp) return size_in_bytes (TREE_TYPE (exp)); } +/* lang_hooks.tree_size: Determine the size of a tree with code C, + which is a language-specific tree code in category 'x'. The + default expects never to be called. */ +size_t +lhd_tree_size (c) + enum tree_code c ATTRIBUTE_UNUSED; +{ + abort (); + return 0; +} + /* lang_hooks.decls.final_write_globals: perform final processing on global variables. */ void diff --git a/gcc/langhooks.h b/gcc/langhooks.h index 82454952397..70ad952b6f3 100644 --- a/gcc/langhooks.h +++ b/gcc/langhooks.h @@ -193,6 +193,11 @@ struct lang_hooks identifier nodes long enough for the language-specific slots. */ size_t identifier_size; + /* Determines the size of any language-specific 'x' or 'c' nodes. + Since it is called from make_node, the only information available + is the tree code. Expected to abort on unrecognized codes. */ + size_t (*tree_size) PARAMS ((enum tree_code)); + /* The first callback made to the front end, for simple initialization needed before any calls to decode_option. */ void (*init_options) PARAMS ((void)); diff --git a/gcc/tree.c b/gcc/tree.c index 19dfc5ad09a..ecee8f397c4 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -182,28 +182,32 @@ tree_size (node) + TREE_CODE_LENGTH (code) * sizeof (char *) - sizeof (char *)); case 'c': /* a constant */ - /* We can't use TREE_CODE_LENGTH for INTEGER_CST, since the number of - words is machine-dependent due to varying length of HOST_WIDE_INT, - which might be wider than a pointer (e.g., long long). Similarly - for REAL_CST, since the number of words is machine-dependent due - to varying size and alignment of `double'. */ - if (code == INTEGER_CST) - return sizeof (struct tree_int_cst); - else if (code == REAL_CST) - return sizeof (struct tree_real_cst); - else - return (sizeof (struct tree_common) - + TREE_CODE_LENGTH (code) * sizeof (char *)); + switch (code) + { + case INTEGER_CST: return sizeof (struct tree_int_cst); + case REAL_CST: return sizeof (struct tree_real_cst); + case COMPLEX_CST: return sizeof (struct tree_complex); + case VECTOR_CST: return sizeof (struct tree_vector); + case STRING_CST: return sizeof (struct tree_string); + default: + return (*lang_hooks.tree_size) (code); + } case 'x': /* something random, like an identifier. */ - { - size_t length; - length = (sizeof (struct tree_common) - + TREE_CODE_LENGTH (code) * sizeof (char *)); - if (code == TREE_VEC) - length += TREE_VEC_LENGTH (node) * sizeof (char *) - sizeof (char *); - return length; - } + switch (code) + { + case IDENTIFIER_NODE: return lang_hooks.identifier_size; + case TREE_LIST: return sizeof (struct tree_list); + case TREE_VEC: return (sizeof (struct tree_vec) + + TREE_VEC_LENGTH(node) * sizeof(char *) + - sizeof (char *)); + + case ERROR_MARK: + case PLACEHOLDER_EXPR: return sizeof (struct tree_common); + + default: + return (*lang_hooks.tree_size) (code); + } default: abort (); @@ -4817,7 +4821,7 @@ initializer_zerop (init) { if (AGGREGATE_TYPE_P (TREE_TYPE (init))) { - tree aggr_init = TREE_OPERAND (init, 1); + tree aggr_init = CONSTRUCTOR_ELTS (init); while (aggr_init) { diff --git a/gcc/tree.def b/gcc/tree.def index 03e44bcf242..a8f35ca9da9 100644 --- a/gcc/tree.def +++ b/gcc/tree.def @@ -34,9 +34,13 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 's' for codes for expressions with inherent side effects. 'e' for codes for other kinds of expressions. */ -/* For `r', `e', `<', `1', `2', `s' and `x' nodes, - the 4th element is the number of argument slots to allocate. - This determines the size of the tree node object. */ +/* For `r', `e', `<', `1', `2', and `s' nodes, which use struct + tree_exp, the 4th element is the number of argument slots to + allocate. This determines the size of the tree node object. + Other nodes use different structures, and the size is determined + by the tree_union member structure; the 4th element should be + zero. Languages that define language-specific 'x' or 'c' codes + must define the tree_size langhook to say how big they are. */ /* Any erroneous construct is parsed into a node of this type. This type of node is accepted without complaint in all contexts @@ -49,17 +53,17 @@ DEFTREECODE (ERROR_MARK, "error_mark", 'x', 0) Internally it looks like a STRING_CST node. There is only one IDENTIFIER_NODE ever made for any particular name. Use `get_identifier' to get it (or create it, the first time). */ -DEFTREECODE (IDENTIFIER_NODE, "identifier_node", 'x', ((LANG_HOOKS_IDENTIFIER_SIZE - sizeof (struct tree_common) + sizeof (tree) - 1) / sizeof (tree))) +DEFTREECODE (IDENTIFIER_NODE, "identifier_node", 'x', 0) /* Has the TREE_VALUE and TREE_PURPOSE fields. */ /* These nodes are made into lists by chaining through the TREE_CHAIN field. The elements of the list live in the TREE_VALUE fields, while TREE_PURPOSE fields are occasionally used as well to get the effect of Lisp association lists. */ -DEFTREECODE (TREE_LIST, "tree_list", 'x', 2) +DEFTREECODE (TREE_LIST, "tree_list", 'x', 0) /* These nodes contain an array of tree nodes. */ -DEFTREECODE (TREE_VEC, "tree_vec", 'x', 2) +DEFTREECODE (TREE_VEC, "tree_vec", 'x', 0) /* A symbol binding block. These are arranged in a tree, where the BLOCK_SUBBLOCKS field contains a chain of subblocks @@ -257,22 +261,20 @@ DEFTREECODE (LANG_TYPE, "lang_type", 't', 0) Note: constants of type char in Pascal are INTEGER_CST, and so are pointer constants such as nil in Pascal or NULL in C. `(int *) 1' in C also results in an INTEGER_CST. */ -DEFTREECODE (INTEGER_CST, "integer_cst", 'c', 2) +DEFTREECODE (INTEGER_CST, "integer_cst", 'c', 0) -/* Contents are in TREE_REAL_CST field. Also there is TREE_CST_RTL. */ -DEFTREECODE (REAL_CST, "real_cst", 'c', 3) +/* Contents are in TREE_REAL_CST field. */ +DEFTREECODE (REAL_CST, "real_cst", 'c', 0) /* Contents are in TREE_REALPART and TREE_IMAGPART fields, - whose contents are other constant nodes. - Also there is TREE_CST_RTL. */ -DEFTREECODE (COMPLEX_CST, "complex_cst", 'c', 3) + whose contents are other constant nodes. */ +DEFTREECODE (COMPLEX_CST, "complex_cst", 'c', 0) /* Contents are in TREE_VECTOR_CST_ELTS field. */ -DEFTREECODE (VECTOR_CST, "vector_cst", 'c', 3) +DEFTREECODE (VECTOR_CST, "vector_cst", 'c', 0) -/* Contents are TREE_STRING_LENGTH and TREE_STRING_POINTER fields. - Also there is TREE_CST_RTL. */ -DEFTREECODE (STRING_CST, "string_cst", 'c', 3) +/* Contents are TREE_STRING_LENGTH and TREE_STRING_POINTER fields. */ +DEFTREECODE (STRING_CST, "string_cst", 'c', 0) /* Declarations. All references to names are represented as ..._DECL nodes. The decls in one binding context are chained through the TREE_CHAIN field. |