[cfe-commits] [PATCH] Allow PCHReader to be used without having a pre-initialized Preprocessor

Douglas Gregor dgregor at apple.com
Thu Jun 18 09:39:17 PDT 2009


On Jun 18, 2009, at 9:31 AM, Chris Lattner wrote:

> On Jun 18, 2009, at 8:04 AM, Douglas Gregor wrote:
>>> Ah, okay, that makes sense.  Although, what specific uses do you  
>>> have
>>> in mind?  I can only think of a couple off the top of my head: a
>>> dist-cc-like thing and an inter-procedural analysis tool.
>>
>> Another use of "load an AST and send it to codegen" is implement  
>> implicit template instantiation via prelinking. In this scheme,  
>> function templates are not implicitly instantiated in .o files.  
>> Instead, when the linker sees that it needs a symbol that  
>> corresponds to a template instantiation, it spawns the compiler to  
>> perform the template instantiation and give it a .o file containing  
>> that template instantiation.
>>
>> Prelinking can save a lot of disk I/O and a bunch of computation,  
>> since many templates end up being instantiated in several  
>> different .o files. With prelinking, these instantiations only  
>> happen once, and we only instantiate what the linker actually  
>> needs. However, prelinking has never been a huge win because  
>> "spawning the compiler" meant re-parsing all of the source code.  
>> With AST files, we only bring in the code that we need to perform  
>> the template instantiation itself.
>
> That would be very nice.  We'd only want to do that at -O0, because  
> this would prevent inlining of these templates etc.  However it  
> could be a pretty huge compile-time performance win for -O0.


Or -O4?

	- Doug



More information about the cfe-commits mailing list