This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Canonical types (1/3)
Richard Kenner wrote:
> However, I'm wondering whether "narrowing" what we consider a "variant"
> really is a good idea given this change. In some sense, TYPE_CANONICAL
> and TYPE_MAIN_VARIANT represent the same concept.
TYPE_CANONICAL is about the language idea of "the same type".
TYPE_MAIN_VARIANT is "the cv-unqualified variant of this type, treating
typedefs as different." So, I don't think they're really the same.
We could get rid of TYPE_MAIN_VARIANT, make TYPE_NEXT_VARIANT a circular
list, and find TYPE_MAIN_VARIANT by walking TYPE_NEXT_VARIANT until we
find a cv-unqualified type. That would save memory, but not
necessarily time. However, if we typically only have at most 2 variants
(unqualified and "const"), then it might be a win.
--
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713