[mips] Rewrite MipsTargetLowering::getAddr functions as template functions.

No intended functionality change.