Pass address space numbers from command line

Patch by Daniel Liew with some changes
Merge branch 'master' into llvm-trunk