[CPP PATCH] node type
Nathan Sidwell
nathan@acm.org
Mon Aug 20 16:31:00 GMT 2018
Finally, this gets to clean up the convoluted way the preprocessor marks
the type of identifier nodes. Right now it's a combination of a type
field and a pair of flags, which gives rise to some convoluted tests and
remapping for GTY. This patch rationalizes it by using the type field
exclusively.
Rather than a single NT_MACRO type, we now have NT_USER_MACRO and
NT_BUILTIN_MACRO types. Checking for either of them is a simple bit
mask, as there's a unique set bit they share. NT_MACRO_MASK is that bit.
Another change is that NT_ASSERTION is not needed. Assertions are in a
disjoint namespace (by prepending '#'), and we can simply use the
non-nullness of the answers field to know there's an assert (possibly
checking for NT_VOID if we're looking at an arbitrary node). We have to
set the answer field to NULL when clearing a node -- before we could
leave a dangling pointer.
With NT_MACRO_ARG replacing NODE_MACRO_ARG we have exactly 4 NT_$FOO
values (which is what we had before), but we free up 2 NODE_ flags,
which is nice. The NT_ values directly map to the GTY machinery, so we
don't need a translation layer anymore.
booted and tested on x86_64-linux. applying to trunk.
nathan
--
Nathan Sidwell
-------------- next part --------------
A non-text attachment was scrubbed...
Name: node-tag.diff
Type: text/x-patch
Size: 19171 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20180820/4518228e/attachment.bin>
More information about the Gcc-patches
mailing list