Path: blob/main/contrib/llvm-project/llvm/lib/Target/LoongArch/LoongArchFrameLowering.h
35269 views
//=- LoongArchFrameLowering.h - TargetFrameLowering for LoongArch -*- 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//===----------------------------------------------------------------------===//7//8// This class implements LoongArch-specific bits of TargetFrameLowering class.9//10//===----------------------------------------------------------------------===//1112#ifndef LLVM_LIB_TARGET_LOONGARCH_LOONGARCHFRAMELOWERING_H13#define LLVM_LIB_TARGET_LOONGARCH_LOONGARCHFRAMELOWERING_H1415#include "llvm/CodeGen/TargetFrameLowering.h"1617namespace llvm {18class LoongArchSubtarget;1920class LoongArchFrameLowering : public TargetFrameLowering {21const LoongArchSubtarget &STI;2223public:24explicit LoongArchFrameLowering(const LoongArchSubtarget &STI)25: TargetFrameLowering(StackGrowsDown,26/*StackAlignment=*/Align(16),27/*LocalAreaOffset=*/0),28STI(STI) {}2930void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override;31void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override;3233void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs,34RegScavenger *RS) const override;3536void processFunctionBeforeFrameFinalized(MachineFunction &MF,37RegScavenger *RS) const override;3839bool hasReservedCallFrame(const MachineFunction &MF) const override;40MachineBasicBlock::iterator41eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB,42MachineBasicBlock::iterator MI) const override;43bool spillCalleeSavedRegisters(MachineBasicBlock &MBB,44MachineBasicBlock::iterator MI,45ArrayRef<CalleeSavedInfo> CSI,46const TargetRegisterInfo *TRI) const override;4748StackOffset getFrameIndexReference(const MachineFunction &MF, int FI,49Register &FrameReg) const override;5051bool hasFP(const MachineFunction &MF) const override;52bool hasBP(const MachineFunction &MF) const;5354uint64_t getFirstSPAdjustAmount(const MachineFunction &MF) const;5556bool enableShrinkWrapping(const MachineFunction &MF) const override;5758private:59void determineFrameLayout(MachineFunction &MF) const;60void adjustReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI,61const DebugLoc &DL, Register DestReg, Register SrcReg,62int64_t Val, MachineInstr::MIFlag Flag) const;63};64} // end namespace llvm65#endif // LLVM_LIB_TARGET_LOONGARCH_LOONGARCHFRAMELOWERING_H666768