Output user-defined functions in correct order in kernel source

Also add auto-vectorization hint, and name parameters for user-defined
functions a bit more eligible.
Exclude zero byte at end of kernel source code
Implement basic kernel caching

Will probably need to find some way of hashing expression trees directly
but this should do for now.

Also added a few minor fixes for AMD and Intel OpenCL compilers.