rewrote register allocator,fixes