Lines Matching refs:Ldst
77 MachineInstr *tryToCombine(MachineInstr &Ldst);
81 const MachineInstr *Ldst);
85 bool canHoistLoadStoreTo(MachineInstr *Ldst, MachineInstr *To);
95 MachineInstr *canJoinInstructions(MachineInstr *Ldst, MachineInstr *Add,
111 void changeToAddrMode(MachineInstr &Ldst, unsigned NewOpcode,
193 const MachineInstr *Ldst) { in noUseOfAddBeforeLoadOrStore() argument
195 return dominatesAllUsesOf(Ldst, R, MDT, MRI); in noUseOfAddBeforeLoadOrStore()
198 MachineInstr *ARCOptAddrMode::tryToCombine(MachineInstr &Ldst) { in tryToCombine() argument
199 assert(Ldst.mayLoadOrStore() && "LD/ST instruction expected"); in tryToCombine()
203 LLVM_DEBUG(dbgs() << "[ABAW] tryToCombine " << Ldst); in tryToCombine()
204 if (!AII->getBaseAndOffsetPosition(Ldst, BasePos, OffsetPos)) { in tryToCombine()
209 MachineOperand &Base = Ldst.getOperand(BasePos); in tryToCombine()
210 MachineOperand &Offset = Ldst.getOperand(OffsetPos); in tryToCombine()
238 MachineInstr *MoveTo = canJoinInstructions(&Ldst, &Add, &Uses); in tryToCombine()
246 LLVM_DEBUG(MachineInstr *First = &Ldst; MachineInstr *Last = &Add; in tryToCombine()
253 MachineInstr *Result = Ldst.getNextNode(); in tryToCombine()
255 Ldst.removeFromParent(); in tryToCombine()
256 Add.getParent()->insertAfter(Add.getIterator(), &Ldst); in tryToCombine()
263 int NewOpcode = ARC::getPostIncOpcode(Ldst.getOpcode()); in tryToCombine()
266 changeToAddrMode(Ldst, NewOpcode, NewBaseReg, Add.getOperand(2)); in tryToCombine()
275 ARCOptAddrMode::canJoinInstructions(MachineInstr *Ldst, MachineInstr *Add, in canJoinInstructions() argument
277 assert(Ldst && Add && "NULL instruction passed"); in canJoinInstructions()
280 MachineInstr *Last = Ldst; in canJoinInstructions()
281 if (MDT->dominates(Ldst, Add)) in canJoinInstructions()
283 else if (!MDT->dominates(Add, Ldst)) in canJoinInstructions()
290 if (!AII->getBaseAndOffsetPosition(*Ldst, BasePos, OffPos)) { in canJoinInstructions()
297 Register BaseReg = Ldst->getOperand(BasePos).getReg(); in canJoinInstructions()
305 if (Ldst->mayStore() && Ldst->getOperand(0).isReg()) { in canJoinInstructions()
306 Register StReg = Ldst->getOperand(0).getReg(); in canJoinInstructions()
316 if (&MI == Ldst || &MI == Add) in canJoinInstructions()
318 if (&MI != Add && MDT->dominates(Ldst, &MI)) in canJoinInstructions()
320 else if (!MDT->dominates(&MI, Ldst)) in canJoinInstructions()
336 } else if (canHoistLoadStoreTo(Ldst, Add)) { in canJoinInstructions()
348 *Uses = (Result == Ldst) ? UsesAfterLdst : UsesAfterAdd; in canJoinInstructions()
399 bool ARCOptAddrMode::canHoistLoadStoreTo(MachineInstr *Ldst, MachineInstr *To) { in canHoistLoadStoreTo() argument
400 if (Ldst->getParent() != To->getParent()) in canHoistLoadStoreTo()
402 MachineBasicBlock::const_iterator MI(To), ME(Ldst), in canHoistLoadStoreTo()
403 End(Ldst->getParent()->end()); in canHoistLoadStoreTo()
405 bool IsStore = Ldst->mayStore(); in canHoistLoadStoreTo()
416 for (auto &O : Ldst->explicit_operands()) { in canHoistLoadStoreTo()
451 void ARCOptAddrMode::changeToAddrMode(MachineInstr &Ldst, unsigned NewOpcode, in changeToAddrMode() argument
454 bool IsStore = Ldst.mayStore(); in changeToAddrMode()
457 AII->getBaseAndOffsetPosition(Ldst, BasePos, OffPos); in changeToAddrMode()
459 Register BaseReg = Ldst.getOperand(BasePos).getReg(); in changeToAddrMode()
461 Ldst.removeOperand(OffPos); in changeToAddrMode()
462 Ldst.removeOperand(BasePos); in changeToAddrMode()
465 Src = Ldst.getOperand(BasePos - 1); in changeToAddrMode()
466 Ldst.removeOperand(BasePos - 1); in changeToAddrMode()
469 Ldst.setDesc(AST->getInstrInfo()->get(NewOpcode)); in changeToAddrMode()
470 Ldst.addOperand(MachineOperand::CreateReg(NewBase, true)); in changeToAddrMode()
472 Ldst.addOperand(Src); in changeToAddrMode()
473 Ldst.addOperand(MachineOperand::CreateReg(BaseReg, false)); in changeToAddrMode()
474 Ldst.addOperand(NewOffset); in changeToAddrMode()
475 LLVM_DEBUG(dbgs() << "[ABAW] New Ldst: " << Ldst); in changeToAddrMode()