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

Martin J. O'Riordan via llvm-dev llvm-dev at lists.llvm.org
Mon Feb 5 14:22:58 PST 2018

Cool this is better than I expected - I never thought about the YAML support.  And the document reference is really very good.

Thanks Francis,


-----Original Message-----
From: Francis Visoiu Mistrih [mailto:francisvm at yahoo.com] 
Sent: 05 February 2018 21:43
To: Martin J. O'Riordan <MartinO at theheart.ie>
Cc: LLVM Developers <llvm-dev at lists.llvm.org>; Adam Nemet <anemet at apple.com>
Subject: Re: [llvm-dev] Dumping the static stack reservation sizes for functions

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
  - 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



> 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