23 #define GET_INSTRINFO_CTOR_DTOR 24 #include "BPFGenInstrInfo.inc" 35 if (BPF::GPRRegClass.
contains(DestReg, SrcReg))
36 BuildMI(MBB, I, DL,
get(BPF::MOV_rr), DestReg)
38 else if (BPF::GPR32RegClass.
contains(DestReg, SrcReg))
39 BuildMI(MBB, I, DL,
get(BPF::MOV_rr_32), DestReg)
46 Register DstReg = MI->getOperand(0).getReg();
47 Register SrcReg = MI->getOperand(1).getReg();
48 uint64_t CopyLen = MI->getOperand(2).getImm();
49 uint64_t Alignment = MI->getOperand(3).getImm();
50 Register ScratchReg = MI->getOperand(4).getReg();
53 unsigned LdOpc, StOpc;
76 unsigned IterationNum = CopyLen >>
Log2_64(Alignment);
77 for(
unsigned I = 0;
I < IterationNum; ++
I) {
78 BuildMI(*BB, MI, dl,
get(LdOpc))
81 BuildMI(*BB, MI, dl,
get(StOpc))
86 unsigned BytesLeft = CopyLen & (Alignment - 1);
87 unsigned Offset = IterationNum * Alignment;
88 bool Hanging4Byte = BytesLeft & 0x4;
89 bool Hanging2Byte = BytesLeft & 0x2;
90 bool Hanging1Byte = BytesLeft & 0x1;
92 BuildMI(*BB, MI, dl,
get(BPF::LDW))
94 BuildMI(*BB, MI, dl,
get(BPF::STW))
99 BuildMI(*BB, MI, dl,
get(BPF::LDH))
101 BuildMI(*BB, MI, dl,
get(BPF::STH))
106 BuildMI(*BB, MI, dl,
get(BPF::LDB))
108 BuildMI(*BB, MI, dl,
get(BPF::STB))
126 unsigned SrcReg,
bool IsKill,
int FI,
131 DL = I->getDebugLoc();
133 if (RC == &BPF::GPRRegClass)
134 BuildMI(MBB, I, DL,
get(BPF::STD))
138 else if (RC == &BPF::GPR32RegClass)
139 BuildMI(MBB, I, DL,
get(BPF::STW32))
149 unsigned DestReg,
int FI,
154 DL = I->getDebugLoc();
156 if (RC == &BPF::GPRRegClass)
158 else if (RC == &BPF::GPR32RegClass)
168 bool AllowModify)
const {
172 while (I != MBB.
begin()) {
174 if (I->isDebugInstr())
179 if (!isUnpredicatedTerminator(*I))
188 if (I->getOpcode() == BPF::JMP) {
190 TBB = I->getOperand(0).getMBB();
195 while (std::next(I) != MBB.
end())
196 std::next(I)->eraseFromParent();
203 I->eraseFromParent();
209 TBB = I->getOperand(0).getMBB();
224 int *BytesAdded)
const {
225 assert(!BytesAdded &&
"code size not handled");
228 assert(TBB &&
"insertBranch must not be told to insert a fallthrough");
232 assert(!FBB &&
"Unconditional branch with multiple successors!");
241 int *BytesRemoved)
const {
242 assert(!BytesRemoved &&
"code size not handled");
247 while (I != MBB.
begin()) {
249 if (I->isDebugInstr())
251 if (I->getOpcode() != BPF::JMP)
254 I->eraseFromParent();
Wrapper class representing physical registers. Should be passed by value.
This class represents lattice values for constants.
unsigned insertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, MachineBasicBlock *FBB, ArrayRef< MachineOperand > Cond, const DebugLoc &DL, int *BytesAdded=nullptr) const override
unsigned const TargetRegisterInfo * TRI
const MachineInstrBuilder & addMBB(MachineBasicBlock *MBB, unsigned TargetFlags=0) const
return AArch64::GPR64RegClass contains(Reg)
instr_iterator erase(instr_iterator I)
Remove an instruction from the instruction list and delete it.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
unsigned removeBranch(MachineBasicBlock &MBB, int *BytesRemoved=nullptr) const override
unsigned getKillRegState(bool B)
bool analyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB, MachineBasicBlock *&FBB, SmallVectorImpl< MachineOperand > &Cond, bool AllowModify) const override
MachineInstrBuilder BuildMI(MachineFunction &MF, const DebugLoc &DL, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
const MachineInstrBuilder & addFrameIndex(int Idx) const
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
void loadRegFromStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, unsigned DestReg, int FrameIndex, const TargetRegisterClass *RC, const TargetRegisterInfo *TRI) const override
void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, const DebugLoc &DL, MCRegister DestReg, MCRegister SrcReg, bool KillSrc) const override
bool isLayoutSuccessor(const MachineBasicBlock *MBB) const
Return true if the specified MBB will be emitted immediately after this block, such that if this bloc...
bool expandPostRAPseudo(MachineInstr &MI) const override
Representation of each machine instruction.
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
void storeRegToStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, unsigned SrcReg, bool isKill, int FrameIndex, const TargetRegisterClass *RC, const TargetRegisterInfo *TRI) const override
const MachineInstrBuilder & addReg(Register RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
unsigned Log2_64(uint64_t Value)
Return the floor log base 2 of the specified value, -1 if the value is zero.
Wrapper class representing virtual and physical registers.
bool empty() const
empty - Check if the array is empty.