[LLVMdev] Calculating relative sizes of globals in IR

Chris Lattner clattner at apple.com
Sun Dec 6 18:03:39 PST 2009


On Dec 6, 2009, at 2:46 PM, Talin wrote:

> Is there any way to get a rough size estimate for functions in IR? Say I have a bitcode file that contains the definition of several classes. I'd like to be able to read in the file and report 'class A is roughly twice as big as class B', or 'This file consists of 60% class A, 30% class B, and 10% class C'. The numbers would be a rough relative measurement of the size of all globals and methods of the class, but they wouldn't have to correspond to the exact byte size of the final executable.
> 
> Basically what I want to do is track over time the amount of overhead caused by language features such as reflection and other metadata.

"opt -stats -inst-count" will tell you the #instructions of various sorts.

-Chris



More information about the llvm-dev mailing list