21#define GET_REGINFO_TARGET_DESC
22#include "CSKYGenRegisterInfo.inc"
34 return CSR_GPR_FPR64_RegMask;
36 return CSR_GPR_FPR32_RegMask;
37 return CSR_I32_RegMask;
42 return TFI->
hasFP(MF) ? CSKY::R8 : CSKY::R14;
59 for (
unsigned i = 0; i < 6; i++)
60 markSuperRegs(
Reserved, CSKY::R8 + i);
67 for (
unsigned i = 0; i < 10; i++)
68 markSuperRegs(
Reserved, CSKY::R16 + i);
83 return CSR_NoRegs_RegMask;
91 return CSR_GPR_FPR64v3_ISR_SaveList;
93 return CSR_GPR_FPR32v3_ISR_SaveList;
95 return CSR_GPR_FPR64_ISR_SaveList;
97 return CSR_GPR_FPR32_ISR_SaveList;
98 return CSR_GPR_ISR_SaveList;
102 return CSR_GPR_FPR64_SaveList;
104 return CSR_GPR_FPR32_SaveList;
105 return CSR_I32_SaveList;
113 for (; !
MI->getOperand(i).isFI(); ++i) {
114 assert(i + 1 <
MI->getNumOperands() &&
115 "Instr doesn't have FrameIndex operand!");
118 if (
MI->getOpcode() == CSKY::ADDI32) {
119 if (!isUInt<12>(std::abs(
Offset) - 1))
122 MI->setDesc(
TII->get(CSKY::SUBI32));
129 if (
MI->getOpcode() == CSKY::ADDI16XZ)
135 unsigned NumBits = 0;
171 if ((
Offset & (Scale - 1)) != 0)
174 unsigned Mask = (1 << NumBits) - 1;
175 if ((
unsigned)
Offset <= Mask * Scale)
183 int SPAdj,
unsigned FIOperandNum,
185 assert(SPAdj == 0 &&
"Unexpected non-zero SPAdj value");
195 switch (
MI->getOpcode()) {
198 case CSKY::RESTORE_CARRY: {
200 ?
MRI.createVirtualRegister(&CSKY::GPRRegClass)
201 :
MRI.createVirtualRegister(&CSKY::mGPRRegClass);
204 .
add(
MI->getOperand(1))
205 .
add(
MI->getOperand(2))
209 MI->getOperand(0).getReg())
218 case CSKY::SPILL_CARRY: {
221 NewReg =
MRI.createVirtualRegister(&CSKY::GPRRegClass);
223 .
add(
MI->getOperand(0));
225 NewReg =
MRI.createVirtualRegister(&CSKY::mGPRRegClass);
232 .
addReg(
MI->getOperand(0).getReg());
241 .
add(
MI->getOperand(1))
242 .
add(
MI->getOperand(2))
251 int FrameIndex =
MI->getOperand(FIOperandNum).getIndex();
253 int Offset = getFrameLowering(MF)
254 ->getFrameIndexReference(MF, FrameIndex, FrameReg)
256 MI->getOperand(FIOperandNum + 1).getImm();
260 "Frame offsets outside of the signed 32-bit range not supported");
262 bool FrameRegIsKill =
false;
270 TII->get(STI.
hasE2() ? CSKY::ADDU32 : CSKY::ADDU16XZ), ScratchReg)
275 FrameReg = ScratchReg;
276 FrameRegIsKill =
true;
280 (
MI->getOpcode() == CSKY::ADDI32 ||
MI->getOpcode() == CSKY::ADDI16XZ)) {
281 MI->setDesc(
TII->get(TargetOpcode::COPY));
282 MI->getOperand(FIOperandNum)
283 .ChangeToRegister(FrameReg,
false,
false, FrameRegIsKill);
284 MI->removeOperand(FIOperandNum + 1);
286 MI->getOperand(FIOperandNum)
287 .ChangeToRegister(FrameReg,
false,
false, FrameRegIsKill);
288 MI->getOperand(FIOperandNum + 1).ChangeToImmediate(
Offset);
unsigned const MachineRegisterInfo * MRI
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static bool IsLegalOffset(const CSKYInstrInfo *TII, MachineInstr *MI, int &Offset)
const HexagonInstrInfo * TII
uint64_t IntrinsicInst * II
This file declares the machine register scavenger class.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
bool hasBP(const MachineFunction &MF) const
bool hasFP(const MachineFunction &MF) const override
hasFP - Return true if the specified function should have a dedicated frame pointer register.
BitVector getReservedRegs(const MachineFunction &MF) const override
Register getFrameRegister(const MachineFunction &MF) const override
const uint32_t * getCallPreservedMask(const MachineFunction &MF, CallingConv::ID id) const override
const uint32_t * getNoPreservedMask() const override
bool eliminateFrameIndex(MachineBasicBlock::iterator MI, int SPAdj, unsigned FIOperandNum, RegScavenger *RS) const override
const MCPhysReg * getCalleeSavedRegs(const MachineFunction *MF) const override
bool hasHighRegisters() const
bool hasFPUv2SingleFloat() const
bool hasFPUv3SingleFloat() const
bool hasFPUv2DoubleFloat() const
bool hasFPUv3DoubleFloat() const
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
Describe properties that are true of each instruction in the target description file.
instr_iterator erase(instr_iterator I)
Remove an instruction from the instruction list and delete it.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
Function & getFunction()
Return the LLVM function that this machine code represents.
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
const MachineInstrBuilder & add(const MachineOperand &MO) const
const MachineInstrBuilder & addReg(Register RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
MachineInstr * getInstr() const
If conversion operators fail, use this method to get the MachineInstr explicitly.
Representation of each machine instruction.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
Wrapper class representing virtual and physical registers.
Information about stack frame layout on the target.
virtual bool hasFP(const MachineFunction &MF) const =0
hasFP - Return true if the specified function should have a dedicated frame pointer register.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ Define
Register definition.
@ Kill
The last use of a register.
This is an optimization pass for GlobalISel generic memory operations.
MachineInstrBuilder BuildMI(MachineFunction &MF, const MIMetadata &MIMD, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
unsigned getKillRegState(bool B)
Description of the encoding of one expression Op.