We need to specify interface effects on condition codes
Currently (AIUI) Chris' instruction selection design doesn't track def-vs-use links for insns which def and then use the condition codes. Instead it merely places them adjacently and then assumes nothing is going to mess them up.
This seems totally fine to me (in fact, I'm actively in favour of it). But that does place upon us the responsibility to specify in the RA's interface, the following requirements:
-
The instructions created by
gen_spillandgen_reloadabsolutely must not change the machine's condition codes. [Because the client has no way to ensure that such insns don't get inserted between a condition code def and use]. -
The instructions created by
direct_reloadhave a similar but more complex constraint, viz: they must write the exact same set of condition codes that the original (to-be-replaced) instruction does.
In practice, satisfying these is not a problem for any reasonable target. So it's a documentation-only requirement. I'll prepare a patch.