[PATCH] Come up with constructors of symtab_node, cgraph_node and varpool_node.
Martin Liška
mliska@suse.cz
Thu Dec 5 12:50:00 GMT 2019
Hi.
As mentioned in the PR, there are classes in cgraph.h that are
not PODs and are initialized with ggc_alloc_cleared. So that I'm suggesting
to use proper constructors. I added ggc_new function that can be used
at different locations as well.
I'm attaching optimized dump file with how ctor expansion looks like.
Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
Ready to be installed?
Thanks,
Martin
gcc/ChangeLog:
2019-12-05 Martin Liska <mliska@suse.cz>
PR ipa/92737
* cgraph.c (symbol_table_test::symbol_table_test):
Use new ggc_new.
* cgraph.h (symtab_node::symtab_node): New constructor.
(cgraph_node::cgraph_node): Likewise.
(varpool_node::varpool_node): Likewise.
(symbol_table::allocate_cgraph_symbol): Use newly
created constructor.
* cgraphunit.c (symtab_terminator): Likewise.
* ggc.h (ggc_new): New.
* toplev.c (general_init): Use new ggc_new.
* varpool.c (varpool_node::create_empty): Use newly
created constructor.
gcc/c-family/ChangeLog:
2019-12-05 Martin Liska <mliska@suse.cz>
PR ipa/92737
* c-opts.c (c_common_init_options): Use new ggc_new.
---
gcc/c-family/c-opts.c | 4 +---
gcc/cgraph.c | 2 +-
gcc/cgraph.h | 50 ++++++++++++++++++++++++++++++++++++-------
gcc/cgraphunit.c | 2 +-
gcc/ggc.h | 9 ++++++++
gcc/toplev.c | 2 +-
gcc/varpool.c | 5 ++---
7 files changed, 57 insertions(+), 17 deletions(-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Come-up-with-constructors-of-symtab_node-cgraph_node.patch
Type: text/x-patch
Size: 6445 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20191205/9bf27444/attachment.bin>
-------------- next part --------------
varpool_node::create_empty ()
{
struct varpool_node * _4;
unsigned long _5;
unsigned long _8;
unsigned long _9;
unsigned char _64;
unsigned char _65;
unsigned char _66;
<bb 2> [local count: 1073741824]:
_4 = ggc_internal_alloc (128, 0B, 0, 1);
_9 = MEM[(struct symtab_node *)_4];
_8 = _9 & 18446743523953737728;
_5 = _8 | 2;
MEM[(struct symtab_node *)_4] = _5;
MEM[(struct symtab_node *)_4].order = 0;
MEM[(struct symtab_node *)_4].decl = 0B;
MEM[(struct symtab_node *)_4].next = 0B;
MEM[(struct symtab_node *)_4].previous = 0B;
MEM[(struct symtab_node *)_4].next_sharing_asm_name = 0B;
MEM[(struct symtab_node *)_4].previous_sharing_asm_name = 0B;
MEM[(struct symtab_node *)_4].same_comdat_group = 0B;
MEM[(struct symtab_node *)_4].ref_list.references = 0B;
MEM[(struct symtab_node *)_4].ref_list.referring.m_vec = 0B;
MEM[(struct symtab_node *)_4].alias_target = 0B;
MEM[(struct symtab_node *)_4].lto_file_data = 0B;
MEM[(struct symtab_node *)_4].aux = 0B;
MEM[(struct symtab_node *)_4].x_comdat_group = 0B;
MEM[(struct symtab_node *)_4].x_section = 0B;
_64 = MEM[(struct varpool_node *)_4 + 120B];
_65 = _64 & 192;
_66 = _65 | 0;
MEM[(struct varpool_node *)_4 + 120B] = _66;
return _4;
}
cgraph_node::create (union tree_node * decl)
{
...
_55 = ggc_internal_alloc (360, 0B, 0, 1);
_56 = &_55->D.104276;
_71 = MEM[(struct symtab_node *)_55];
_70 = _71 & 18446743523953737728;
_168 = _70 | 1;
MEM[(struct symtab_node *)_55] = _168;
MEM[(struct symtab_node *)_55].order = 0;
MEM[(struct symtab_node *)_55].decl = 0B;
MEM[(struct symtab_node *)_55].next = 0B;
MEM[(struct symtab_node *)_55].previous = 0B;
MEM[(struct symtab_node *)_55].next_sharing_asm_name = 0B;
MEM[(struct symtab_node *)_55].previous_sharing_asm_name = 0B;
MEM[(struct symtab_node *)_55].same_comdat_group = 0B;
MEM[(struct symtab_node *)_55].ref_list.references = 0B;
MEM[(struct symtab_node *)_55].ref_list.referring.m_vec = 0B;
MEM[(struct symtab_node *)_55].alias_target = 0B;
MEM[(struct symtab_node *)_55].lto_file_data = 0B;
MEM[(struct symtab_node *)_55].aux = 0B;
MEM[(struct symtab_node *)_55].x_comdat_group = 0B;
MEM[(struct symtab_node *)_55].x_section = 0B;
*_55.callees = 0B;
*_55.callers = 0B;
*_55.indirect_calls = 0B;
*_55.origin = 0B;
*_55.nested = 0B;
*_55.next_nested = 0B;
*_55.next_sibling_clone = 0B;
*_55.prev_sibling_clone = 0B;
*_55.clones = 0B;
*_55.clone_of = 0B;
*_55.call_site_hash = 0B;
*_55.former_clone_of = 0B;
*_55.simdclone = 0B;
*_55.simd_clones = 0B;
*_55.ipa_transforms_to_apply.m_vec = 0B;
*_55.inlined_to = 0B;
*_55.rtl = 0B;
*_55.clone.tree_map = 0B;
*_55.clone.param_adjustments = 0B;
*_55.clone.performed_splits = 0B;
*_55.thunk = {};
MEM[(struct profile_count *)_55 + 320B] = 0;
*_55.m_uid = _53;
*_55.m_summary_id = -1;
MEM[(void *)_55 + 328B] = 10000;
MEM[(int *)_55 + 336B] = 0;
_162 = MEM[(struct cgraph_node *)_55 + 344B];
_37 = _162 & 4286578688;
_65 = _37 | 16;
MEM[(struct cgraph_node *)_55 + 344B] = _65;
_29 = symtab.55_1->cgraph_count;
_25 = _29 + 1;
symtab.55_1->cgraph_count = _25;
...
More information about the Gcc-patches
mailing list