sm: avoid unused variables

If there is no xpmem support, don't declare variables on used by xpmem.
Instead, move those into the functions that use xpmem.