change the location_t type, DECL_SOURCE_LINE etc

Gabriel Dos Reis gdr@integrable-solutions.net
Mon Dec 2 16:06:00 GMT 2002


Per Bothner <per@bothner.com> writes:

| I've been looking at the location_t type, which is used (primarily)
| to represent the line-number of a tree_decl.  There are two problems
| I'd like to address:
| (1) Each location_t is 8 bytes (on 32-bit hosts) or 16 bytes (in
| 64-bit hosts).  This is a substantial amount of space when there
| are many declarations.
| (2) We don't store column numbers.
| 
| The following proposed change addresses both issues. It is somewhat
| tentative, and I haven't finished the implementation.  However, I'd
| like to explain the idea before I go much further.
| 
| To reduce space usage we have to replace the filename by an index
| in a 'line_table'.  We also have to use bit fields in order to squeeze
| everything into 32 bits.  This means a limited number of different
| file names, and a limited range on line and column numbers.  However,
| it is not quite a limited as the 14 and 8 suggest, since we can
| have multiple 'line_table' entries for the same filename, but with
| different line and column base values.  Thus:

This idea has been in the "air" for a long time (primarily championed
by Neil).  We agreed to implement it for 3.4.  Neil may have more to
say on that.

Note however that, to have effective saving, we would have to use
location_t in lieu of ad hoc 'const char*, int' pairs used here and
there thoughout the compiler -- that is a work postponed for 3.4.

-- Gaby



More information about the Gcc mailing list