make genattrtab generate smaller code
Geoff Keating
geoffk@geoffk.org
Fri Sep 5 23:23:00 GMT 2003
law@redhat.com writes:
> In message <Pine.LNX.4.44.0309052057230.13736-100000@wotan.suse.de>, Michael Ma
> tz writes:
> >Hi,
> >
> >this patch makes the code in insn-attrtab.c cache the attributes.
> >It currently generates code like:
> [ ... ]
> Cool.
>
> Any chance you could take on the gt-*.h files which have some commoning
> opportunities:
>
> For example gt_ggc_mx_lang_tree_node:
>
> case TS_COMMON:
> gt_ggc_m_9tree_node ((*x).generic.common.chain);
> gt_ggc_m_9tree_node ((*x).generic.common.type);
> gt_ggc_m_10tree_ann_d ((*x).generic.common.ann);
> gt_ggc_m_10location_s ((*x).generic.common.locus);
> break;
> case TS_INT_CST:
> gt_ggc_m_9tree_node ((*x).generic.int_cst.common.chain);
> gt_ggc_m_9tree_node ((*x).generic.int_cst.common.type);
> gt_ggc_m_10tree_ann_d ((*x).generic.int_cst.common.ann);
> gt_ggc_m_10location_s ((*x).generic.int_cst.common.locus);
>
>
> Even if we don't want to commonize across the case statements, there's
> clearly stuff within each case which could be commonized.
>
> This kind of code is generated pretty regularly by the gt* generator.
The problem is that while you know and I know that generic.common.type
is the same as generic.int_cst.common.type, gengtype doesn't know.
The best way to do this would be to write an optimisation pass in the
compiler that could detect identical code and commonize it---that
would be a good general space optimisation, and it's not really any
harder than doing it in gengtype.
--
- Geoffrey Keating <geoffk@geoffk.org>
More information about the Gcc-patches
mailing list