Shift common code out of a switch.

compiler/layout_out.m:
    Respond to review comments from Paul.