1 //= LoongArchRegisterInfo.h - LoongArch Register Information Impl -*- C++ -*-=//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // This file contains the LoongArch implementation of the TargetRegisterInfo
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_LIB_TARGET_LOONGARCH_LOONGARCHREGISTERINFO_H
15 #define LLVM_LIB_TARGET_LOONGARCH_LOONGARCHREGISTERINFO_H
17 #include "llvm/CodeGen/TargetRegisterInfo.h"
19 #define GET_REGINFO_HEADER
20 #include "LoongArchGenRegisterInfo.inc"
24 struct LoongArchRegisterInfo
: public LoongArchGenRegisterInfo
{
26 LoongArchRegisterInfo(unsigned HwMode
);
28 const MCPhysReg
*getCalleeSavedRegs(const MachineFunction
*MF
) const override
;
29 const uint32_t *getCallPreservedMask(const MachineFunction
&MF
,
30 CallingConv::ID
) const override
;
31 const uint32_t *getNoPreservedMask() const override
;
33 BitVector
getReservedRegs(const MachineFunction
&MF
) const override
;
35 const TargetRegisterClass
*
36 getPointerRegClass(const MachineFunction
&MF
,
37 unsigned Kind
= 0) const override
{
38 return &LoongArch::GPRRegClass
;
41 bool eliminateFrameIndex(MachineBasicBlock::iterator MI
, int SPAdj
,
42 unsigned FIOperandNum
,
43 RegScavenger
*RS
= nullptr) const override
;
45 Register
getFrameRegister(const MachineFunction
&MF
) const override
;
47 bool requiresRegisterScavenging(const MachineFunction
&MF
) const override
{
51 bool requiresFrameIndexScavenging(const MachineFunction
&MF
) const override
{
54 bool canRealignStack(const MachineFunction
&MF
) const override
;
56 } // end namespace llvm
58 #endif // LLVM_LIB_TARGET_LOONGARCH_LOONGARCHREGISTERINFO_H