33 #define GET_INSTRINFO_CTOR_DTOR 34 #include "AVRGenInstrInfo.inc" 50 if (AVR::DREGSRegClass.
contains(DestReg, SrcReg)) {
52 BuildMI(MBB, MI, DL,
get(AVR::MOVWRdRr), DestReg)
55 unsigned DestLo, DestHi, SrcLo, SrcHi;
57 TRI.splitReg(DestReg, DestLo, DestHi);
58 TRI.splitReg(SrcReg, SrcLo, SrcHi);
61 BuildMI(MBB, MI, DL,
get(AVR::MOVRdRr), DestLo)
63 BuildMI(MBB, MI, DL,
get(AVR::MOVRdRr), DestHi)
67 if (AVR::GPR8RegClass.
contains(DestReg, SrcReg)) {
69 }
else if (SrcReg == AVR::SP && AVR::DREGSRegClass.
contains(DestReg)) {
71 }
else if (DestReg == AVR::SP && AVR::DREGSRegClass.
contains(SrcReg)) {
77 BuildMI(MBB, MI, DL,
get(Opc), DestReg)
105 case AVR::STDWPtrQRr: {
122 unsigned SrcReg,
bool isKill,
132 if (MI != MBB.
end()) {
133 DL = MI->getDebugLoc();
145 Opcode = AVR::STDPtrQRr;
147 Opcode = AVR::STDWPtrQRr;
152 BuildMI(MBB, MI, DL,
get(Opcode))
165 if (MI != MBB.
end()) {
166 DL = MI->getDebugLoc();
179 Opcode = AVR::LDDRdPtrQ;
183 Opcode = AVR::LDDWRdYQ;
188 BuildMI(MBB, MI, DL,
get(Opcode), DestReg)
199 return get(AVR::BREQk);
201 return get(AVR::BRNEk);
203 return get(AVR::BRGEk);
205 return get(AVR::BRLTk);
207 return get(AVR::BRSHk);
209 return get(AVR::BRLOk);
211 return get(AVR::BRMIk);
213 return get(AVR::BRPLk);
267 bool AllowModify)
const {
273 while (I != MBB.
begin()) {
275 if (I->isDebugInstr()) {
281 if (!isUnpredicatedTerminator(*I)) {
287 if (!I->getDesc().isBranch()) {
293 if (I->getOpcode() == AVR::RJMPk) {
297 TBB = I->getOperand(0).getMBB();
302 while (std::next(I) != MBB.
end()) {
303 std::next(I)->eraseFromParent();
312 I->eraseFromParent();
314 UnCondBrIter = MBB.
end();
319 TBB = I->getOperand(0).getMBB();
332 if (AllowModify && UnCondBrIter != MBB.
end() &&
356 .
addMBB(UnCondBrIter->getOperand(0).getMBB());
360 OldInst->eraseFromParent();
361 UnCondBrIter->eraseFromParent();
364 UnCondBrIter = MBB.
end();
370 TBB = I->getOperand(0).getMBB();
382 if (TBB != I->getOperand(0).getMBB()) {
388 if (OldBranchCode == BranchCode) {
403 int *BytesAdded)
const {
404 if (BytesAdded) *BytesAdded = 0;
407 assert(TBB &&
"insertBranch must not be told to insert a fallthrough");
409 "AVR branch conditions have one component!");
412 assert(!FBB &&
"Unconditional branch with multiple successors!");
438 int *BytesRemoved)
const {
439 if (BytesRemoved) *BytesRemoved = 0;
444 while (I != MBB.
begin()) {
446 if (I->isDebugInstr()) {
451 if (I->getOpcode() != AVR::RJMPk &&
458 I->eraseFromParent();
468 assert(Cond.
size() == 1 &&
"Invalid AVR branch condition!");
486 case TargetOpcode::IMPLICIT_DEF:
488 case TargetOpcode::DBG_VALUE:
533 int64_t BrOffset)
const {
543 return isIntN(13, BrOffset);
554 return isIntN(7, BrOffset);
const AVRInstrInfo * getInstrInfo() const override
Wrapper class representing physical registers. Should be passed by value.
MachineBasicBlock * getMBB() const
This class represents lattice values for constants.
unsigned isLoadFromStackSlot(const MachineInstr &MI, int &FrameIndex) const override
void push_back(const T &Elt)
Describe properties that are true of each instruction in the target description file.
unsigned insertIndirectBranch(MachineBasicBlock &MBB, MachineBasicBlock &NewDestBB, const DebugLoc &DL, int64_t BrOffset, RegScavenger *RS) const override
unsigned const TargetRegisterInfo * TRI
bool reverseBranchCondition(SmallVectorImpl< MachineOperand > &Cond) const override
bool isImm() const
isImm - Tests if this is a MO_Immediate operand.
Utilities relating to AVR registers.
const MachineInstrBuilder & addMBB(MachineBasicBlock *MBB, unsigned TargetFlags=0) const
void storeRegToStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, unsigned SrcReg, bool isKill, int FrameIndex, const TargetRegisterClass *RC, const TargetRegisterInfo *TRI) const override
return AArch64::GPR64RegClass contains(Reg)
A description of a memory reference used in the backend.
This file declares the MachineConstantPool class which is an abstract constant pool to keep track of ...
const HexagonInstrInfo * TII
void loadRegFromStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, unsigned DestReg, int FrameIndex, const TargetRegisterClass *RC, const TargetRegisterInfo *TRI) const override
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
unsigned removeBranch(MachineBasicBlock &MBB, int *BytesRemoved=nullptr) const override
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted...
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
const char * getSymbolName() const
MachineMemOperand * getMachineMemOperand(MachinePointerInfo PtrInfo, MachineMemOperand::Flags f, uint64_t s, unsigned base_alignment, const AAMDNodes &AAInfo=AAMDNodes(), const MDNode *Ranges=nullptr, SyncScope::ID SSID=SyncScope::System, AtomicOrdering Ordering=AtomicOrdering::NotAtomic, AtomicOrdering FailureOrdering=AtomicOrdering::NotAtomic)
getMachineMemOperand - Allocate a new MachineMemOperand.
INLINEASM - Represents an inline asm block.
A generic AVR implementation.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
bool isTypeLegalForClass(const TargetRegisterClass &RC, MVT T) const
Return true if the given TargetRegisterClass has the ValueType T.
int64_t getObjectSize(int ObjectIdx) const
Return the size of the specified object.
unsigned getKillRegState(bool B)
TargetInstrInfo - Interface to description of machine instruction set.
MachineInstrBuilder BuildMI(MachineFunction &MF, const DebugLoc &DL, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
unsigned getObjectAlignment(int ObjectIdx) const
Return the alignment of the specified stack object.
unsigned insertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, MachineBasicBlock *FBB, ArrayRef< MachineOperand > Cond, const DebugLoc &DL, int *BytesAdded=nullptr) const override
Contains AVR-specific information for each MachineFunction.
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.
size_t size() const
size - Get the array size.
DebugLoc findDebugLoc(instr_iterator MBBI)
Find the next valid DebugLoc starting at MBBI, skipping any DBG_VALUE and DBG_LABEL instructions...
This file contains the declarations for the subclasses of Constant, which represent the different fla...
const MCAsmInfo * getMCAsmInfo() const
Return target specific asm information.
bool analyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB, MachineBasicBlock *&FBB, SmallVectorImpl< MachineOperand > &Cond, bool AllowModify=false) const override
void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, const DebugLoc &DL, MCRegister DestReg, MCRegister SrcReg, bool KillSrc) const override
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
CondCodes
AVR specific condition codes.
const MachineInstrBuilder & addFrameIndex(int Idx) const
bool isIntN(unsigned N, int64_t x)
Checks if an signed integer fits into the given (dynamic) bit width.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
unsigned getInstSizeInBytes(const MachineInstr &MI) const override
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
EH_LABEL - Represents a label in mid basic block used to track locations needed for debug and excepti...
The memory access writes data.
const MachineInstrBuilder & addMemOperand(MachineMemOperand *MMO) const
bool isLayoutSuccessor(const MachineBasicBlock *MBB) const
Return true if the specified MBB will be emitted immediately after this block, such that if this bloc...
unsigned isStoreToStackSlot(const MachineInstr &MI, int &FrameIndex) const override
A specific AVR target MCU.
const MachineBasicBlock * getParent() const
AVRCC::CondCodes getCondFromBranchOpc(unsigned Opc) const
The memory access reads data.
static MachinePointerInfo getFixedStack(MachineFunction &MF, int FI, int64_t Offset=0)
Return a MachinePointerInfo record that refers to the specified FrameIndex.
Representation of each machine instruction.
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
LLVM_NODISCARD bool empty() const
static MachineOperand CreateImm(int64_t Val)
bool isFI() const
isFI - Tests if this is a MO_FrameIndex operand.
const LLVMTargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
MachineBasicBlock * getBranchDestBlock(const MachineInstr &MI) const override
bool isBranchOffsetInRange(unsigned BranchOpc, int64_t BrOffset) const override
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
AVRCC::CondCodes getOppositeCondition(AVRCC::CondCodes CC) const
const MCInstrDesc & getBrCond(AVRCC::CondCodes CC) const
INLINEASM_BR - Terminator version of inline asm. Used by asm-goto.
const AVRRegisterInfo * getRegisterInfo() const override
unsigned getOpcode() const
Return the opcode number for this descriptor.
Register getReg() const
getReg - Returns the register number.
void setHasSpills(bool B)
const MachineOperand & getOperand(unsigned i) const
const MachineInstrBuilder & addReg(Register RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
bool empty() const
empty - Check if the array is empty.
unsigned getSize() const
Return the number of bytes in the encoding of this instruction, or zero if the encoding size cannot b...