This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Variadic templates, fourth revision [Committed]


> On 3/10/07, Doug Gregor <doug.gregor@gmail.com> wrote:
> >C++ front end and testsuite changes approved and committed. The final
> >patches, ChangeLogs are attached.
> 
> This causes a 15% compile time memory usage regression for tramp3d,
> DLV and mico sources :/  (which makes it a release-blocker)


Mem tester report 19% on Gerald's testcase.
Note that it is not the GGC memory, but normal malloced memory, so it
might be simple leak somewhere.

Honza

comparing empty function compilation at -O0 level:
    Overall memory needed: 7383k
    Peak memory use before GGC: 2260k
    Peak memory use after GGC: 1949k
    Maximum of released memory in single GGC run: 311k
    Garbage: 446k
    Leak: 2283k
    Overhead: 456k
    GGC runs: 3

comparing empty function compilation at -O0 -g level:
    Overall memory needed: 7399k
    Peak memory use before GGC: 2288k
    Peak memory use after GGC: 1977k
    Maximum of released memory in single GGC run: 311k
    Garbage: 449k
    Leak: 2316k
    Overhead: 461k
    GGC runs: 3

comparing empty function compilation at -O1 level:
    Overall memory needed: 7511k
    Peak memory use before GGC: 2260k
    Peak memory use after GGC: 1949k
    Maximum of released memory in single GGC run: 311k
    Garbage: 452k
    Leak: 2286k
    Overhead: 457k
    GGC runs: 4

comparing empty function compilation at -O2 level:
    Overall memory needed: 7579k
    Peak memory use before GGC: 2261k
    Peak memory use after GGC: 1950k
    Maximum of released memory in single GGC run: 311k
    Garbage: 455k
    Leak: 2286k
    Overhead: 457k
    GGC runs: 4

comparing empty function compilation at -O3 level:
    Overall memory needed: 7579k
    Peak memory use before GGC: 2261k
    Peak memory use after GGC: 1950k
    Maximum of released memory in single GGC run: 311k
    Garbage: 455k
    Leak: 2286k
    Overhead: 457k
    GGC runs: 4

comparing combine.c compilation at -O0 level:
    Overall memory needed: 17835k -> 17839k
    Peak memory use before GGC: 9262k
    Peak memory use after GGC: 8849k
    Maximum of released memory in single GGC run: 2578k
    Garbage: 36909k
    Leak: 6578k
    Overhead: 5037k
    GGC runs: 279

comparing combine.c compilation at -O0 -g level:
    Overall memory needed: 19855k
    Peak memory use before GGC: 10878k
    Peak memory use after GGC: 10509k
    Maximum of released memory in single GGC run: 2354k
    Garbage: 37491k
    Leak: 9471k
    Overhead: 5743k
    GGC runs: 268

comparing combine.c compilation at -O1 level:
    Overall memory needed: 35259k -> 35255k
    Peak memory use before GGC: 19340k
    Peak memory use after GGC: 19125k
    Maximum of released memory in single GGC run: 2172k
    Garbage: 56722k
    Leak: 6607k
    Overhead: 6304k
    GGC runs: 352

comparing combine.c compilation at -O2 level:
    Overall memory needed: 37575k
    Peak memory use before GGC: 19371k
    Peak memory use after GGC: 19177k
    Maximum of released memory in single GGC run: 2159k
    Garbage: 68222k
    Leak: 6718k
    Overhead: 8029k
    GGC runs: 405

comparing combine.c compilation at -O3 level:
    Overall memory needed: 46895k
    Peak memory use before GGC: 20389k
    Peak memory use after GGC: 19559k
    Maximum of released memory in single GGC run: 3148k
    Garbage: 101149k
    Leak: 6864k
    Overhead: 12251k
    GGC runs: 455

comparing insn-attrtab.c compilation at -O0 level:
    Overall memory needed: 102951k
    Peak memory use before GGC: 68624k
    Peak memory use after GGC: 44728k
    Maximum of released memory in single GGC run: 36429k
    Garbage: 129360k
    Leak: 9581k
    Overhead: 16801k
    GGC runs: 208

