Use an enum FlatInstVariant to differentiate between the different
variants of flat instructions (flat, global and scratch).
This should make it easier to bundle the immediate offset logic in a
single place and implement restrictions and bug workarounds.
Fixed version of D99587, which does not rely on the address space.
Does this fix a real bug when AS == AMDGPUAS::GLOBAL_ADDRESS? If so it could do with a test case.