|
|
|
Created:
16 years, 5 months ago by Collin Winter Modified:
16 years, 5 months ago Reviewers:
Jeffrey Yasskin CC:
unladen-swallow_googlegroups.com Visibility:
Public. |
This produces reports like this:
>>> import _llvm
>>> _llvm.dump_stats()
LLVM functions: 1833
LLVM basic blocks: 229867
LLVM instructions: 1321540
>>>
Patch Set 1 #Patch Set 2 : Fix 80 col violation #Patch Set 3 : Fix indentation #
Total comments: 4
Patch Set 4 : Respond to comments #
Total comments: 1
Total messages: 4
|
Collin Winter
PTAL
|
16 years, 5 months ago (2009年07月24日 22:40:20 UTC) #1 |
PTAL
http://codereview.appspot.com/97120/diff/1002/8 File Modules/_llvm.cc (right): http://codereview.appspot.com/97120/diff/1002/8#newcode56 Line 56: void WalkModule(llvm::Module *mod) { I would do this with an overloaded Area() function. You'd call Area() on each sub-object, and add up the sizes. Then you have a simple organization for the concrete types, rather than having to do complex things in some of the functions to reduce the number of functions. http://codereview.appspot.com/97120/diff/1002/8#newcode67 Line 67: this->byte_count_ += sizeof(f.getArgumentList()); Do you want me to nitpick where you're missing bytes? The ArgumentList is just the head node; each element also occupies space. http://codereview.appspot.com/97120/diff/1002/8#newcode72 Line 72: this->byte_count_ += sizeof(*it); The ValueSymbolTable's entries also hold it->getKeyLength() bytes for the value's name. http://codereview.appspot.com/97120/diff/1002/8#newcode84 Line 84: this->byte_count_ += sizeof(inst); This only gets the size of the Instruction. Subclasses occupy extra space, and there are usually Use instances hung off the beginning of the Instruction.
I've dropped adding the bytes together; I'm wary of treating whatever number I come up with with too much weight just yet.
Otherwise, lgtm http://codereview.appspot.com/97120/diff/1005/2001 File Modules/_llvm.cc (right): http://codereview.appspot.com/97120/diff/1005/2001#newcode85 Line 85: fprintf(stderr, "LLVM functions: %ld\n", aggregator.FuncCount()); I think James was right that this should return a string or dict rather than printing to stderr directly.