More moving code generation routines out of IRState.
Add 'target' attribute.