Leaf and Non-Leaf procedure in MIPS

A leaf procedure is a procedure/function, which doesnt call any other procedure.

Example :

int leaf_procedure()
{
  int return_value;

  ...
  ...
return return_value;
}

A non-leaf procedure is a procedure/function, which call’s some other procedure within them.

Example :

int non_leaf_procedure()
{
  int return_value;

  ...
  leaf_procedure()
  ...
return return_value;
}

Simply, we can tell all recursive functions are non-leaf procedures. And we need atleast one leaf procedure to any program to exit, atleast in a normal way. 😉

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s