This is similar to SVN r311061 for ARM.
Details
Diff Detail
Event Timeline
Missing implicit-def of r16/r17?
On a sort-of-related note, I'm confused about the difference between small/large code model; doesn't the AArch64 linker support range-extension thunks? (This is related because range-extension thunks can clobber r16/r17.)
For both cases, or just the first one? (The other one has got .addReg(AArch64::X16, RegState::Kill) already. Would that be .addReg(AArch64::X16, RegState::Implicit | RegState::Define) for both X16 and X17 there? I can't say I really understand what all these flags mean.
On a sort-of-related note, I'm confused about the difference between small/large code model; doesn't the AArch64 linker support range-extension thunks? (This is related because range-extension thunks can clobber r16/r17.)
I guess AArch64 COFF linkers in general could support range extension thunks, although I don't know if link.exe does - lld doesn't at least. The __chkstk function itself also clobbers both X16 and X17, so they definitely should be considered clobbered here. (Not that I know what really would assume these registers to have any sensible value here, as this is emitted in the prologue of a function.)
For both cases; the "blr x16" both uses and clobbers x16, so it needs two operands to represent that. .addReg(AArch64::X16, RegState::Implicit | RegState::Define | RegState::Dead) is correct (just like you used for NZCV).
"RegState::Define" means it's a definition, rather than a use. RegState::Implicit means that it's not one of the explicit inputs or outputs listed in the instruction description. RegState::Dead and RegState::Kill are optimization hints; a dead definition is never used, and a "kill" use is the last use of a definition.
(Not that I know what really would assume these registers to have any sensible value here, as this is emitted in the prologue of a function.)
In theory, if unwind tables are disabled, some code after the prologue could get rescheduled into the prologue.
I guess AArch64 COFF linkers in general could support range extension thunks, although I don't know if link.exe does - lld doesn't at least.
I would be surprised if link.exe doesn't support it, given it supports the equivalent for 32-bit ARM.
Ok, thanks!
(Not that I know what really would assume these registers to have any sensible value here, as this is emitted in the prologue of a function.)
In theory, if unwind tables are disabled, some code after the prologue could get rescheduled into the prologue.
Oh, ok.