36#define DEBUG_TYPE "mips-reg-info"
38#define GET_REGINFO_TARGET_DESC
39#include "MipsGenRegisterInfo.inc"
51 switch (RC->
getID()) {
54 case Mips::GPR32RegClassID:
55 case Mips::GPR64RegClassID:
56 case Mips::DSPRRegClassID: {
58 return 28 - TFI->
hasFP(MF);
60 case Mips::FGR32RegClassID:
62 case Mips::AFGR64RegClassID:
64 case Mips::FGR64RegClassID:
85 if (
F.hasFnAttribute(
"interrupt")) {
87 return Subtarget.
hasMips64r6() ? CSR_Interrupt_64R6_SaveList
88 : CSR_Interrupt_64_SaveList;
90 return Subtarget.
hasMips32r6() ? CSR_Interrupt_32R6_SaveList
91 : CSR_Interrupt_32_SaveList;
98 return GPIsGlobal ? CSR_N64_SingleFloat_NoGP_SaveList
99 : CSR_N64_SingleFloat_SaveList;
101 return GPIsGlobal ? CSR_N64_NoGP_SaveList : CSR_N64_SaveList;
107 return GPIsGlobal ? CSR_N32_SingleFloat_NoGP_SaveList
108 : CSR_N32_SingleFloat_SaveList;
110 return GPIsGlobal ? CSR_N32_NoGP_SaveList : CSR_N32_SaveList;
115 return CSR_O32_SingleFloat_SaveList;
118 return CSR_O32_FP64_SaveList;
121 return CSR_O32_FPXX_SaveList;
123 return CSR_O32_SaveList;
133 return CSR_N64_SingleFloat_RegMask;
135 return CSR_N64_RegMask;
141 return CSR_N32_SingleFloat_RegMask;
143 return CSR_N32_RegMask;
148 return CSR_O32_SingleFloat_RegMask;
151 return CSR_O32_FP64_RegMask;
154 return CSR_O32_FPXX_RegMask;
156 return CSR_O32_RegMask;
160 return CSR_Mips16RetHelper_RegMask;
165 static const MCPhysReg ReservedGPR32[] = {
166 Mips::ZERO, Mips::K0, Mips::K1, Mips::SP
169 static const MCPhysReg ReservedGPR64[] = {
170 Mips::ZERO_64, Mips::K0_64, Mips::K1_64, Mips::SP_64
183 for (
unsigned I = 1;
I < 32; ++
I)
185 markSuperRegs(
Reserved, Mips::GPR32RegClass.getRegister(
I));
196 for (
MCPhysReg Reg : Mips::AFGR64RegClass)
200 for (
MCPhysReg Reg : Mips::FGR64RegClass)
235 for (
MCPhysReg Reg : Mips::MSACtrlRegClass)
268 errs() <<
"<--------->\n"
271 int FrameIndex =
MI.getOperand(FIOperandNum).getIndex();
276 <<
"spOffset : " << spOffset <<
"\n"
277 <<
"stackSize : " << stackSize <<
"\n"
282 eliminateFI(
MI, FIOperandNum, FrameIndex, stackSize, spOffset);
294 return TFI->hasFP(MF) ? Mips::S0 : Mips::SP;
296 return TFI->hasFP(MF) ? (IsN64 ? Mips::FP_64 : Mips::FP) :
297 (IsN64 ? Mips::SP_64 : Mips::SP);
312 unsigned FP = Subtarget.
isGP32bit() ? Mips::FP : Mips::FP_64;
313 unsigned BP = Subtarget.
isGP32bit() ? Mips::S7 : Mips::S7_64;
This file implements the BitVector class.
Module.h This file contains the declarations for the Module class.
bool isGPUsedAsGlobalRegister(const MachineFunction &MF)
Check if the user has declared $gp/$28 as a global regiater.
uint64_t IntrinsicInst * II
SI optimize exec mask operations pre RA
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
Module * getParent()
Get the module that this global value is contained inside of...
unsigned getID() const
getID() - Return the register class ID number.
MachineInstrBundleIterator< MachineInstr > iterator
bool hasVarSizedObjects() const
This method may be called any time after instruction selection is complete to determine if the stack ...
uint64_t getStackSize() const
Return the number of bytes that must be allocated to hold all of the fixed size frame objects.
Align getObjectAlign(int ObjectIdx) const
Return the alignment of the specified stack object.
int64_t getObjectOffset(int ObjectIdx) const
Return the assigned stack offset of the specified object from the incoming stack pointer.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
Function & getFunction()
Return the LLVM function that this machine code represents.
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
const TargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
Representation of each machine instruction.
bool canReserveReg(MCRegister PhysReg) const
canReserveReg - Returns true if PhysReg can be used as a reserved register.
MipsFunctionInfo - This class is derived from MachineFunction private Mips target-specific informatio...
static unsigned getPICCallReg()
Get PIC indirect call register.
const uint32_t * getCallPreservedMask(const MachineFunction &MF, CallingConv::ID) const override
Register getFrameRegister(const MachineFunction &MF) const override
Debug information queries.
bool eliminateFrameIndex(MachineBasicBlock::iterator II, int SPAdj, unsigned FIOperandNum, RegScavenger *RS=nullptr) const override
Stack Frame Processing Methods.
unsigned getRegPressureLimit(const TargetRegisterClass *RC, MachineFunction &MF) const override
Code Generation virtual methods...
static const uint32_t * getMips16RetHelperMask()
bool canRealignStack(const MachineFunction &MF) const override
BitVector getReservedRegs(const MachineFunction &MF) const override
MipsRegisterInfo(const MipsSubtarget &STI)
const MCPhysReg * getCalleeSavedRegs(const MachineFunction *MF) const override
Mips Callee Saved Registers.
bool inMips16Mode() const
bool isSingleFloat() const
bool useSmallSection() const
bool isGPRReservedByUser(unsigned GPR) const
const TargetFrameLowering * getFrameLowering() const override
const MipsABIInfo & getABI() const
A Module instance is used to store all the information related to an LLVM module.
NamedMDNode * getNamedMetadata(StringRef Name) const
Return the first NamedMDNode in the module with the specified name.
Wrapper class representing virtual and physical registers.
Information about stack frame layout on the target.
bool hasFP(const MachineFunction &MF) const
hasFP - Return true if the specified function should have a dedicated frame pointer register.
virtual bool hasReservedCallFrame(const MachineFunction &MF) const
hasReservedCallFrame - Under normal circumstances, when a frame pointer is not required,...
virtual bool canRealignStack(const MachineFunction &MF) const
True if the stack can be realigned for the target.
virtual const TargetFrameLowering * getFrameLowering() const
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
void initLLVMToCVRegMapping(MCRegisterInfo *MRI)
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
MCRegisterClass TargetRegisterClass