Refactor emitFrameOffset to accept a StackOffset struct as its offset argument.
This method currently only supports byte offsets (MVT::i8) but will be extended
in a later patch to support scalable offsets (MVT::nxv1i8) as well.
Details
Diff Detail
Event Timeline
lib/Target/AArch64/AArch64InstrInfo.cpp | ||
---|---|---|
2974–2975 | Are you intentionally performing the "DestReg == SrcReg && Offset == 0" both here and in emitFrameOffset? | |
3023 | "if (ShiftSize)" is always true? | |
3029 | The usage of "Sign" here is confusing; we always want a positive immediate for the SEH directives. | |
3037 | We should assert here that the remaining offset is zero, to make the expected control flow clear. | |
3041 | We should assert here that SrcReg is SP. | |
3074 | What is Offset.isZero() supposed to be checking here? |
lib/Target/AArch64/AArch64InstrInfo.cpp | ||
---|---|---|
2974–2975 | No I wasn't, thanks for pointing out! | |
3023 | In this patch it is always true. However, in the subsequent patch D61437: [AArch64] Static (de)allocation of SVE stack objects. I add a new opcode for SVE where ShiftSize is 0 (on line 2983). | |
3029 | I'll remove it, and add an assert to check that Sign is always positive. | |
3074 | For the case where the StackOffset can contain both (fixed-size) bytes, and scalable bytes (i.e. MVT::nxv1i8 for SVE where we know there are 'n x bytes', with 'n' being a runtime constant), we want to use ADDXri to emit a frame-offset if:
Or:
The functionality is added in D61437: [AArch64] Static (de)allocation of SVE stack objects. (lines 3067-3082). |
LGTM
lib/Target/AArch64/AArch64InstrInfo.cpp | ||
---|---|---|
3074 | Oh, you don't want to emit the mov if the offset isn't empty because it would be redundant. That makes sense. |
My previous patch didn't have any context, so added it now (git format-patch -U999999)
Are you intentionally performing the "DestReg == SrcReg && Offset == 0" both here and in emitFrameOffset?