comparing insn-attrtab.c compilation at -O0 -g level:
    Overall memory needed: 104331k -> 104327k
    Peak memory use before GGC: 69786k
    Peak memory use after GGC: 45996k
    Maximum of released memory in single GGC run: 36430k
    Garbage: 130583k
    Leak: 11289k
    Overhead: 17199k
    GGC runs: 206

comparing insn-attrtab.c compilation at -O1 level:
    Overall memory needed: 147587k -> 147583k
    Peak memory use before GGC: 85946k
    Peak memory use after GGC: 80068k
    Maximum of released memory in single GGC run: 32841k
    Garbage: 264361k
    Leak: 9401k
    Overhead: 27621k
    GGC runs: 226

comparing insn-attrtab.c compilation at -O2 level:
    Overall memory needed: 196399k -> 196383k
    Peak memory use before GGC: 87233k
    Peak memory use after GGC: 80138k
    Maximum of released memory in single GGC run: 30034k
    Garbage: 301511k
    Leak: 9399k
    Overhead: 33447k
    GGC runs: 248

comparing insn-attrtab.c compilation at -O3 level:
    Overall memory needed: 196443k -> 196435k
    Peak memory use before GGC: 87247k
    Peak memory use after GGC: 80152k
    Maximum of released memory in single GGC run: 30095k
    Garbage: 302153k
    Leak: 9404k
    Overhead: 33645k
    GGC runs: 248

comparing Gerald's testcase PR8361 compilation at -O0 level:
  Overall memory allocated via mmap and sbrk increased from 147356k to 174541k, overall 18.45%
  Amount of memory still referenced at the end of compilation increased from 49044k to 49110k, overall 0.13%
    Overall memory needed: 147356k -> 174541k
    Peak memory use before GGC: 90241k -> 90285k
    Peak memory use after GGC: 89347k -> 89390k
    Maximum of released memory in single GGC run: 17775k -> 17776k
    Garbage: 207686k -> 207698k
    Leak: 49044k -> 49110k
    Overhead: 23533k -> 23556k
    GGC runs: 410

comparing Gerald's testcase PR8361 compilation at -O0 -g level:
  Overall memory allocated via mmap and sbrk increased from 165200k to 192361k, overall 16.44%
    Overall memory needed: 165200k -> 192361k
    Peak memory use before GGC: 102846k -> 102889k
    Peak memory use after GGC: 101827k -> 101870k
    Maximum of released memory in single GGC run: 18129k
    Garbage: 214200k -> 214182k
    Leak: 72357k -> 72423k
    Overhead: 29428k -> 29451k
    GGC runs: 384 -> 383

comparing Gerald's testcase PR8361 compilation at -O1 level:
  Overall memory allocated via mmap and sbrk increased from 141811k to 168986k, overall 19.16%
  Amount of memory still referenced at the end of compilation increased from 49752k to 49818k, overall 0.13%
    Overall memory needed: 141811k -> 168986k
    Peak memory use before GGC: 101808k -> 101851k
    Peak memory use after GGC: 100791k -> 100834k
    Maximum of released memory in single GGC run: 17236k
    Garbage: 344614k -> 344622k
    Leak: 49752k -> 49818k
    Overhead: 30123k -> 30146k
    GGC runs: 527 -> 526

comparing Gerald's testcase PR8361 compilation at -O2 level:
  Overall memory allocated via mmap and sbrk increased from 143839k to 171018k, overall 18.90%
  Amount of memory still referenced at the end of compilation increased from 50784k to 50850k, overall 0.13%
    Overall memory needed: 143839k -> 171018k
    Peak memory use before GGC: 102422k -> 102466k
    Peak memory use after GGC: 101408k -> 101452k
    Maximum of released memory in single GGC run: 17233k
    Garbage: 373494k -> 373517k
    Leak: 50784k -> 50850k
    Overhead: 34060k -> 34086k
    GGC runs: 563 -> 562

comparing Gerald's testcase PR8361 compilation at -O3 level:
  Overall memory allocated via mmap and sbrk increased from 146407k to 173566k, overall 18.55%
  Amount of memory still referenced at the end of compilation increased from 51067k to 51133k, overall 0.13%
    Overall memory needed: 146407k -> 173566k
    Peak memory use before GGC: 104245k -> 104288k
    Peak memory use after GGC: 103207k -> 103250k
    Maximum of released memory in single GGC run: 17610k
    Garbage: 390836k -> 390876k
    Leak: 51067k -> 51133k
    Overhead: 35430k -> 35453k
    GGC runs: 573 -> 572

