Fixed code generation bug.

- Added TI_DEBUG_COMPILATION flag to see emitted code.
Passed another test

- Test for failure on undefined functions.
Optimised code generation

- All compiler functions use a result register to put the final result in.  This way we can avoid redundant instructions to put a value in another register via r0.