how does an optimizing c++ compiler reuse stack slots of a function?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Pooria
    New Member
    • Jul 2010
    • 8

    #1

    how does an optimizing c++ compiler reuse stack slots of a function?

    How does an optimizing c++ compiler determine when a stack slot of a function(part of stack frame of a function) is no longer needed by that function, so it can reuse its memory? .
    By stack slot I mean a part of stack frame of a function, not necessarily a whole stack frame of a function and an example to clarify the matter is, suppose we have a function that has six integer variables defined in its scope, when it's time to use sixth variable in the function, fifth variable's become useless so compiler can use same memory block for fifth and sixth variables.
    any information on this subject is appreciated.
Working...