compiler: refactor global loads/stores