An important feature of instruction-referencing LiveDebugValues is that it can track variable values that are both in registers and on the stack at the same time. However, AArch64 doesn't benefit from this behaviour unless it is able to report when an instruction is a load or store from the stack. This patch implements two TargetInstrInfo hooks to collect this information.
These two functions are effectively copy-and-pastes of the pre-frame-elimination hooks, except that they recover the frame index of the stack slot accessed by examining the memory operand attached to the instruction. Instructions are recognised by being LDR* / STR* with constant offsets from the stack pointer.
The test added takes a Value, clobbers all registers with inlineasm to force the value onto the stack, then loads and returns it. LiveDebugValues should recognise this and:
- At the DBG_INST_REF mark the value as being on the stack with DBG_VALUE
- When the stack location is overwritten with the subsequent STRXui, LiveDebugValue should recognise this and place the variable in $x0, where it was loaded to.