29#define GET_REGINFO_TARGET_DESC
30#include "AVRGenRegisterInfo.inc"
40 if (STI.hasTinyEncoding())
42 : CSR_NormalTiny_SaveList;
45 : CSR_Normal_SaveList;
52 return STI.hasTinyEncoding() ? CSR_NormalTiny_RegMask : CSR_Normal_RegMask;
73 for (
unsigned Reg = AVR::R2;
Reg <= AVR::R17;
Reg++)
76 for (
unsigned Reg = AVR::R3R2;
Reg <= AVR::R18R17;
Reg++)
100 if (
TRI->isTypeLegalForClass(*RC, MVT::i16)) {
101 return &AVR::DREGSRegClass;
104 if (
TRI->isTypeLegalForClass(*RC, MVT::i8)) {
105 return &AVR::GPR8RegClass;
115 int Opcode =
MI.getOpcode();
118 if ((Opcode != AVR::SUBIWRdK) && (Opcode != AVR::ADIWRdK)) {
124 if (DstReg !=
MI.getOperand(0).getReg()) {
131 Offset += -
MI.getOperand(2).getImm();
134 Offset +=
MI.getOperand(2).getImm();
140 MI.eraseFromParent();
144 int SPAdj,
unsigned FIOperandNum,
146 assert(SPAdj == 0 &&
"Unexpected SPAdj value");
157 int FrameIndex =
MI.getOperand(FIOperandNum).getIndex();
163 Offset +=
MI.getOperand(FIOperandNum + 1).getImm();
168 if (
MI.getOpcode() == AVR::FRMIDX) {
170 assert(DstReg != AVR::R29R28 &&
"Dest reg cannot be the frame pointer");
178 splitReg(DstReg, DstLoReg, DstHiReg);
208 if (isUInt<6>(
Offset) && STI.hasADDSUBIW()) {
209 Opcode = AVR::ADIWRdK;
216 Opcode = AVR::SUBIWRdK;
225 New->getOperand(3).setIsDead();
227 MI.eraseFromParent();
237 int MaxOffset = STI.hasTinyEncoding() ? 0 : 62;
244 unsigned AddOpc = AVR::ADIWRdK, SubOpc = AVR::SBIWRdK;
245 int AddOffset =
Offset - MaxOffset;
248 if ((
Offset - MaxOffset) > 63 || !STI.hasADDSUBIW()) {
249 AddOpc = AVR::SUBIWRdK;
250 SubOpc = AVR::SUBIWRdK;
251 AddOffset = -AddOffset;
264 New->getOperand(3).setIsDead();
280 MI.getOperand(FIOperandNum).ChangeToRegister(AVR::R29R28,
false);
282 MI.getOperand(FIOperandNum + 1).ChangeToImmediate(
Offset);
288 if (TFI->
hasFP(MF)) {
298 unsigned Kind)
const {
302 return &AVR::PTRDISPREGSRegClass;
309 LoReg = getSubReg(
Reg, AVR::sub_lo);
310 HiReg = getSubReg(
Reg, AVR::sub_hi);
317 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.
const LLVMTargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
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.
virtual bool hasFP(const MachineFunction &MF) const =0
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.