This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Canonical type nodes, or, comptypes considered harmful


Mike Stump <mrs@apple.com> writes:

| On Nov 9, 2006, at 11:09 PM, Ian Lance Taylor wrote:
| > I meant something very simple: for every type, there is a
| > TYPE_CANONICAL field.  This is how you tell whether two types are
| > equivalent:
| >     TYPE_CANONICAL (a) == TYPE_CANONICAL (b)
| 
| Ah, yes, that would work.  Hum, so simple, why was I thinking
| something was not going to work about it.  There are advantages to
| real-time conversations...  anyway, can't think of any down sides
| right now except for the obvious, this is gonna eat 1 extra pointer
| per type.

That is what we use in our representation, so if you find something
seriously wrong with it I'm highly interested.

As of the extra pointer.  We use C++ to represent this whole stuff.
And it uses conventional object orientation combined with
non-conventional C++ templates.  Consequently we do not always
store the pointers for the canonical types.  For example, built-in
types are their own canonical types, so we just return "*this".

For typedefs (and general aliases, e.g. namespace alias), we store
pointers to the canonical type of the aliasee.  
For classes and enums, we return  the pointer to the "class
expression" (when present). etc. 

-- Gaby


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]