Count the total amount of stack space used in compiled functions.
authorJakob Stoklund Olesen <stoklund@2pi.dk>
Thu, 4 Aug 2011 21:06:09 +0000 (21:06 +0000)
committerJakob Stoklund Olesen <stoklund@2pi.dk>
Thu, 4 Aug 2011 21:06:09 +0000 (21:06 +0000)
Patch by Ivan Krasin!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136921 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/PrologEpilogInserter.cpp

index a901c5fefa3e4bb60e90a91501c53d80b5711316..7e5d804f913aed1b5e728c3ab8833209732a1628 100644 (file)
@@ -54,6 +54,7 @@ INITIALIZE_PASS_END(PEI, "prologepilog",
 
 STATISTIC(NumVirtualFrameRegs, "Number of virtual frame regs encountered");
 STATISTIC(NumScavengedRegs, "Number of frame index regs scavenged");
+STATISTIC(NumBytesStackSpace, "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 @@ void PEI::calculateFrameObjectOffsets(MachineFunction &Fn) {
   }
 
   // Update frame info to pretend that this is part of the stack...
-  MFI->setStackSize(Offset - LocalAreaOffset);
+  int64_t StackSize = Offset - LocalAreaOffset;
+  MFI->setStackSize(StackSize);
+  NumBytesStackSpace += StackSize;
 }
 
 /// insertPrologEpilogCode - Scan the function for modified callee saved