On Wed, Nov 06, 2024 at 04:27:51PM +0100, Uros Bizjak wrote: > I see. While my solution would fit nicely with the above > ASM_CALL_CONSTRAINT approach, the approach using ASM_CALL_CONSTRAINT > is wrong by itself. > > Oh, well. > > Anyway, I guess "redzone" clobber you proposed does not remove the > need to use ASM_CALL_CONSTRAINT if we want to confine the "asm with > call inside" between frame setup/teardown insns? Is it possible to > invent similar clobber (unimaginatively called "stack", perhaps) that > would prevent scheduler from moving asm to the wrong place?
I don't understand why would one want to avoid moving such inline asms there, the profiler can be called from there too and if a function doesn't use a red zone and the inline asm restores all registers except those explicitly clobbered in the clobbers, I think such calls can be done pretty much everywhere. Sure, frame pointers might miss one frame, but frame pointer reliability for backtraces is abysmal anyway. But I'm not aware of a testcase where we would actually move inline asm there either (at least not on x86). Is that some known problem (and then why?) or just theoretical issue? Or do you want a new clobber which will automatically add all call clobbered registers to the clobbers? That might be useful, although in case where one compiler can support multiple call ABIs one needs to pick one; would that stand for the ABI of the current function, or something else? Jakub