[llvm-dev] Dumping the static stack reservation sizes for functions

Francis Visoiu Mistrih via llvm-dev llvm-dev at lists.llvm.org
Mon Feb 5 13:43:27 PST 2018


Hi Martin,

> On Feb 5, 2018, at 11:46 AM, Martin J. O'Riordan via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> 
> I would like to be able to emit a list of functions by name and their fixed stack reservation size information, so that a programmer can gauge how much stack they are likely to need in tightly constrained embedded systems.  Despite the rich number of options, the only option I can find that is even relatively close is:
>  
> -warn-stack-size=<uint>
>  
> Is there some existing way of getting this information emitted in an easily parsable way (e.g. in CSV form) , or will I need to add the capability?

There is an optimization remark emitted (in YAML) for the stack size:

$ clang -fsave-optimization-record foo.c
$ cat foo.opt.yaml
[…]
--- !Analysis
Pass:            prologepilog
Name:            StackSize
DebugLoc:        { File: foo.c, Line: 3, Column: 0 }
Function:        main
Args:
  - NumStackBytes:   '24'
  - String:          ' stack bytes in function'
...
[…]

For more information about optimization remarks I suggest Adam’s talk: https://llvm.org/devmtg/2016-11/Slides/Nemet-Compiler-assistedPerformanceAnalysis.pdf

Cheers,

— 
Francis

>  
> Thanks,
>  
>             MartinO
>  
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev



More information about the llvm-dev mailing list