scala code gen for ir