comparing PR rtl-optimization/28071 testcase compilation at -O0 level:
    Overall memory needed: 244575k
    Peak memory use before GGC: 80960k
    Peak memory use after GGC: 58699k
    Maximum of released memory in single GGC run: 44133k
    Garbage: 144343k
    Leak: 7611k
    Overhead: 24815k
    GGC runs: 79

comparing PR rtl-optimization/28071 testcase compilation at -O0 -g level:
    Overall memory needed: 245411k
    Peak memory use before GGC: 81606k
    Peak memory use after GGC: 59345k
    Maximum of released memory in single GGC run: 44122k
    Garbage: 144514k
    Leak: 9378k
    Overhead: 25310k
    GGC runs: 89

comparing PR rtl-optimization/28071 testcase compilation at -O1 level:
    Overall memory needed: 245199k -> 245051k
    Peak memory use before GGC: 85157k
    Peak memory use after GGC: 74845k
    Maximum of released memory in single GGC run: 36137k
    Garbage: 222608k
    Leak: 20854k
    Overhead: 30547k
    GGC runs: 81

comparing PR rtl-optimization/28071 testcase compilation at -O2 level:
    Overall memory needed: 498603k
    Peak memory use before GGC: 79831k
    Peak memory use after GGC: 74845k
    Maximum of released memory in single GGC run: 33438k
    Garbage: 229655k
    Leak: 20944k
    Overhead: 32629k
    GGC runs: 91

comparing PR rtl-optimization/28071 testcase compilation at -O3 -fno-tree-pre -fno-tree-fre level:
    Overall memory needed: 1188315k -> 1188299k
    Peak memory use before GGC: 201747k
    Peak memory use after GGC: 190209k
    Maximum of released memory in single GGC run: 80701k
    Garbage: 375660k
    Leak: 46310k
    Overhead: 49354k
    GGC runs: 70

Head of the ChangeLog is:

