Certain targets (e.g. amdgcn) require global variable to stay in global or constant address
space. In C or C++ global variables are emitted in the default (generic) address space.
This patch introduces virtual functions TargetCodeGenInfo::getGlobalVarAddressSpace
and TargetInfo::getConstantAddressSpace to handle this in a general approach.
It only affects IR generated for amdgcn target.
Why are you passing the TargetCodeGenInfo down separately when it can be easily reacquired from the CodeGenFunction?
Oh, it looks like getTargetHooks() is private; there's no reason for that, just make it public.