Make instruction selection easier to parameterize.

Add stubbed version of generate_device_io. Causes assertion currently, need to debug.
Fix a few issues with IO writes