--- /usr/src/SpecTests/sandbox-britten-memory/x86_64/mem-result/ChangeLog	2007-03-10 00:49:29.000000000 +0000
+++ /usr/src/SpecTests/sandbox-britten-memory/gcc/gcc/ChangeLog	2007-03-10 16:00:45.000000000 +0000
@@ -1,3 +1,105 @@
+2007-03-10  Uros Bizjak  <ubizjak@gmail.com>
+
+	PR target/31101
+	* config/i386/i386.md (UNSPEC_C2_FLAG): New constant.
+	(fpremxf4_i387, fprem1xf4_i387): Use UNSPEC_C2_FLAG.
+	(fmodxf3, fmod<mode>3, remainderxf3, remainder<mode>3):
+	Add LABEL_NUSES to emmitted label.
+	* config/i386/i386.c (ix86_emit_fp_unordered_jump): Add
+	branch probability value to emmitted jump insn.
+	* reg-stack.c (subst_stack_regs_pat)[UNSPEC]: Handle UNSPEC_C2_FLAG.
+	Do not check life information and do not re-arrange input operands
+	for UNSPEC_FSCALE_EXP, UNSPEC_FPREM_U and UNSPEC_FPREM1_U.
+
+2007-03-10  Kaz Kojima  <kkojima@gcc.gnu.org>
+
+	* config/sh/sh.c (sh_insn_length_adjustment): Adjust for
+	the change of decode_asm_operands.
+
+2007-03-10  Kaz Kojima  <kkojima@gcc.gnu.org>
+
+	* mode-switching.c (create_pre_exit): Skip blockage insn.
+
+2007-03-09  Diego Novillo  <dnovillo@redhat.com>
+
+	* tree-pass.h (TODO_update_smt_usage): Remove.
+	Update all users.
+	* tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Remove
+	argument SOME.
+	Update all users.
+
+2007-03-09  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
+
+	* pa.c (attr_length_call): Revise condition for long pc-relative branch.
+	(output_call): Use "LONG_PIC_SDIFF" instruction sequence for long local
+	calls on the SOM target.  Don't use "LONG_PIC_PCREL" call sequence on
+	SOM target.
+
+2007-03-09  Geoffrey Keating  <geoffk@apple.com>
+
+	* gcc.c: Document %{, in big comment at top.
+	(input_suffix_matches): Remove special handling for .s and
+	.S.
+	(input_spec_matches): New.
+	(handle_braces): Handle %{,.
+	(validate_switches): ',' indicates a value which is not a switch.
+	* config/alpha/osf.h (ASM_FINAL_SPEC): Use %{, rather than %{.
+	to detect assembler input.
+	* config/i386/sol2.h (CPP_SPEC): Likewise.
+	* config/rs6000/sysv4.h (ASM_SPEC): Likewise.
+	* config/rs6000/vxworks.h (ASM_SPEC): Likewise.
+	* config/rs6000/lynx.h (ASM_SPEC): Likewise.
+	* config/rs6000/linux64.h (ASM_SPEC_COMMON): Likewise.
+	* config/i386/darwin.h (DARWIN_MINVERSION_SPEC): Objective-C plus
+	-m64 causes deployment target to default to 10.5.
+	* config/rs6000/darwin.h (DARWIN_MINVERSION_SPEC): Likewise.
+
+2007-03-09  Richard Henderson  <rth@redhat.com>
+
+	PR target/26090
+	* target.h (targetm.asm.out.reloc_rw_mask): New.
+	* target-def.h (TARGET_ASM_RELOC_RW_MASK): New.
+	(TARGET_ASM_OUT): Use it.
+	* targhooks.c, targhooks.h (default_reloc_rw_mask): New.
+	* varasm.c (categorize_decl_for_section): Remove shlib argument;
+	use the new reloc_rw_mask target hook instead.
+	(default_section_type_flags_1): Merge into...
+	(default_section_type_flags): ... here.
+	(decl_readonly_section_1): Merge into...
+	(decl_readonly_section): ... here.
+	(default_elf_select_section_1): Merge into...
+	(default_elf_select_section): ... here.
+	(default_unique_section_1): Merge into...
+	(default_unique_section): ... here.
+	(compute_reloc_for_rtx_1, compute_reloc_for_rtx): New.
+	(default_select_rtx_section): Use it.
+	(default_elf_select_rtx_section): Likewise.
+	* output.h: Update to match.
+	* doc/tm.texi (TARGET_ASM_RELOC_RW_MASK): New.
+	* config/alpha/alpha.c (alpha_elf_reloc_rw_mask): New.
+	(TARGET_ASM_RELOC_RW_MASK): New.
+	* config/i386/i386.c (x86_64_elf_select_section): Adjust call
+	to categorize_decl_for_section.
+	(x86_64_elf_unique_section): Likewise.
+	* config/ia64/hpux.h (TARGET_ASM_SELECT_SECTION,
+	TARGET_ASM_UNIQUE_SECTION, TARGET_ASM_SELECT_RTX_SECTION): Remove.
+	(TARGET_ASM_RELOC_RW_MASK): New.
+	* config/ia64/ia64.c (ia64_rwreloc_select_section,
+	ia64_rwreloc_unique_section, ia64_rwreloc_select_rtx_section): Remove.
+	(ia64_hpux_reloc_rw_mask, ia64_reloc_rw_mask): New.
+	(TARGET_RWRELOC): Remove.
+	(ia64_section_type_flags): Adjust call to default_section_type_flags.
+	* config/ia64/sysv4.h (TARGET_ASM_RELOC_RW_MASK): New.
+	* config/rs6000/rs6000.c (rs6000_elf_section_type_flags): Remove.
+	(rs6000_elf_select_section, rs6000_elf_unique_section): Remove.
+	(rs6000_elf_reloc_rw_mask, rs6000_xcoff_reloc_rw_mask): New.
+	(rs6000_xcoff_select_section): Use decl_readonly_section.
+	(rs6000_xcoff_section_type_flags): Use default_section_type_flags.
+	* config/rs6000/sysv4.h (TARGET_ASM_RELOC_RW_MASK): New.
+	(TARGET_ASM_SELECT_SECTION, TARGET_ASM_UNIQUE_SECTION): Remove.
+	(TARGET_SECTION_TYPE_FLAGS): Remove.
+	* config/rs6000/xcoff.h (TARGET_ASM_RELOC_RW_MASK): New.
+
 2007-03-09  Roger Sayle  <roger@eyesopen.com>
 
 	* fold-const.c (fold_comparison): Remove compile-time evaluation of
--- /usr/src/SpecTests/sandbox-britten-memory/x86_64/mem-result/ChangeLog.cp	2007-03-10 00:49:28.000000000 +0000
+++ /usr/src/SpecTests/sandbox-britten-memory/gcc/gcc/cp/ChangeLog	2007-03-10 16:00:44.000000000 +0000
@@ -1,3 +1,217 @@
+2007-03-09  Douglas Gregor  <doug.gregor@gmail.com>
+
+	PR c++/20599
+	* typeck.c (check_return_expr): Check for bare parameter packs.
+	(comptypes): Compare template parameter packs and
+	type pack expansions.
+	* decl.c (grokdeclarator): Deal with the declaration of function
+	parameter packs.
+	(grokparms): Verify that the (optional) function parameter pack is
+	at the end of the parameter list.
+	(xref_basetypes): Handle pack expansions in the base class.
+	(cp_tree_node_structure): Handle ARGUMENT_PACK_SELECT.
+	* cp-tree.def (TYPE_ARGUMENT_PACK): New.
+	(NONTYPE_ARGUMENT_PACK): New.
+	(TYPE_PACK_EXPANSION): New.
+	(EXPR_PACK_EXPANSION): New.
+	(ARGUMENT_PACK_SELECT): New.
+	* cp-objcp-common.c (cp_tree_size): Compute size of
+	(NON)TYPE_ARGUMENT_PACK, (TYPE|EXPR)_PACK_EXPANSION, and
+	ARGUMENT_PACK_SELECT.
+	* error.c (dump_template_argument): Print template argument packs.
+	(dump_template_argument_list): Ditto.
+	(dump_template_parameter): Dump `...' for template type parameter
+	packs.
+	(dump_type): Dump TYPE_PACK_EXPANSION nodes.
+	(dump_parameters): Print function parameter packs.
+	(dump_template_parms): Print template argument packs.
+	(dump_expr): Dump EXPR_PACK_EXPANSION nodes.
+	(maybe_warn_variadic_templates): New.
+	* operators.def: Add ellipsis operator for EXPR_PACK_EXPANSION.
+	* tree.c (cp_walk_subtrees): Walk BASELINK, TYPE_ARGUMENT_PACK,
+	NONTYPE_ARGUMENT_PACK, TYPE_PACK_EXPANSION, EXPR_PACK_EXPANSION,
+	CAST_EXPR. 
+	* mangle.c (write_type): Mangle TYPE_PACK_EXPANSION.
+	(write_template_arg): Write argument packs as separate arguments.
+	* cp-tree.h (struct template_parm_index_s): Add flag that
+	indicates that the template parameter is actually a parameter
+	pack.
+	(struct tree_argument_pack_select): New.
+	(enum cp_tree_node_structure_enum): Add TS_CP_ARGUMENT_PACK_SELECT.
+	(union lang_tree_node): Add argument_pack_select.
+	(FUNCTION_PARAMETER_PACK_P): New.
+	(PACK_EXPANSION_P): New.
+	(PACK_EXPANSION_PATTERN): New.
+	(SET_PACK_EXPANSION_PATTERN): New.
+	(PACK_EXPANSION_PARAMETER_PACKS): New.
+	(ARGUMENT_PACK_P): New.
+	(ARGUMENT_PACK_ARGS): New.
+	(SET_ARGUMENT_PACK_ARGS): New.
+	(ARGUMENT_PACK_INCOMPLETE_P): New.
+	(ARGUMENT_PACK_EXPLICIT_ARGS): New.
+	(TEMPLATE_PARM_PARAMETER_PACK): New.
+	(TEMPLATE_TYPE_PARAMETER_PACK): New.
+	(ARGUMENT_PACK_SELECT_FROM_PACK): New.
+	(ARGUMENT_PACK_SELECT_INDEX): New.
+	(ARGUMENT_PACK_SELECT_ARG): New.
+	(struct cp_declarator): Add parameter_pack_p flag.
+	(maybe_warn_variadic_templates): Declare.
+	(process_template_parm): Add bool parameter IS_PARAMETER_PACK, to
+	indicate a template parameter pack. 
+	(uses_parameter_packs): Declare.
+	(template_parameter_pack_p): Declare.
+	(template_parms_variadic_p): Declare.
+	(make_pack_expansion): Declare.
+	(check_for_bare_parameter_packs): Declare.
+	* cxx-pretty-print.c (pp_cxx_unary_expression): Print
+	sizeof... expressions. 
+	(pp_cxx_expression): Print pack expansions and non-type argument
+	packs.
+	(pp_cxx_exception_specification): Print pack expansions. 
+	(pp_cxx_direct_declarator): Print ellipsis for parameter packs.
+	(pp_cxx_ctor_initializer): Print pack expansions.
+	(pp_cxx_type_id): Print pack expansions.
+	(pp_cxx_template_argument_list): Print argument packs.
+	(pp_cxx_template_parameter): Print ellipsis for template parameter
+	packs.
+	* pt.c (comp_template_parms): Compare template parameter packs.
+	(template_parameter_pack_p): New.
+	(template_parms_variadic_p): New.
+	(template_args_variadic_p): New.
+	(make_ith_pack_parameter_name): New.
+	(struct find_parameter_pack_data): New.
+	(find_parameter_packs_r): New.
+	(uses_parameter_packs): New.
+	(make_pack_expansion): New.
+	(check_for_bare_parameter_packs): New.
+	(expand_template_argument_pack): New.
+	(reduce_template_parm_level): Propagate parameter pack flag.
+	(process_template_parm): Add is_parameter_pack parameter to state
+	when the parameter is actually a parameter pack. Create template
+	parameter packs when is_parameter_pack is true.
+	(current_template_args): The argument for a template parameter
+	pack is an argument pack containing a single pack expansion.
+	(process_partial_specialization): When checking that non-type
+	argument expressions do not involve template parameters, loop over
+	the arguments in argument packs separately.
+	(push_template_decl_real): Check that the type of the declaration
+	does not have any bare parameter packs. Check that primary
+	templates have no more than one parameter pack, and that it comes
+	at the end of the template parameter list.
+	(convert_template_argument): Handle coercions for pack expansion
+	expressions by coercing the pattern then rebuilding the expansion.
+	(coerce_template_parms): When coercing the arguments for a
+	variadic template, pack "extra" arguments into an argument pack.
+	(coerce_template_template_parms): Cannot coerce between parameter
+	packs and non-pack parameters.
+	(template_args_equal): Compare PACK_EXPANSION_P expressions.
+	(comp_template_args): Expand all template arguments packs before
+	comparing template argument lists.
+	(mangle_class_name_for_template): Make argument packs as separate
+	template arguments.
+	(for_each_template_parm_r): No need to handle BASELINK. 
+	(instantiate_class_template): Handle pack expansions in the base
+	class list.
+	(tsubst_pack_expansion): New.
+	(tsubst_template_args): Handle substitutions of argument packs and
+	pack expansion into template argument lists.
+	(tsubst_decl): Expand function parameter packs into separate
+	function parameters.
+	(tsubst_arg_types): Expand a type pack expansion into separate
+	argument types.
+	(tsubst_exception_specification): Handle pack expansions in
+	exception specifiers.
+	(tsubst): See through ARGUMENT_PACK_SELECT arguments when 
+	replacing a template parameter with its argument. If we encounter
+	a substitution for an argument pack, just return the parameter
+	itself. 
+	(tsubst_copy): sizeof(X...) returns the number of elements in
+	parameter pack X.  See through ARGUMENT_PACK_SELECT when the
+	PARM_DECL is a parameter pack.
+	(tsubst_expr): Expression pack expansions and argument packs
+	cannot show up here; they will all be handled through function
+	calls, sizeof, and template argument lists.
+	(tsubst_copy_and_build): sizeof(X...) returns the number of
+	elements in parameter pack X.  Handle pack expansions in TREE_LIST
+	and CONSTRUCTOR nodes.
+	(fn_type_unification): Handle "incomplete" explicit template
+	argument lists that specify some of the arguments for a template
+	parameter pack.
+	(type_unification_real): Unify arguments against pack expansions.
+	(template_parm_level_and_index): New, helper function.
+	(unify_pack_expansion): New.
+	(unify): Unify argument packs on an argument-by-argument basis,
+	handling variadic argument packs as well.
+	(more_specialized_fn): Handle unification of function parameter
+	packs. All things being equal, prefer non-variadic function
+	templates to variadic function templates.
+	(more_specialized_class): Prefer the variadic class template
+	partial specialization that binds fewer arguments to a parameter
+	pack.
+	(regenerate_decl_from_template): Expand function parameter packs
+	into separate parameters.
+	(instantiate_decl): Ditto.
+	(tsubst_initializer_list): Handle pack expansions for base-class
+	initializers.
+	(dependent_type_p_r): Determine dependent types in argument packs
+	and pack expansions.
+	(value_dependent_expression_p): Determine value-dependence of
+	non-type argument packs.
+	(dependent_template_arg_p): Handle argument packs.
+	* semantics.c (finish_cond): Check for bare parameter packs.
+	(finish_expr_stmt): Ditto.
+	(finish_for_expr): Ditto.
+	(finish_switch_cond): Ditto.
+	(finish_mem_initializers): Ditto.
+	* name-lookup.c (arg_assoc_type): Handle pack expansions and
+	argument packs.
+	* decl2.c (cp_build_parm_decl): Mark function parameter packs.
+	* parser.c (make_declarator): Declarator is not an expansion.
+	(make_pointer_declarator): Transfer parameter pack flag to outer
+	declarator.
+	(make_reference_declarator): Ditto.
+	(make_ptrmem_declarator): Ditto.
+	(make_call_declarator): Ditto.
+	(make_array_declarator): Ditto.
+	(cp_parser_postfix_expression): Allow pack expansion expressions
+	in the argument list for a call expression.
+	(cp_parser_parenthesized_expression_list): Add new parameter
+	ALLOW_EXPANSION_P. When true, parse the ellipsis to mean "expand
+	into separate arguments."
+	(cp_parser_new_placement): Allow pack expansion expressions.
+	(cp_parser_new_initializer): Ditto.
+	(cp_parser_mem_initializer_list): Allow ellipsis to create a
+	base-class initializer expansion.
+	(cp_parser_mem_initializer): Ditto.
+	(cp_parser_template_parameter_list): Keep track of whether the
+	template parameter is a template parameter pack.
+	(cp_parser_template_parameter): Parse the ellipsis to indicate a
+	template parameter pack.
+	(cp_parser_type_parameter): Ditto.
+	(cp_parser_template_argument_list): Parse the ellipsis to indicate
+	a pack expansion.
+	(cp_parser_direct_declarator): Parse the ellipsis to indicate that
+	this declarator is a parameter pack.
+	(cp_parser_parameter_declaration): The ellipsis does not end the
+	parameter declaration, because it might be a parameter pack. Parse
+	the ellipsis to indicate a parameter pack.
+	(cp_parser_initializer): Allow pack expansions.
+	(cp_parser_initializer_list): Allow ellipsis to create an
+	initializer expansion.
+	(cp_parser_base_clause): Allow ellipsis to create a base specifier
+	expansion.
+	(cp_parser_type_id_list): Allow ellipsis to create an exception
+	specifier expansion.
+	(cp_parser_attribute_list): Don't allow pack expansions.
+	(cp_parser_functional_cast): Allow pack expansions.
+	(cp_parser_sizeof_operand): Allow ellipsis following "sizeof" to
+	compute the length of a parameter pack.
+	(cp_parser_next_token_ends_template_argument_p): An ellipsis can
+	end a template argument.
+	* tree.c (cp_walk_subtrees): Walk BASELINK, TYPE_ARGUMENT_PACK,
+	NONTYPE_ARGUMENT_PACK, TYPE_PACK_EXPANSION, EXPR_PACK_EXPANSION,
+	CAST_EXPR. 
+
 2007-03-09  Dirk Mueller  <dmueller@suse.de>
 
 	* cp/call.c (build_new_op): Call warn_logical_operator.


The results can be reproduced by building a compiler with

--enable-gather-detailed-mem-stats targetting x86-64

and compiling preprocessed combine.c or testcase from PR8632 with:

-fmem-report --param=ggc-min-heapsize=1024 --param=ggc-min-expand=1 -Ox -Q

The memory consumption summary appears in the dump after detailed listing
of the places they are allocated in.  Peak memory consumption is actually
computed by looking for maximal value in {GC XXXX -> YYYY} report.

Your testing script.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]