aboutsummaryrefslogtreecommitdiff
path: root/gcc/expr.cc
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2022-05-31 10:42:35 -0700
committerNathan Sidwell <nathan@acm.org>2022-06-08 07:44:20 -0700
commit90a6c3b6d69765ea9269ba7ae16ef02d5527e875 (patch)
tree3a1bec473070f87248219f1a6ffae3c22079bebf /gcc/expr.cc
parentd8c258094195896a32bd7dc0601bc767c9258a71 (diff)
downloadgcc-90a6c3b6d69765ea9269ba7ae16ef02d5527e875.zip
gcc-90a6c3b6d69765ea9269ba7ae16ef02d5527e875.tar.gz
gcc-90a6c3b6d69765ea9269ba7ae16ef02d5527e875.tar.bz2
c++: Reimplement static init/fini generation
Currently we generate static init/fini code by generating a set of functions taking an 'initp' bool and an unsigned priority. (There can be more than one, as we repeat the end-of-compile loop.) We then generate a set of real init or fini functions for each needed prioroty, calling the previous set of functions. This is of course very tangled, but excitingly the value-range-propagator is clever enough to unentangle it. However, the current arrangement makes generation awkward, particularly as to how to optimize the module-global-init generation. This reimplements the generation to generate a set of separate init/fini functions for each needed priority, and then call them from the real inits previously mentioned. This replaces a splay tree, recording which priority/init combos we needed, with a pair of hash tables, mapping priority to init functions. Much simpler. While there, rename several of the functions as they are only dealing with part of the init/fini generation, not the whole set. gcc/cp/ * decl2.cc (struct priority_info_s, priority_info): Delete. (priority_map_traits, priority_map_t): New. (static_init_fini_fns): New. (INITIALIZE_P_IDENTIFIER, PRIORITY_IDENTIFIER): Delete. (initialize_p_decl, priority_decl): Delete. (ssdf_decls, priority_info_map): Delete. (start_static_storage_duration_function): Rename to ... (start_partial_init_fini_fn): ... here. Create a void arg fn. Add it to the slot in the appropriate static_init_fini_fns hash table. (finish_static_storage_duration_function): Rename to ... (finish_partial_init_fini_fn): ... here. (get_priority_info): Delete. (one_static_initialization_or_destruction): Assert not trivial dtor. (do_static_initialization_or_destruction): Rename to ... (emit_partial_init_fini_fn) ... here. Start & finish the fn. Simply init/fini each var. (partition_vars_for_init_fini): Partition vars according to priority and add to init and/or fini list. (generate_ctor_or_dtor_function): Start and finish the function. Do santitizer calls here. (generate_ctor_and_dtor_functions_for_priority): Delete. (c_parse_final_cleanups): Reimplement global init/fini processing. gcc/testsuite/ * g++.dg/init/static-cdtor1.C: New.
Diffstat (limited to 'gcc/expr.cc')
0 files changed, 0 insertions, 0 deletions