CodeGen: constify and use range loop for SSP

Use range-based for loop and constify the iterators.  NFC.