Extends drreg support for multi-phase use by avoiding aflags spill slot conflict across different phases.
Removes existing restriction of aflags spill slot always being the slot 0. Allows selection of aflags spill slot at spills, and releasing of the slot at unreservations. Unlike gprs, we need to reset pt->aflags.slot everytime we release the slot, because this field is used to determine whether we are spilling/restoring aflags in various routines.
Adjusts fault restoration logic in drreg_event_restore_state_without_ilist to detect aflags spill slot dynamically. This is not perfect as we need the ilist for robust restoration, which is done in drreg_event_restore_state_with_ilist if ilist is available.
Adds drreg test to verify absence of aflags spill slot conflict when aflags are reserved in app2app and insertion phases.
Also adds drreg test to verify correct restoration of aflags on fault, for various cases: when the spill regions are nested, when they overlap (but are not nested), when the aflags value is restored once before the fault, when the native aflags value is spilled to multiple slots by different phases, and tests for some restoration cases when the faulting fragment's ilist isn't available.
Adds a small fix for subtest detection in drreg-test, which didn't work if the duplicate mov immediates occurred later in a sequence of mov instrs.
Renames drreg-test and signal handlers to a more descriptive name rather than just incrementing numbers/alphabets.
Modifies the path where xax is already reserved and in-use when aflags are reserved: instead of writing aflags value to the spill slot using xax_swap, we now use xax itself. This is for a simpler drreg state restoration logic, which can now correctly assume that aflags are always written to slot using xax. Also added a test for this scenario.
Documents limitation of drreg_statelessly_restore_app_value that there should
not be any new reservations that cause a new spill slot selection between the
given where_restore
and where_respill
instrs.
Also adds a test that exercises drreg_statelessly_restore_app_value for xax when aflags are in xax.
Issue: #3823 (closed), #2985 (closed) Fixes: #3823 (closed)