[llvm] Spill/restore FP/BP around instructions in which they are clobbered (PR #81048)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 7 14:38:47 PST 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 9c75a981554d5de4b909e6493f2c3dda03395aa2 619b9e24202d50f120a8319d36a4980d017611aa -- llvm/include/llvm/CodeGen/MachineFrameInfo.h llvm/include/llvm/CodeGen/TargetFrameLowering.h llvm/include/llvm/CodeGen/TargetRegisterInfo.h llvm/lib/CodeGen/PrologEpilogInserter.cpp llvm/lib/Target/X86/X86FrameLowering.cpp llvm/lib/Target/X86/X86FrameLowering.h llvm/lib/Target/X86/X86RegisterInfo.h
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/lib/CodeGen/PrologEpilogInserter.cpp b/llvm/lib/CodeGen/PrologEpilogInserter.cpp
index 040a3f4f95..e68afdff46 100644
--- a/llvm/lib/CodeGen/PrologEpilogInserter.cpp
+++ b/llvm/lib/CodeGen/PrologEpilogInserter.cpp
@@ -77,15 +77,15 @@ using MBBVector = SmallVector<MachineBasicBlock *, 4>;
STATISTIC(NumLeafFuncWithSpills, "Number of leaf functions with CSRs");
STATISTIC(NumFuncSeen, "Number of functions seen in PEI");
-static cl::opt<bool> SpillClobberedFP(
- "spill-clobbered-fp",
- cl::desc("Spill clobbered fp register to stack."),
- cl::init(false), cl::Hidden);
+static cl::opt<bool>
+ SpillClobberedFP("spill-clobbered-fp",
+ cl::desc("Spill clobbered fp register to stack."),
+ cl::init(false), cl::Hidden);
-static cl::opt<bool> SpillClobberedBP(
- "spill-clobbered-bp",
- cl::desc("Spill clobbered bp register to stack."),
- cl::init(true), cl::Hidden);
+static cl::opt<bool>
+ SpillClobberedBP("spill-clobbered-bp",
+ cl::desc("Spill clobbered bp register to stack."),
+ cl::init(true), cl::Hidden);
namespace {
@@ -1685,7 +1685,8 @@ void PEI::spillFrameBasePointer(MachineFunction &MF) {
BPLive = true;
Start = MI++;
- } while ((MI != ME) && (FPLive || BPLive ||
+ } while ((MI != ME) &&
+ (FPLive || BPLive ||
accessFrameBasePointer(*MI, FP, BP, AccessFP, AccessBP, TRI)));
// If the bp is clobbered by a call, we should save and restore outside of
diff --git a/llvm/lib/Target/X86/X86FrameLowering.cpp b/llvm/lib/Target/X86/X86FrameLowering.cpp
index 1fe874623b..5b95493009 100644
--- a/llvm/lib/Target/X86/X86FrameLowering.cpp
+++ b/llvm/lib/Target/X86/X86FrameLowering.cpp
@@ -4189,9 +4189,9 @@ static int computeSPAdjust4SpillFPBP(MachineFunction &MF,
return AlignedSize - AllocSize;
}
-void X86FrameLowering::spillFPBPUsingSP(
- MachineFunction &MF, MachineBasicBlock::iterator BeforeMI,
- bool SpillFP, bool SpillBP) const {
+void X86FrameLowering::spillFPBPUsingSP(MachineFunction &MF,
+ MachineBasicBlock::iterator BeforeMI,
+ bool SpillFP, bool SpillBP) const {
const TargetRegisterClass *RC;
unsigned RegNum = 0;
MachineBasicBlock *MBB = BeforeMI->getParent();
@@ -4229,9 +4229,9 @@ void X86FrameLowering::spillFPBPUsingSP(
emitSPUpdate(*MBB, BeforeMI, DL, -SPAdjust, false);
}
-void X86FrameLowering::restoreFPBPUsingSP(
- MachineFunction &MF, MachineBasicBlock::iterator AfterMI,
- bool SpillFP, bool SpillBP) const {
+void X86FrameLowering::restoreFPBPUsingSP(MachineFunction &MF,
+ MachineBasicBlock::iterator AfterMI,
+ bool SpillFP, bool SpillBP) const {
Register FP, BP;
const TargetRegisterClass *RC;
unsigned RegNum = 0;
diff --git a/llvm/lib/Target/X86/X86FrameLowering.h b/llvm/lib/Target/X86/X86FrameLowering.h
index 0d77933363..0c83fa43f2 100644
--- a/llvm/lib/Target/X86/X86FrameLowering.h
+++ b/llvm/lib/Target/X86/X86FrameLowering.h
@@ -103,19 +103,16 @@ public:
MutableArrayRef<CalleeSavedInfo> CSI,
const TargetRegisterInfo *TRI) const override;
- void
- spillFPBPUsingSP(MachineFunction &MF,
- const MachineBasicBlock::iterator BeforeMI,
- bool SpillFP, bool SpillBP) const override;
+ void spillFPBPUsingSP(MachineFunction &MF,
+ const MachineBasicBlock::iterator BeforeMI,
+ bool SpillFP, bool SpillBP) const override;
- void
- restoreFPBPUsingSP(MachineFunction &MF,
- const MachineBasicBlock::iterator AfterMI,
- bool SpillFP, bool SpillBP) const override;
+ void restoreFPBPUsingSP(MachineFunction &MF,
+ const MachineBasicBlock::iterator AfterMI,
+ bool SpillFP, bool SpillBP) const override;
- bool
- skipSpillFPBP(MachineFunction &MF,
- MachineBasicBlock::reverse_iterator &MI) const override;
+ bool skipSpillFPBP(MachineFunction &MF,
+ MachineBasicBlock::reverse_iterator &MI) const override;
bool hasFP(const MachineFunction &MF) const override;
bool hasReservedCallFrame(const MachineFunction &MF) const override;
``````````
</details>
https://github.com/llvm/llvm-project/pull/81048
More information about the llvm-commits
mailing list