Efficiently encoding a hierarchy

Diego Novillo dnovillo@google.com
Tue Jul 17 13:46:00 GMT 2007


On 7/14/07 7:14 PM, Kannan Goundan wrote:

> - A (0,5)
>   - B (1,1)
>   - C (2,4)
>     - D (3,3) 
>     - E (4,4)
>   - F (5,5)
> - G (6,7)
>   - H (7,7)
> 
> A given instance is of type "C" if its "code" field is between 2 and 4,
> inclusive.

Interesting, thanks.  In this case, we probably should rename subcode as
it really is a set of flags, which in some cases happen to be code from
the 'tree' data structures.

The hierarchy is actually flat.  We use code ranges in a way similar to
your proposal to group related codes.  For instance, all the codes that
take operands have consecutive numbers.  Admittedly, this is fairly
primitive but so is the language we have to deal with.



More information about the Gcc mailing list