Hi, > + Establish an ANTI dependency between r11 and r15 restores from FPRs > + to prevent the instructions scheduler from reordering them since > + this would break CFI. No further handling in the sched_reorder > + hook is required since the r11 and r15 restore will never appear in > + the same ready list with that change. */ [..] > + if (r11_restore == NULL || r15_restore == NULL) > + return; > + add_dependence (r11_restore, r15_restore, REG_DEP_ANTI); > +}
an anti dependency seems an odd choice because r15 would be restored before r11 (according to the patch's changes in s390_restore_gprs_from_fprs) and the CFI note for r11 reads from/requires r15. This would rather indicate a data dependency from r15 to r11 but I understand that you don't want the scheduler to assume there is a real dependency including effects on insn priority and latency. I looked in haifa-sched.c and sched-ebb.c for methods to prevent reordering two "special" instructions but did not find anything. There is of course code to prevent scheduling stack-referencing insns across a stack pointer restore but it doesn't seem to allow adding more instructions. I came across add_deps_for_risky_insns, though, which also uses anti dependencies, apparently for a similar reason, so maybe that's the normal and accepted way to do it. Regards Robin