this shouldn't belong here, move to IR compiler