nir: Add a nir_foreach_function_temp_variable helper