Implement toIR as a visitor