Does -fomit-frame-pointer *always* omit the fp?

c, gcc, mips32, stack-frame

Solution

The frame pointer is not really needed for correct execution, except sometimes for exception unwind. Dynamic stack growth usually requires some kind of a frame pointer, but it is not tied to a particular register, but rather allocated through normal data flow analysis.

Basically, `-fomit-frame-pointer` demotes the FP from a fixed register assignment to a pseudo register and makes initialisation subject to dead store elimination. So the answer to the first question is no, it doesn't omit it always.

Problem

Does -fomit-frame-pointer always omit the frame pointer? Is there ever a situation where both the pc and fp need to be setup? Does dynamic stack growth force the fp to be setup? Asking specifically for MIPS32. Thanks!

Original source