A Just In Time Register Allocation And Code Optimization Framework For Embedded Systems