Extend your compiler to generate code for while loops. Remember to extend liveness analysis to cater for loops. That is, there may be multipe blocks that jump to a block. This requires that the analysis performs a fixpoint computation.
Extend your compiler to generate code for functions. To cater for nested functions, you should pass a pointer to the call frame to the lecically enclosing function (a so called static link). Note that the static link may not point to the caller of the function.