Convert generated code into rt

It reduces generated code size and simplifies codegen.