[LLVMdev] Profiling in LLVM Patch Followup 1

Daniel Dunbar daniel at zuster.org
Mon Aug 24 08:18:36 PDT 2009


On Tue, Aug 18, 2009 at 4:07 AM, Andreas
Neustifter<e0325716 at student.tuwien.ac.at> wrote:
>>> +    // getFunction() - Returns the Function for an Edge, checking for validity.
>>> +    static const Function* getFunction(Edge e) {
>>> +      assert(e.second && "Invalid ProfileInfo::Edge");
>>> +      return e.second->getParent();
>>> +    }
>>> +
>>> +    // getEdge() - Creates an Edge from two BasicBlocks.
>>> +    static Edge getEdge(const BasicBlock* Src, const BasicBlock* Dest) {
>>> +      return std::make_pair(Src,Dest);
>>> +    }
>>
>> I think these should be private; eventually they are just an
>> implementation detail of a particular ProfileInfo provider.
>
> My plan was to have Edges as integral part of the ProfileInfo since they only store information for a given CFG. An provider of ProfileInformation can then decide at which level information is provided. If possible the ProfileInfo calculates other information from that. (E.g. calculate block counts from edge counts.) This has the advantage that not every ProfileInfo provider has to reimplement the logic for deriving additional information.

Ok.

It may still be nice to have this in a separate interface (one that
would only be used by ProfileInfo implementations, not by ProfileInfo
clients), just so that ProfileInfo itself has a small and clear
interface. Not important for now though...

>>> +  // the sum of the edge frequencies from the incoming edges.
>>
>> the -> The
>
> Even if its part of an sentence? (See lib/Analysis/ProfileInfo.cpp, line 49.)

Ah, missed that. I personally like '// Some trailing off thought ...'
<more code> '// ... continue the comment'.

 - Daniel




More information about the llvm-dev mailing list