This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Attacking quadratic behaviors associated with SWITCH_EXPR
- From: Zdenek Dvorak <rakdver at atrey dot karlin dot mff dot cuni dot cz>
- To: Kazu Hirata <kazu at cs dot umass dot edu>
- Cc: gcc at gcc dot gnu dot org, stevenb at suse dot de
- Date: Sun, 24 Oct 2004 10:03:17 +0200
- Subject: Re: Attacking quadratic behaviors associated with SWITCH_EXPR
- References: <20041022.204311.102581980.kazu@cs.umass.edu>
Hello,
> First, I am thinking about improving "CASE_LABEL_EXPR -> edge" as
> follows.
>
> 1. add "edge e;" to stmt_ann_d
>
> 2. allocate stmt_ann for each CASE_LABEL_EXPR
>
> 3. stop using CASE_LABEL of CASE_LABEL_EXPR after CFG is created. In
> fact, we should probably put null in CASE_LABEL so that people
> won't mistakenly use it.
>
> Then we should be able to do
>
> stmt_ann (switch_stmt)->e
>
> to get an edge equivalent to find_edge (label_to_block (CASE_LABEL ()))
> in constant time. Now the obvious concern is memory consumption
> arising from having edge for every statement with stmt_ann. I need
> come clever ideas here. Maybe a hash table mapping CASE_LABEL_EXPR to
> edge?
statement annotations are huge, so this would indeed be a bad idea.
I think it would be better to avoid using tree for CASE_LABEL_EXPR
inside switch statement completely. I.e. TREE_OPERAND (switch, 2)
would no longer be a TREE_VEC of CASE_LABEL_EXPRs, but instead
a wrapper tree node (of type tcc_exceptional) containing
a VEC(case_label_type), where case_label_type would contain just the
fields necessary for the case label. This should also save some
memory over the current approach, since it is a bit less bloated
representation.
Zdenek