Go to the documentation of this file.
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;
53 markSuperRegs(Reserved, CSKY::R7);
56 markSuperRegs(Reserved, CSKY::R8);
59 for (
unsigned i = 0;
i < 6;
i++)
60 markSuperRegs(Reserved, CSKY::R8 +
i);
63 markSuperRegs(Reserved, CSKY::R14);
64 markSuperRegs(Reserved, CSKY::R15);
67 for (
unsigned i = 0;
i < 10;
i++)
68 markSuperRegs(Reserved, CSKY::R16 +
i);
71 markSuperRegs(Reserved, CSKY::R26);
72 markSuperRegs(Reserved, CSKY::R27);
73 markSuperRegs(Reserved, CSKY::R28);
74 markSuperRegs(Reserved, CSKY::R29);
75 markSuperRegs(Reserved, CSKY::R30);
76 markSuperRegs(Reserved, CSKY::R31);
78 assert(checkAllSuperRegsMarked(Reserved));
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) {
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: {
204 .
add(
MI->getOperand(1))
205 .
add(
MI->getOperand(2))
209 MI->getOperand(0).getReg())
218 case CSKY::SPILL_CARRY: {
223 .
add(
MI->getOperand(0));
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;
271 TII->get(STI.
hasE2() ? CSKY::ADDU32 : CSKY::ADDU16XZ), ScratchReg)
276 FrameReg = ScratchReg;
277 FrameRegIsKill =
true;
281 (
MI->getOpcode() == CSKY::ADDI32 ||
MI->getOpcode() == CSKY::ADDI16XZ)) {
282 MI->setDesc(
TII->get(TargetOpcode::COPY));
283 MI->getOperand(FIOperandNum)
284 .ChangeToRegister(FrameReg,
false,
false, FrameRegIsKill);
285 MI->removeOperand(FIOperandNum + 1);
287 MI->getOperand(FIOperandNum)
288 .ChangeToRegister(FrameReg,
false,
false, FrameRegIsKill);
289 MI->getOperand(FIOperandNum + 1).ChangeToImmediate(Offset);
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
This is an optimization pass for GlobalISel generic memory operations.
Information about stack frame layout on the target.
@ Define
Register definition.
Register createVirtualRegister(const TargetRegisterClass *RegClass, StringRef Name="")
createVirtualRegister - Create and return a new virtual register in the function with the specified r...
void eliminateFrameIndex(MachineBasicBlock::iterator MI, int SPAdj, unsigned FIOperandNum, RegScavenger *RS) const override
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
const MachineInstrBuilder & add(const MachineOperand &MO) const
instr_iterator erase(instr_iterator I)
Remove an instruction from the instruction list and delete it.
constexpr std::underlying_type_t< E > Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
BitVector getReservedRegs(const MachineFunction &MF) const override
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
bool hasFPUv2SingleFloat() const
const uint32_t * getNoPreservedMask() const override
const HexagonInstrInfo * TII
Describe properties that are true of each instruction in the target description file.
virtual bool hasFP(const MachineFunction &MF) const =0
hasFP - Return true if the specified function should have a dedicated frame pointer register.
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
bool hasBP(const MachineFunction &MF) const
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
bool hasFP(const MachineFunction &MF) const override
hasFP - Return true if the specified function should have a dedicated frame pointer register.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
constexpr bool isInt< 32 >(int64_t x)
Representation of each machine instruction.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
const MachineInstrBuilder & addReg(Register RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
Register getFrameRegister(const MachineFunction &MF) const override
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
MachineInstr * getInstr() const
If conversion operators fail, use this method to get the MachineInstr explicitly.
const MCPhysReg * getCalleeSavedRegs(const MachineFunction *MF) const override
unsigned const MachineRegisterInfo * MRI
Wrapper class representing virtual and physical registers.
Function & getFunction()
Return the LLVM function that this machine code represents.
bool hasFPUv3SingleFloat() const
bool hasFPUv2DoubleFloat() const
static bool IsLegalOffset(const CSKYInstrInfo *TII, MachineInstr *MI, int &Offset)
bool hasFPUv3DoubleFloat() const
unsigned getKillRegState(bool B)
const uint32_t * getCallPreservedMask(const MachineFunction &MF, CallingConv::ID id) const override
MachineInstrBuilder BuildMI(MachineFunction &MF, const DebugLoc &DL, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
@ Kill
The last use of a register.
APFloat abs(APFloat X)
Returns the absolute value of the argument.
bool hasHighRegisters() const