[llvm-commits] PrologEpilogInserter: add total stack size statistic

Ivan Krasin krasin at google.com
Thu Aug 4 14:01:18 PDT 2011


On Thu, Aug 4, 2011 at 1:56 PM, Jakob Stoklund Olesen <stoklund at 2pi.dk> wrote:
>
> On Aug 4, 2011, at 1:54 PM, Ivan Krasin wrote:
>
>> On Thu, Aug 4, 2011 at 1:45 PM, Jakob Stoklund Olesen <stoklund at 2pi.dk> wrote:
>>>
>>> On Aug 4, 2011, at 1:43 PM, Ivan Krasin wrote:
>>>
>>>> HI llvm team,
>>>>
>>>> this patch adds a new statistic proposed by Jakob: Number of bytes
>>>> used for stack in all function. For instance, it would make it easier
>>>> to measure progress/regress of instruction selectors and register
>>>> allocators.
>>>
>>> Awesome.
>>>
>>>> Index: lib/CodeGen/PrologEpilogInserter.cpp
>>>> ===================================================================
>>>> --- lib/CodeGen/PrologEpilogInserter.cpp      (revision 136909)
>>>> +++ lib/CodeGen/PrologEpilogInserter.cpp      (working copy)
>>>> @@ -54,6 +54,7 @@
>>>>
>>>> STATISTIC(NumVirtualFrameRegs, "Number of virtual frame regs encountered");
>>>> STATISTIC(NumScavengedRegs, "Number of frame index regs scavenged");
>>>> +STATISTIC(NumTotalStackSize, "Number of bytes used for stack in all
>>>> functions");
>>>>
>>>> /// createPrologEpilogCodeInserter - This function returns a pass that inserts
>>>> /// prolog and epilog code, and eliminates abstract frame references.
>>>> @@ -677,7 +678,9 @@
>>>>   }
>>>>
>>>>   // Update frame info to pretend that this is part of the stack...
>>>> -  MFI->setStackSize(Offset - LocalAreaOffset);
>>>> +  int StackSize = Offset - LocalAreaOffset;
>>>> +  MFI->setStackSize(StackSize);
>>>> +  NumTotalStackSize += StackSize;
>>>
>>> Is int really the right type here?
>> Thanks for the catch. Although LocalAreaOffset is int, Offset is
>> int64_t. So, I've changed StackSize type to int64_t.
>> Please, find the corrected patch attached.
>
> LGTM. Please commit with a different variable name as Cameron suggested.
I've renamed the variable. The updated patch is in the attach.
Please, commit it (obviously, I don't have committer rights) :)

Ivan Krasin
>
> /jakob
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: NumBytesStackSpace.patch
Type: text/x-patch
Size: 971 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20110804/885cba96/attachment.bin>


More information about the llvm-commits mailing list