Problems with passing parameters in registers

  • Passing parameters in registers will only work with 1 level of function calls

  • You can not use the registers again to call another function:

       int main( )          int f(int x, int y)       int g(int a, int b)   
       {                    {                         {
          f(x, y)               g(x, y)                  ...
       }                    }                         }
    

  • main( ) can pass parameters to f( ) in registers:

     main:                       f:
       pass x, y in r0, r1          uses r0, r1
       bl   f                       
                                    pass parameters in ???
                                    bl    g
    

    f( ) cannot use registers r0, r1 to pass parameters !

    (Because they are used to store its parameters)