diff options
Diffstat (limited to 'llvm/lib/Target/RISCV/RISCVMachineFunctionInfo.h')
-rw-r--r-- | llvm/lib/Target/RISCV/RISCVMachineFunctionInfo.h | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/llvm/lib/Target/RISCV/RISCVMachineFunctionInfo.h b/llvm/lib/Target/RISCV/RISCVMachineFunctionInfo.h index 585bff2bc20a..c379a8d8f0d6 100644 --- a/llvm/lib/Target/RISCV/RISCVMachineFunctionInfo.h +++ b/llvm/lib/Target/RISCV/RISCVMachineFunctionInfo.h @@ -13,6 +13,7 @@ #ifndef LLVM_LIB_TARGET_RISCV_RISCVMACHINEFUNCTIONINFO_H #define LLVM_LIB_TARGET_RISCV_RISCVMACHINEFUNCTIONINFO_H +#include "RISCVSubtarget.h" #include "llvm/CodeGen/MachineFrameInfo.h" #include "llvm/CodeGen/MachineFunction.h" @@ -22,7 +23,6 @@ namespace llvm { /// and contains private RISCV-specific information for each MachineFunction. class RISCVMachineFunctionInfo : public MachineFunctionInfo { private: - MachineFunction &MF; /// FrameIndex for start of varargs area int VarArgsFrameIndex = 0; /// Size of the save area used for varargs @@ -30,9 +30,11 @@ private: /// FrameIndex used for transferring values between 64-bit FPRs and a pair /// of 32-bit GPRs via the stack. int MoveF64FrameIndex = -1; + /// Size of any opaque stack adjustment due to save/restore libcalls. + unsigned LibCallStackSize = 0; public: - RISCVMachineFunctionInfo(MachineFunction &MF) : MF(MF) {} + RISCVMachineFunctionInfo(const MachineFunction &MF) {} int getVarArgsFrameIndex() const { return VarArgsFrameIndex; } void setVarArgsFrameIndex(int Index) { VarArgsFrameIndex = Index; } @@ -40,11 +42,22 @@ public: unsigned getVarArgsSaveSize() const { return VarArgsSaveSize; } void setVarArgsSaveSize(int Size) { VarArgsSaveSize = Size; } - int getMoveF64FrameIndex() { + int getMoveF64FrameIndex(MachineFunction &MF) { if (MoveF64FrameIndex == -1) - MoveF64FrameIndex = MF.getFrameInfo().CreateStackObject(8, 8, false); + MoveF64FrameIndex = + MF.getFrameInfo().CreateStackObject(8, Align(8), false); return MoveF64FrameIndex; } + + unsigned getLibCallStackSize() const { return LibCallStackSize; } + void setLibCallStackSize(unsigned Size) { LibCallStackSize = Size; } + + bool useSaveRestoreLibCalls(const MachineFunction &MF) const { + // We cannot use fixed locations for the callee saved spill slots if the + // function uses a varargs save area. + return MF.getSubtarget<RISCVSubtarget>().enableSaveRestore() && + VarArgsSaveSize == 0 && !MF.getFrameInfo().hasTailCall(); + } }; } // end namespace llvm |