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");
175 splitReg(DstReg, DstLoReg, DstHiReg);
204 Opcode = AVR::ADIWRdK;
211 Opcode = AVR::SUBIWRdK;
220 New->getOperand(3).setIsDead();
222 MI.eraseFromParent();
232 int MaxOffset = STI.hasTinyEncoding() ? 0 : 62;
239 unsigned AddOpc = AVR::ADIWRdK, SubOpc = AVR::SBIWRdK;
240 int AddOffset =
Offset - MaxOffset;
243 if ((
Offset - MaxOffset) > 63 || !STI.hasADDSUBIW()) {
244 AddOpc = AVR::SUBIWRdK;
245 SubOpc = AVR::SUBIWRdK;
246 AddOffset = -AddOffset;
259 New->getOperand(3).setIsDead();
275 MI.getOperand(FIOperandNum).ChangeToRegister(AVR::R29R28,
false);
277 MI.getOperand(FIOperandNum + 1).ChangeToImmediate(
Offset);
283 if (TFI->
hasFP(MF)) {
293 unsigned Kind)
const {
297 return &AVR::PTRDISPREGSRegClass;
304 LoReg = getSubReg(
Reg, AVR::sub_lo);
305 HiReg = getSubReg(
Reg, AVR::sub_hi);
312 if (this->
getRegClass(AVR::PTRDISPREGSRegClassID)->hasSubClassEq(NewRC)) {
static const TargetRegisterClass * getRegClass(const MachineInstr &MI, Register Reg)
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file implements the BitVector class.
const HexagonInstrInfo * TII
Register const TargetRegisterInfo * TRI
uint64_t IntrinsicInst * II
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.
MachineInstrBundleIterator< MachineInstr > iterator
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 TargetFrameLowering * getFrameLowering() const
virtual const TargetRegisterInfo * getRegisterInfo() const =0
Return the target's register information.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
@ 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.
constexpr bool isUInt(uint64_t x)
Checks if an unsigned integer fits into the given bit width.
static void foldFrameOffset(MachineBasicBlock::iterator &II, int &Offset, Register DstReg)
Fold a frame offset shared between two add instructions into a single one.