[llvm] 9061eb8 - Revert "Fix frame pointer layout on AArch64 Linux."
Owen Anderson via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 26 10:18:00 PDT 2020
Author: Owen Anderson
Date: 2020-08-26T17:17:14Z
New Revision: 9061eb8245cc1ae25e8f7865062d1d8e44406994
URL: https://github.com/llvm/llvm-project/commit/9061eb8245cc1ae25e8f7865062d1d8e44406994
DIFF: https://github.com/llvm/llvm-project/commit/9061eb8245cc1ae25e8f7865062d1d8e44406994.diff
LOG: Revert "Fix frame pointer layout on AArch64 Linux."
This broke stage2 of clang-cmake-aarch64-full.
This reverts commit a0aed80b22d1b698b86e0c16109fdfd4d592756f.
Added:
Modified:
llvm/lib/Target/AArch64/AArch64FrameLowering.cpp
llvm/lib/Target/AArch64/AArch64MachineFunctionInfo.h
Removed:
################################################################################
diff --git a/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp b/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp
index 687f6a6aa6a3..c6cc6e9e8471 100644
--- a/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp
+++ b/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp
@@ -1185,26 +1185,7 @@ void AArch64FrameLowering::emitPrologue(MachineFunction &MF,
// For funclets the FP belongs to the containing function.
if (!IsFunclet && HasFP) {
// Only set up FP if we actually need to.
- int64_t FPOffset;
-
- // The frame pointer needs to point to the location of the frame record
- // (x28 and x29) within the callee saved register space.
- if (isTargetDarwin(MF)) {
- // On Darwin, these are located at the top of the CSR space.
- FPOffset = (AFI->getCalleeSavedStackSize() - 16);
- } else {
- // On other systems, these are located in the middle of the CSR space,
- // after the other GPRs and before the FPRs.
- assert(MFI.isCalleeSavedInfoValid() && "CalleeSavedInfo not calculated");
- if (MFI.getCalleeSavedInfo().empty()) {
- FPOffset = 0;
- } else {
- FPOffset = AFI->getCalleeSavedStackSize(MFI, [](unsigned Reg) {
- return AArch64::FPR64RegClass.contains(Reg) ||
- AArch64::FPR128RegClass.contains(Reg);
- });
- }
- }
+ int64_t FPOffset = isTargetDarwin(MF) ? (AFI->getCalleeSavedStackSize() - 16) : 0;
if (CombineSPBump)
FPOffset += AFI->getLocalStackSize();
@@ -1861,16 +1842,8 @@ static StackOffset getFPOffset(const MachineFunction &MF, int64_t ObjectOffset)
unsigned FixedObject =
getFixedObjectSize(MF, AFI, IsWin64, /*IsFunclet=*/false);
-
- // Compensate for the position of the frame record within the callee-saved
- // register space. On Darwin, this is a fixed offset. On other systems,
- // this is determined by the number of callee-saved GPRs, excluding FPRs.
- unsigned FPAdjust =
- isTargetDarwin(MF)
- ? 16
- : AFI->getCalleeSavedStackSize(MF.getFrameInfo(), [](unsigned Reg) {
- return AArch64::GPR64RegClass.contains(Reg);
- });
+ unsigned FPAdjust = isTargetDarwin(MF)
+ ? 16 : AFI->getCalleeSavedStackSize(MF.getFrameInfo());
return {ObjectOffset + FixedObject + FPAdjust, MVT::i8};
}
diff --git a/llvm/lib/Target/AArch64/AArch64MachineFunctionInfo.h b/llvm/lib/Target/AArch64/AArch64MachineFunctionInfo.h
index 8fc41e973afb..84aa53f2bece 100644
--- a/llvm/lib/Target/AArch64/AArch64MachineFunctionInfo.h
+++ b/llvm/lib/Target/AArch64/AArch64MachineFunctionInfo.h
@@ -194,15 +194,9 @@ class AArch64FunctionInfo final : public MachineFunctionInfo {
// When CalleeSavedStackSize has not been set (for example when
// some MachineIR pass is run in isolation), then recalculate
// the CalleeSavedStackSize directly from the CalleeSavedInfo.
- // RegisterFilter is a predicate to calculate the stack size for
- // subsets of the callee-saved registers. It should return true
- // for registers that should be included in the size calculation,
- // and false otherwise.
// Note: This information can only be recalculated after PEI
// has assigned offsets to the callee save objects.
- unsigned getCalleeSavedStackSize(
- const MachineFrameInfo &MFI,
- llvm::function_ref<bool(unsigned)> RegisterFilter = nullptr) const {
+ unsigned getCalleeSavedStackSize(const MachineFrameInfo &MFI) const {
bool ValidateCalleeSavedStackSize = false;
#ifndef NDEBUG
@@ -212,24 +206,14 @@ class AArch64FunctionInfo final : public MachineFunctionInfo {
ValidateCalleeSavedStackSize = HasCalleeSavedStackSize;
#endif
- if (RegisterFilter || !HasCalleeSavedStackSize ||
- ValidateCalleeSavedStackSize) {
+ if (!HasCalleeSavedStackSize || ValidateCalleeSavedStackSize) {
assert(MFI.isCalleeSavedInfoValid() && "CalleeSavedInfo not calculated");
if (MFI.getCalleeSavedInfo().empty())
return 0;
int64_t MinOffset = std::numeric_limits<int64_t>::max();
int64_t MaxOffset = std::numeric_limits<int64_t>::min();
-
- bool AnyRegistersCounted = false;
for (const auto &Info : MFI.getCalleeSavedInfo()) {
- if (RegisterFilter) {
- unsigned Reg = Info.getReg();
- if (!RegisterFilter(Reg))
- continue;
- }
-
- AnyRegistersCounted = true;
int FrameIdx = Info.getFrameIdx();
if (MFI.getStackID(FrameIdx) != TargetStackID::Default)
continue;
@@ -237,15 +221,10 @@ class AArch64FunctionInfo final : public MachineFunctionInfo {
int64_t ObjSize = MFI.getObjectSize(FrameIdx);
MinOffset = std::min<int64_t>(Offset, MinOffset);
MaxOffset = std::max<int64_t>(Offset + ObjSize, MaxOffset);
- AnyRegistersCounted = true;
}
- if (!AnyRegistersCounted)
- return 0;
-
unsigned Size = alignTo(MaxOffset - MinOffset, 16);
- assert((RegisterFilter || !HasCalleeSavedStackSize ||
- getCalleeSavedStackSize() == Size) &&
+ assert((!HasCalleeSavedStackSize || getCalleeSavedStackSize() == Size) &&
"Invalid size calculated for callee saves");
return Size;
}
More information about the llvm-commits
mailing list