Hi,<br><br>I'm looking at writing a custom backend targetting a proprietary virtual machine. I'm basing it on the existing C and MSIL backends. My VM only has 32- and 64-bit integer operations (like the JVM) but C code compiled with llvmgcc typically has lots of 1-, 8- and 16-bit instructions.
<br><br>I was thinking of writing a custom pass to promote small integer types and instructions to 32-bits, adding sign- and/or zero-extension instructions where necessary. Does this sound reasonable?<br><br>If my pass inserts sign/zero-extensions instructions naively then lots of them will probably turn out to be redundant. Can I run other optimization passes afterwards to remove the redundant instructions? Is there any danger that running other optimization passes will re-introduce 8- or 16-bit instructions?
<br><br>Alternatively, I noticed that SelectionDAG::Legalize() already contains code to promote small integer values, but I'm not sure how to take advantage of it. If I use a SelectionDAG would I have to use all the rest of the target machinery that's designed for targetting real CPUs? Because I don't think I want to use SelectionDAG-based instruction selection, and I certainly don't want to do conventional register allocation.
<br><br>Thanks for any help,<br><span class="sg">Jay.
</span>