Path: blob/main/contrib/llvm-project/llvm/lib/Target/ARM/ARMFrameLowering.h
35269 views
//===- ARMTargetFrameLowering.h - Define frame lowering for ARM -*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#ifndef LLVM_LIB_TARGET_ARM_ARMFRAMELOWERING_H9#define LLVM_LIB_TARGET_ARM_ARMFRAMELOWERING_H1011#include "llvm/CodeGen/TargetFrameLowering.h"12#include "llvm/Support/TypeSize.h"1314namespace llvm {1516class ARMSubtarget;17class CalleeSavedInfo;18class MachineFunction;1920class ARMFrameLowering : public TargetFrameLowering {21protected:22const ARMSubtarget &STI;2324public:25explicit ARMFrameLowering(const ARMSubtarget &sti);2627/// emitProlog/emitEpilog - These methods insert prolog and epilog code into28/// the function.29void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override;30void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override;3132bool spillCalleeSavedRegisters(MachineBasicBlock &MBB,33MachineBasicBlock::iterator MI,34ArrayRef<CalleeSavedInfo> CSI,35const TargetRegisterInfo *TRI) const override;3637bool38restoreCalleeSavedRegisters(MachineBasicBlock &MBB,39MachineBasicBlock::iterator MI,40MutableArrayRef<CalleeSavedInfo> CSI,41const TargetRegisterInfo *TRI) const override;4243bool keepFramePointer(const MachineFunction &MF) const override;4445bool enableCalleeSaveSkip(const MachineFunction &MF) const override;4647bool hasFP(const MachineFunction &MF) const override;48bool isFPReserved(const MachineFunction &MF) const;49bool requiresAAPCSFrameRecord(const MachineFunction &MF) const;50bool hasReservedCallFrame(const MachineFunction &MF) const override;51bool canSimplifyCallFramePseudos(const MachineFunction &MF) const override;52StackOffset getFrameIndexReference(const MachineFunction &MF, int FI,53Register &FrameReg) const override;54int ResolveFrameIndexReference(const MachineFunction &MF, int FI,55Register &FrameReg, int SPAdj) const;5657void getCalleeSaves(const MachineFunction &MF,58BitVector &SavedRegs) const override;59void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs,60RegScavenger *RS) const override;6162/// Update the IsRestored flag on LR if it is spilled, based on the return63/// instructions.64static void updateLRRestored(MachineFunction &MF);6566void processFunctionBeforeFrameFinalized(67MachineFunction &MF, RegScavenger *RS = nullptr) const override;6869void adjustForSegmentedStacks(MachineFunction &MF,70MachineBasicBlock &MBB) const override;7172/// Returns true if the target will correctly handle shrink wrapping.73bool enableShrinkWrapping(const MachineFunction &MF) const override;7475bool isProfitableForNoCSROpt(const Function &F) const override {76// The no-CSR optimisation is bad for code size on ARM, because we can save77// many registers with a single PUSH/POP pair.78return false;79}8081bool82assignCalleeSavedSpillSlots(MachineFunction &MF,83const TargetRegisterInfo *TRI,84std::vector<CalleeSavedInfo> &CSI) const override;8586const SpillSlot *87getCalleeSavedSpillSlots(unsigned &NumEntries) const override;8889private:90void emitPushInst(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI,91ArrayRef<CalleeSavedInfo> CSI, unsigned StmOpc,92unsigned StrOpc, bool NoGap, bool (*Func)(unsigned, bool),93unsigned NumAlignedDPRCS2Regs, unsigned MIFlags = 0) const;94void emitPopInst(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI,95MutableArrayRef<CalleeSavedInfo> CSI, unsigned LdmOpc,96unsigned LdrOpc, bool isVarArg, bool NoGap,97bool (*Func)(unsigned, bool),98unsigned NumAlignedDPRCS2Regs) const;99100MachineBasicBlock::iterator101eliminateCallFramePseudoInstr(MachineFunction &MF,102MachineBasicBlock &MBB,103MachineBasicBlock::iterator MI) const override;104};105106} // end namespace llvm107108#endif // LLVM_LIB_TARGET_ARM_ARMFRAMELOWERING_H109110111