Wanted: a program that calulates the maximal stack depth

samuel@nada.kth.se
Mon, 6 Apr 1992 19:58:33 GMT

          From comp.compilers

Related articles
Wanted: a program that calulates the maximal stack depth samuel@nada.kth.se (1992-04-06)
Re: Wanted: a program that calulates the maximal stack depth russw@cs.utexas.edu (1992-04-09)
Re: Wanted: a program that calulates the maximal stack depth bliss@sp64.csrd.uiuc.edu (1992-04-09)
Re: Wanted: a program that calulates the maximal stack depth hays@ssd.intel.com (1992-04-09)
Re: Wanted: a program that calulates the maximal stack depth pbk@arkesden.Eng.Sun.COM (1992-04-10)
Re: Wanted: a program that calulates the maximal stack depth eifrig@beanworld.cs.jhu.edu (1992-04-10)
Re: Wanted: a program that calulates the maximal stack depth samuel@nada.kth.se (1992-04-11)
| List of all articles for this month |
Newsgroups: comp.compilers
From: samuel@nada.kth.se
Keywords: code, question
Organization: Compilers Central
Date: Mon, 6 Apr 1992 19:58:33 GMT

Hi netters!


  I'm developing an application where the use of stack space is crucial.
The program almost only manipulates sequential structures and calls no
library functions. So what I need is a utility that calculates the maximal
used-up stack space for each function in the code. The output could
look something like:


                                          size of call frame to main
                                                                      |
                                                                      V
        main : max(init, main_loop) + 10 = 200
        init : max(init_a, init_b, init_c) + 12 = 190


(a recursive function, not called directly or indirectly by any of the above:)
        foo : Recursive*12 + 12 = Recursive*12+12


and so on. The program would probably work by building arithmetic trees and
then propagating the leaf values from the functions that don't call any other.
You would have to feed into it the size of the basic data types, the size of
calls, and the source code.


  If anybody has heard of such a program, please let me know!


  If there is no such thing anywhere, maybe someone could point me to a
PD C grammar that builds expression/statement trees. I'm happy for any hint
I can get.
                                                                                                        Sam




         Samuel Cederlund, programming assistant samuel@nada.kth.se
                Interaction and presentation lab
         Dep. of computer science
                Royal Inst. of Technology
[I'd think that in many cases it might be easier to scan the generated
assembler code for instructions that change the stack pointer. Several C
grammars are available, see the compilers FAQ. -John]
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.