C Function Call to Assembly Translation — Frame Pointer Operations

EventHelix
Software Design
Published in
Jun 2, 2017

Even though most programming is now carried out in high level languages, a good understanding of the generated assembly code really helps in debugging, performance analysis, and performance tuning.

In this article, we will discuss the assembly code generated for function calling, parameter passing and local variable management. Frame pointer operations in a function call are described in detail.

C function calling under the hood

We follow the lifecycle of a function call:

  1. Pushing parameters
  2. Invoking function
  3. Setting up the frame pointer
  4. Dismantling the frame and restoring the callers frame at function exit
  5. The caller popping the parameters.

C to Assembly: function calls and frame pointer operations

--

--