regalloc.rs icon indicating copy to clipboard operation
regalloc.rs copied to clipboard

We need to specify interface effects on condition codes

Open julian-seward1 opened this issue 6 years ago • 0 comments

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_spill and gen_reload absolutely 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_reload have 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.

julian-seward1 avatar Jan 16 '20 16:01 julian-seward1