Alternatively, we could emit dcl_temps in the lowering passes (though this requires a bit more boilerplate)
Yeah. I don't hate this series, but I think that with the direction we've been going in lately we'll generally want to do some kind of raising pass(es) to insert the various dcl_ instructions and get the IR produced by d3dbc sources closer to what the SPIR-V backend expects, instead of making the SPIR-V backend able to handle d3dbc sources as-is.
I feel like the other alternative I mentioned is better, honestly, i.e. scanning both sm1 registers and sm4 dcl_temps to produce a "temp_count". Do you have a preference for normalizing in the direction of sm4 specifically?