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: Language-independent functions-as-trees representation


> Makes sense.  I'm also interested in what dewar was saying about having
> logical line numbers for instantiations; that sort of thing seems necessary
> if we are going to carry template instantiation context information into
> the tree IR.

For details see the GNAT units sinput.ads/sinput.adb (I don't think you particularly
need to know Ada or many other details of GNAT to follow the approach).

Basically we use a single 32-bit number to represent a source position.

We have a table that shows where each file starts in this 32-bit space, and you
can binary search this table to find out what file a 32-bit value belongs to.

For instantiations we create essentially a phantom copy of the source that has
a separate entry in this table, so that when you go back to the table you
know that the source position is offset bla in file xxx instantiated at yyy
(since yyy is itself a similar 32-bit location, the instantiation chain
can be followed recursively).


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