split IR out of tonnikala specific code; now it should be possible to
minimally write an IR generator for chameleon.