24 #define GET_REGINFO_TARGET_DESC 25 #include "RISCVGenRegisterInfo.inc" 29 static_assert(RISCV::X1 == RISCV::X0 + 1,
"Register list not consecutive");
30 static_assert(RISCV::X31 == RISCV::X0 + 31,
"Register list not consecutive");
31 static_assert(RISCV::F1_F == RISCV::F0_F + 1,
"Register list not consecutive");
32 static_assert(RISCV::F31_F == RISCV::F0_F + 31,
33 "Register list not consecutive");
34 static_assert(RISCV::F1_D == RISCV::F0_D + 1,
"Register list not consecutive");
35 static_assert(RISCV::F31_D == RISCV::F0_D + 31,
36 "Register list not consecutive");
46 if (Subtarget.hasStdExtD())
47 return CSR_XLEN_F64_Interrupt_SaveList;
48 if (Subtarget.hasStdExtF())
49 return CSR_XLEN_F32_Interrupt_SaveList;
50 return CSR_Interrupt_SaveList;
53 switch (Subtarget.getTargetABI()) {
58 return CSR_ILP32_LP64_SaveList;
61 return CSR_ILP32F_LP64F_SaveList;
64 return CSR_ILP32D_LP64D_SaveList;
73 for (
size_t Reg = 0;
Reg < getNumRegs();
Reg++) {
75 markSuperRegs(Reserved,
Reg);
79 markSuperRegs(Reserved, RISCV::X0);
80 markSuperRegs(Reserved, RISCV::X2);
81 markSuperRegs(Reserved, RISCV::X3);
82 markSuperRegs(Reserved, RISCV::X4);
84 markSuperRegs(Reserved, RISCV::X8);
89 assert(checkAllSuperRegsMarked(Reserved));
94 unsigned PhysReg)
const {
99 return PhysReg == RISCV::X0;
103 return CSR_NoRegs_RegMask;
107 int SPAdj,
unsigned FIOperandNum,
109 assert(SPAdj == 0 &&
"Unexpected non-zero SPAdj value");
120 getFrameLowering(MF)->getFrameIndexReference(MF, FrameIndex, FrameReg) +
125 "Frame offsets outside of the signed 32-bit range not supported");
129 bool FrameRegIsKill =
false;
131 if (!isInt<12>(Offset)) {
136 TII->
movImm(MBB, II, DL, ScratchReg, Offset);
141 FrameReg = ScratchReg;
142 FrameRegIsKill =
true;
152 return TFI->
hasFP(MF) ? RISCV::X8 : RISCV::X2;
160 switch (Subtarget.getTargetABI()) {
165 return CSR_ILP32_LP64_RegMask;
168 return CSR_ILP32F_LP64F_RegMask;
171 return CSR_ILP32D_LP64D_RegMask;
void movImm(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, const DebugLoc &DL, Register DstReg, uint64_t Val, MachineInstr::MIFlag Flag=MachineInstr::NoFlags) const
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
This class represents lattice values for constants.
bool hasFP(const MachineFunction &MF) const override
hasFP - Return true if the specified function should have a dedicated frame pointer register...
Register getFrameRegister(const MachineFunction &MF) const override
const uint32_t * getNoPreservedMask() const override
Register createVirtualRegister(const TargetRegisterClass *RegClass, StringRef Name="")
createVirtualRegister - Create and return a new virtual register in the function with the specified r...
const DebugLoc & getDebugLoc() const
Returns the debug location id of this MachineInstr.
BitVector getReservedRegs(const MachineFunction &MF) const override
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
bool isConstantPhysReg(unsigned PhysReg) const override
RISCVRegisterInfo(unsigned HwMode)
const HexagonInstrInfo * TII
virtual bool hasFP(const MachineFunction &MF) const =0
hasFP - Return true if the specified function should have a dedicated frame pointer register...
Simple integer binary arithmetic operators.
const MCPhysReg * getCalleeSavedRegs(const MachineFunction *MF) const override
const uint32_t * getCallPreservedMask(const MachineFunction &MF, CallingConv::ID) const override
void ChangeToImmediate(int64_t ImmVal)
ChangeToImmediate - Replace this operand with a new immediate operand of the specified value...
MachineInstrBuilder BuildMI(MachineFunction &MF, const DebugLoc &DL, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
This file declares the machine register scavenger class.
bool hasBP(const MachineFunction &MF) const
unsigned const MachineRegisterInfo * MRI
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
void eliminateFrameIndex(MachineBasicBlock::iterator MI, int SPAdj, unsigned FIOperandNum, RegScavenger *RS=nullptr) const override
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
bool isRegisterReservedByUser(Register i) const
constexpr bool isInt< 32 >(int64_t x)
Information about stack frame layout on the target.
const Function & getFunction() const
Return the LLVM function that this machine code represents.
const MachineBasicBlock * getParent() const
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
Representation of each machine instruction.
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
void ChangeToRegister(Register Reg, bool isDef, bool isImp=false, bool isKill=false, bool isDead=false, bool isUndef=false, bool isDebug=false)
ChangeToRegister - Replace this operand with a new register operand of the specified value...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
bool isAsmClobberable(const MachineFunction &MF, unsigned PhysReg) const override
const MachineOperand & getOperand(unsigned i) const
const MachineInstrBuilder & addReg(Register RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
Wrapper class representing virtual and physical registers.