27#define GET_REGINFO_TARGET_DESC
28#include "AVRGenRegisterInfo.inc"
38 if (STI.hasTinyEncoding())
40 : CSR_NormalTiny_SaveList;
43 : CSR_Normal_SaveList;
50 return STI.hasTinyEncoding() ? CSR_NormalTiny_RegMask : CSR_Normal_RegMask;
71 for (
unsigned Reg = AVR::R2;
Reg <= AVR::R17;
Reg++)
74 for (
unsigned Reg = AVR::R3R2;
Reg <= AVR::R18R17;
Reg++)
98 if (
TRI->isTypeLegalForClass(*RC, MVT::i16)) {
99 return &AVR::DREGSRegClass;
102 if (
TRI->isTypeLegalForClass(*RC, MVT::i8)) {
103 return &AVR::GPR8RegClass;
113 int Opcode =
MI.getOpcode();
116 if ((Opcode != AVR::SUBIWRdK) && (Opcode != AVR::ADIWRdK)) {
122 if (DstReg !=
MI.getOperand(0).getReg()) {
129 Offset += -
MI.getOperand(2).getImm();
132 Offset +=
MI.getOperand(2).getImm();
138 MI.eraseFromParent();
142 int SPAdj,
unsigned FIOperandNum,
144 assert(SPAdj == 0 &&
"Unexpected SPAdj value");
155 int FrameIndex =
MI.getOperand(FIOperandNum).getIndex();
161 Offset +=
MI.getOperand(FIOperandNum + 1).getImm();
166 if (
MI.getOpcode() == AVR::FRMIDX) {
168 assert(DstReg != AVR::R29R28 &&
"Dest reg cannot be the frame pointer");
176 splitReg(DstReg, DstLoReg, DstHiReg);
206 if (isUInt<6>(
Offset) && STI.hasADDSUBIW()) {
207 Opcode = AVR::ADIWRdK;
214 Opcode = AVR::SUBIWRdK;
223 New->getOperand(3).setIsDead();
225 MI.eraseFromParent();
235 int MaxOffset = STI.hasTinyEncoding() ? 0 : 62;
242 unsigned AddOpc = AVR::ADIWRdK, SubOpc = AVR::SBIWRdK;
243 int AddOffset =
Offset - MaxOffset;
246 if ((
Offset - MaxOffset) > 63 || !STI.hasADDSUBIW()) {
247 AddOpc = AVR::SUBIWRdK;
248 SubOpc = AVR::SUBIWRdK;
249 AddOffset = -AddOffset;
262 New->getOperand(3).setIsDead();
278 MI.getOperand(FIOperandNum).ChangeToRegister(AVR::R29R28,
false);
280 MI.getOperand(FIOperandNum + 1).ChangeToImmediate(
Offset);
286 if (TFI->
hasFP(MF)) {
296 unsigned Kind)
const {
300 return &AVR::PTRDISPREGSRegClass;
307 LoReg = getSubReg(
Reg, AVR::sub_lo);
308 HiReg = getSubReg(
Reg, AVR::sub_hi);
315 if (this->
getRegClass(AVR::PTRDISPREGSRegClassID)->hasSubClassEq(NewRC)) {
static const TargetRegisterClass * getRegClass(const MachineInstr &MI, Register Reg)
This file implements the BitVector class.
const HexagonInstrInfo * TII
unsigned const TargetRegisterInfo * TRI
uint64_t IntrinsicInst * II
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static bool contains(SmallPtrSetImpl< ConstantExpr * > &Cache, ConstantExpr *Expr, Constant *C)
Contains AVR-specific information for each MachineFunction.
bool isInterruptOrSignalHandler() const
Checks if the function is some form of interrupt service routine.
const TargetRegisterClass * getLargestLegalSuperClass(const TargetRegisterClass *RC, const MachineFunction &MF) const override
bool eliminateFrameIndex(MachineBasicBlock::iterator MI, int SPAdj, unsigned FIOperandNum, RegScavenger *RS=nullptr) const override
Stack Frame Processing Methods.
const uint16_t * getCalleeSavedRegs(const MachineFunction *MF=nullptr) const override
BitVector getReservedRegs(const MachineFunction &MF) const override
bool shouldCoalesce(MachineInstr *MI, const TargetRegisterClass *SrcRC, unsigned SubReg, const TargetRegisterClass *DstRC, unsigned DstSubReg, const TargetRegisterClass *NewRC, LiveIntervals &LIS) const override
const uint32_t * getCallPreservedMask(const MachineFunction &MF, CallingConv::ID CC) const override
const TargetRegisterClass * getPointerRegClass(const MachineFunction &MF, unsigned Kind=0) const override
Register getFrameRegister(const MachineFunction &MF) const override
void splitReg(Register Reg, Register &LoReg, Register &HiReg) const
Splits a 16-bit DREGS register into the lo/hi register pair.
A specific AVR target MCU.
Register getTmpRegister() const
A generic AVR implementation.
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted.
uint64_t getStackSize() const
Return the number of bytes that must be allocated to hold all of the fixed size frame objects.
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.
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
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
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
const MachineInstrBuilder & addReg(Register RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
Representation of each machine instruction.
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.
int getOffsetOfLocalArea() const
getOffsetOfLocalArea - This method returns the offset of the local area from the stack pointer on ent...
TargetInstrInfo - Interface to description of machine instruction set.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
virtual bool shouldCoalesce(MachineInstr *MI, const TargetRegisterClass *SrcRC, unsigned SubReg, const TargetRegisterClass *DstRC, unsigned DstSubReg, const TargetRegisterClass *NewRC, LiveIntervals &LIS) const
Subtarget Hooks.
virtual const TargetRegisterInfo * getRegisterInfo() const
getRegisterInfo - If register information is available, return it.
virtual const TargetFrameLowering * getFrameLowering() const
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ 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.
static void foldFrameOffset(MachineBasicBlock::iterator &II, int &Offset, Register DstReg)
Fold a frame offset shared between two add instructions into a single one.