gencpu.cpp: cleanup / compilation warning fixes

many const fixes, added a few runtime checks, and added NORETURN to term.