xref: /freebsd-src/contrib/llvm-project/llvm/lib/Target/LoongArch/LoongArchRegisterInfo.h (revision 1db9f3b21e39176dd5b67cf8ac378633b172463e)
181ad6265SDimitry Andric //= LoongArchRegisterInfo.h - LoongArch Register Information Impl -*- C++ -*-=//
281ad6265SDimitry Andric //
381ad6265SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
481ad6265SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
581ad6265SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
681ad6265SDimitry Andric //
781ad6265SDimitry Andric //===----------------------------------------------------------------------===//
881ad6265SDimitry Andric //
981ad6265SDimitry Andric // This file contains the LoongArch implementation of the TargetRegisterInfo
1081ad6265SDimitry Andric // class.
1181ad6265SDimitry Andric //
1281ad6265SDimitry Andric //===----------------------------------------------------------------------===//
1381ad6265SDimitry Andric 
1481ad6265SDimitry Andric #ifndef LLVM_LIB_TARGET_LOONGARCH_LOONGARCHREGISTERINFO_H
1581ad6265SDimitry Andric #define LLVM_LIB_TARGET_LOONGARCH_LOONGARCHREGISTERINFO_H
1681ad6265SDimitry Andric 
1781ad6265SDimitry Andric #include "llvm/CodeGen/TargetRegisterInfo.h"
1881ad6265SDimitry Andric 
1981ad6265SDimitry Andric #define GET_REGINFO_HEADER
2081ad6265SDimitry Andric #include "LoongArchGenRegisterInfo.inc"
2181ad6265SDimitry Andric 
2281ad6265SDimitry Andric namespace llvm {
2381ad6265SDimitry Andric 
2481ad6265SDimitry Andric struct LoongArchRegisterInfo : public LoongArchGenRegisterInfo {
2581ad6265SDimitry Andric 
2681ad6265SDimitry Andric   LoongArchRegisterInfo(unsigned HwMode);
2781ad6265SDimitry Andric 
2881ad6265SDimitry Andric   const MCPhysReg *getCalleeSavedRegs(const MachineFunction *MF) const override;
2981ad6265SDimitry Andric   const uint32_t *getCallPreservedMask(const MachineFunction &MF,
3081ad6265SDimitry Andric                                        CallingConv::ID) const override;
3181ad6265SDimitry Andric   const uint32_t *getNoPreservedMask() const override;
3281ad6265SDimitry Andric 
3381ad6265SDimitry Andric   BitVector getReservedRegs(const MachineFunction &MF) const override;
3481ad6265SDimitry Andric 
3581ad6265SDimitry Andric   const TargetRegisterClass *
3681ad6265SDimitry Andric   getPointerRegClass(const MachineFunction &MF,
3781ad6265SDimitry Andric                      unsigned Kind = 0) const override {
3881ad6265SDimitry Andric     return &LoongArch::GPRRegClass;
3981ad6265SDimitry Andric   }
4081ad6265SDimitry Andric 
41bdd1243dSDimitry Andric   bool eliminateFrameIndex(MachineBasicBlock::iterator MI, int SPAdj,
4281ad6265SDimitry Andric                            unsigned FIOperandNum,
4381ad6265SDimitry Andric                            RegScavenger *RS = nullptr) const override;
4481ad6265SDimitry Andric 
4581ad6265SDimitry Andric   Register getFrameRegister(const MachineFunction &MF) const override;
46bdd1243dSDimitry Andric 
requiresRegisterScavengingLoongArchRegisterInfo47bdd1243dSDimitry Andric   bool requiresRegisterScavenging(const MachineFunction &MF) const override {
48bdd1243dSDimitry Andric     return true;
49bdd1243dSDimitry Andric   }
50bdd1243dSDimitry Andric 
requiresFrameIndexScavengingLoongArchRegisterInfo51bdd1243dSDimitry Andric   bool requiresFrameIndexScavenging(const MachineFunction &MF) const override {
52bdd1243dSDimitry Andric     return true;
53bdd1243dSDimitry Andric   }
54*1db9f3b2SDimitry Andric   bool canRealignStack(const MachineFunction &MF) const override;
5581ad6265SDimitry Andric };
56972a253aSDimitry Andric } // end namespace llvm
5781ad6265SDimitry Andric 
5881ad6265SDimitry Andric #endif // LLVM_LIB_TARGET_LOONGARCH_LOONGARCHREGISTERINFO_H
59