[PATCH] D151400: [X86] Align stack to 16-bytes on 32-bit with X86_INTR call convention
Antonio Abbatangelo via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 24 19:57:44 PDT 2023
antangelo created this revision.
antangelo added reviewers: hjl.tools, pengfei, RKSimon.
Herald added a subscriber: hiraditya.
Herald added a project: All.
antangelo requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Adds a dynamic stack alignment to functions under the interrupt call
convention on x86-32. This fixes the issue where the stack can be
misaligned on entry, since x86-32 makes no guarantees about the stack
pointer position when the interrupt service routine is called.
The alignment is done by overriding X86RegisterInfo::shouldRealignStack,
and by setting the correct alignment in X86FrameLowering::calculateMaxStackAlign.
This forces the interrupt handler to be dynamically aligned, generating
the appropriate `and` instruction in the prologue and `lea` in the
epilogue. The `no-realign-stack` attribute can be used as an opt-out.
Fixes #26851
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D151400
Files:
llvm/lib/Target/X86/X86FrameLowering.cpp
llvm/lib/Target/X86/X86RegisterInfo.cpp
llvm/lib/Target/X86/X86RegisterInfo.h
llvm/test/CodeGen/X86/x86-32-intrcc.ll
llvm/test/CodeGen/X86/x86-interrupt_cc.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151400.525415.patch
Type: text/x-patch
Size: 27357 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230525/ea3884ae/attachment.bin>
More information about the llvm-commits
mailing list