<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<div id="divtagdefaultwrapper" dir="ltr" style="font-size: 12pt; color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, "EmojiFont", "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;">
<p style="margin-top:0; margin-bottom:0">Alternatively, you can parse the assembly...</p>
<p style="margin-top:0; margin-bottom:0"><a href="https://github.com/spotify/linux/blob/master/scripts/checkstack.pl" class="OWAAutoLink" id="LPlnk851410" previewremoved="true">https://github.com/spotify/linux/blob/master/scripts/checkstack.pl</a></p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0">I've used something like this in the past on x86 and ARM.  I also parsed the output of objdump enough so that I could connect callers and callees (static dispatch only), so that I could analyze stack depths.<br>
</p>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>From:</b> llvm-dev <llvm-dev-bounces@lists.llvm.org> on behalf of Martin J. O'Riordan via llvm-dev <llvm-dev@lists.llvm.org><br>
<b>Sent:</b> Monday, February 5, 2018 4:22:58 PM<br>
<b>To:</b> 'Francis Visoiu Mistrih'<br>
<b>Cc:</b> 'LLVM Developers'<br>
<b>Subject:</b> Re: [llvm-dev] Dumping the static stack reservation sizes for functions</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="PlainText">Cool this is better than I expected - I never thought about the YAML support.  And the document reference is really very good.<br>
<br>
Thanks Francis,<br>
<br>
        MartinO<br>
<br>
-----Original Message-----<br>
From: Francis Visoiu Mistrih [<a href="mailto:francisvm@yahoo.com">mailto:francisvm@yahoo.com</a>]
<br>
Sent: 05 February 2018 21:43<br>
To: Martin J. O'Riordan <MartinO@theheart.ie><br>
Cc: LLVM Developers <llvm-dev@lists.llvm.org>; Adam Nemet <anemet@apple.com><br>
Subject: Re: [llvm-dev] Dumping the static stack reservation sizes for functions<br>
<br>
Hi Martin,<br>
<br>
> On Feb 5, 2018, at 11:46 AM, Martin J. O'Riordan via llvm-dev <llvm-dev@lists.llvm.org> wrote:<br>
> <br>
> 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:<br>
>  <br>
> -warn-stack-size=<uint><br>
>  <br>
> 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?<br>
<br>
There is an optimization remark emitted (in YAML) for the stack size:<br>
<br>
$ clang -fsave-optimization-record foo.c $ cat foo.opt.yaml […]<br>
--- !Analysis<br>
Pass:            prologepilog<br>
Name:            StackSize<br>
DebugLoc:        { File: foo.c, Line: 3, Column: 0 }<br>
Function:        main<br>
Args:<br>
  - NumStackBytes:   '24'<br>
  - String:          ' stack bytes in function'<br>
...<br>
[…]<br>
<br>
For more information about optimization remarks I suggest Adam’s talk: <a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_devmtg_2016-2D11_Slides_Nemet-2DCompiler-2DassistedPerformanceAnalysis.pdf&d=DwIGaQ&c=I_0YwoKy7z5LMTVdyO6YCiE2uzI1jjZZuIPelcSjixA&r=y8mub81SfUi-UCZRX0Vl1g&m=91ISonwGFC-5PXicMmU7hKU05JDu3cO9Xj1OSyr8fQo&s=O5WFJ5ZuPJlCKra2PNkkyQbSS7Qmy1y-1mQtRqj0yE8&e=">
https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_devmtg_2016-2D11_Slides_Nemet-2DCompiler-2DassistedPerformanceAnalysis.pdf&d=DwIGaQ&c=I_0YwoKy7z5LMTVdyO6YCiE2uzI1jjZZuIPelcSjixA&r=y8mub81SfUi-UCZRX0Vl1g&m=91ISonwGFC-5PXicMmU7hKU05JDu3cO9Xj1OSyr8fQo&s=O5WFJ5ZuPJlCKra2PNkkyQbSS7Qmy1y-1mQtRqj0yE8&e=</a><br>
<br>
Cheers,<br>
<br>
—<br>
Francis<br>
<br>
>  <br>
> Thanks,<br>
>  <br>
>             MartinO<br>
>  <br>
> _______________________________________________<br>
> LLVM Developers mailing list<br>
> llvm-dev@lists.llvm.org<br>
> <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_llvm-2Ddev&d=DwIGaQ&c=I_0YwoKy7z5LMTVdyO6YCiE2uzI1jjZZuIPelcSjixA&r=y8mub81SfUi-UCZRX0Vl1g&m=91ISonwGFC-5PXicMmU7hKU05JDu3cO9Xj1OSyr8fQo&s=O4d7UXtJcj-2MZnKbdq-U7N5z1d1l1302PuDIAlj4h8&e=">
https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_llvm-2Ddev&d=DwIGaQ&c=I_0YwoKy7z5LMTVdyO6YCiE2uzI1jjZZuIPelcSjixA&r=y8mub81SfUi-UCZRX0Vl1g&m=91ISonwGFC-5PXicMmU7hKU05JDu3cO9Xj1OSyr8fQo&s=O4d7UXtJcj-2MZnKbdq-U7N5z1d1l1302PuDIAlj4h8&e=</a><br>
<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
llvm-dev@lists.llvm.org<br>
<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_llvm-2Ddev&d=DwIGaQ&c=I_0YwoKy7z5LMTVdyO6YCiE2uzI1jjZZuIPelcSjixA&r=y8mub81SfUi-UCZRX0Vl1g&m=91ISonwGFC-5PXicMmU7hKU05JDu3cO9Xj1OSyr8fQo&s=O4d7UXtJcj-2MZnKbdq-U7N5z1d1l1302PuDIAlj4h8&e=">https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_llvm-2Ddev&d=DwIGaQ&c=I_0YwoKy7z5LMTVdyO6YCiE2uzI1jjZZuIPelcSjixA&r=y8mub81SfUi-UCZRX0Vl1g&m=91ISonwGFC-5PXicMmU7hKU05JDu3cO9Xj1OSyr8fQo&s=O4d7UXtJcj-2MZnKbdq-U7N5z1d1l1302PuDIAlj4h8&e=</a><br>
</div>
</span></font></div>
</div>
</body>
</html>