[cfe-dev] Modifying an AST and Sema's dependency on an AST consumer

Daniel Dunbar daniel at zuster.org
Fri Dec 5 08:12:30 PST 2008


On Fri, Dec 5, 2008 at 6:00 AM, Lukasz Janyst <ljanyst at cern.ch> wrote:
> Or to make AST consumers dependent only on ASTs. Interface clarity vs
> efficiency in the main use case, that's always a tough choice :)

Indeed. However, with a class which adapts an AST for use by an AST
consumer this is effectively the same API (although the consumer
doesn't get a chance to optimize for random access).

We definitely do not want to require parsing the entire AST before
doing code generation. Although we don't use this facility yet, we
hope to eventually support function-at-a-time code generation as a way
to reduce memory consumption and hopefully improve -O0 time.

 - Daniel

>   Lukasz
>
> On Thu, Dec 4, 2008 at 7:30 PM, Daniel Dunbar <daniel at zuster.org> wrote:
>> On Thu, Dec 4, 2008 at 10:14 AM, Lukasz Janyst <ljanyst at cern.ch> wrote:
>>> Ok, many thanks for your replies. For the prototype I'm building it's
>>> not a critical issue right now, but still it would be great to have it
>>> fixed.
>>>
>>> What about my other problem? I had only a very brief look at this part
>>> of the code but I can see that you have probably done that for
>>> performance reasons. I mean, Sema seems to have all the structures to
>>> determine when it's done with the class processing efficiently. My
>>> problem is that I need to push my TUs through CodeGen after Sema is
>>> long gone.
>>
>> Given our current interfaces, I think the simplest approach to this
>> would be to add a something like a generic ASTStreamer class which
>> takes an AST and a consumer and streams the AST through the consumer.
>> This avoids the need for CodeGen or other consumers to be aware that
>> they are being called differently.
>>
>>  - Daniel
>>
>



More information about the cfe-dev mailing list