Jakub Jelinek wrote:
On Tue, Mar 20, 2007 at 09:37:38AM -0400, Doug Gregor wrote:
Even if we only use subcodes for the less often used codes, I think we
still take the performance hit. The problem is that it's very messy to

I'm sure smaller hit than when going to 9 bit tree code, and on i386/x86_64
maybe even than 16 bit tree code (if I remember well, 8-bit and 32-bit
accesses are usually faster than 16-bit ones).

deal with a two-level code structure inside, e.g., the C++ front end.
I did a little experiment with a very rarely used tree code
(TYPEOF_TYPE), and the results weren't promising:

 http://gcc.gnu.org/ml/gcc/2007-03/msg00493.html

If you use what has been suggested, i.e.:
#define LANG_TREE_CODE(NODE) (TREE_CODE (NODE) == LANG_CODE ? ((tree_with_subcode 
*)(NODE))->subcode : TREE_CODE (NODE))
This subcode idea feels like a bug attractor to me.

For example: #defines have enough problems with
side effects, and this references NODE twice, so
what happens when NODE is a function of some
kind, or has other side effects?
(Someone is going to try to be clever)
then it shouldn't be so big.  Everywhere where you don't need >= 256
codes you'd just keep using TREE_CODE, only if e.g. some
Wouldn't this require extra effort to know when
you should use one method of retrieving the code,
verses the other. Seems like a lot of remembering
would be necessary, which would be a good source
of bugs.

And having two different methods of getting the
"same thing" would make searching the source code for
patterns that much harder.
switch contains >= 256 FE specific subcodes you'd use LANG_TREE_CODE
instead of TREE_CODE.  GCC would warn you if you forget to use
LANG_TREE_CODE even when it is needed, at least in switches, you'd get
warning: case label value exceeds maximum value for type
I'd expect that the TREE_CODE would be referenced
more often in comparisons, than in switch statements.
These probably wouldn't generate the warning.

Reply via email to