refactorize CodeGen.Common