[IR] Factorize int constant generation in Context