porting and factoring spir + nvvm