[llvm-commits] [llvm] r90445 - in /llvm/trunk: include/llvm/Analysis/ProfileInfo.h lib/Analysis/ProfileInfo.cpp

Chris Lattner clattner at apple.com
Fri Dec 4 21:13:15 PST 2009


On Dec 3, 2009, at 11:33 PM, Andreas Neustifter wrote:

> 
> On 12/03/2009 06:47 PM, Chris Lattner wrote:
>> 
>> On Dec 3, 2009, at 1:30 AM, Andreas Neustifter wrote:
>> 
>>> Author: astifter
>>> Date: Thu Dec 3 03:30:12 2009
>>> New Revision: 90445
>>> 
>>> URL: http://llvm.org/viewvc/llvm-project?rev=90445&view=rev
>>> Log:
>>> Converted ProfileInfo to template, added more API for
>>> ProfileInfo-preserving.
>> 
>> Does this have to be a template? Why not use a base class that keeps a
>> map<void*, double> and then have derived classes for LLVM BB and MBB's?
>> This would significantly reduce code size.
> 
> I'm still not very proficient with the C++-Type system so maybe this is a stupid question but:
> 
> When I would use this approach, how would I use the shared code between the two derived classes?
> Naturally the code would be in the base class, but when I want to use this code I would have to have functions in the derived classes that hand the typecasted pointers to the base class?

Yep.

> I must admit that I still have to move shared code from ProfileInfo.cpp to ProfileInfo.h, but there will be a large shared code base between this two classes.
> 
> Agreed, the shared code in the base class is duplicated, is this what I shall strive to prevent?

Right, exactly.  Thanks Andreas,

-Chris



More information about the llvm-commits mailing list