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,
194 const MachineInstr *Ldst) { in noUseOfAddBeforeLoadOrStore() argument
196 return dominatesAllUsesOf(Ldst, R, MDT, MRI); in noUseOfAddBeforeLoadOrStore()
199 MachineInstr *ARCOptAddrMode::tryToCombine(MachineInstr &Ldst) { in tryToCombine() argument
200 assert(Ldst.mayLoadOrStore() && "LD/ST instruction expected"); in tryToCombine()
204 LLVM_DEBUG(dbgs() << "[ABAW] tryToCombine " << Ldst); in tryToCombine()
205 if (!AII->getBaseAndOffsetPosition(Ldst, BasePos, OffsetPos)) { in tryToCombine()
210 MachineOperand &Base = Ldst.getOperand(BasePos); in tryToCombine()
211 MachineOperand &Offset = Ldst.getOperand(OffsetPos); in tryToCombine()
239 MachineInstr *MoveTo = canJoinInstructions(&Ldst, &Add, &Uses); in tryToCombine()
247 LLVM_DEBUG(MachineInstr *First = &Ldst; MachineInstr *Last = &Add; in tryToCombine()
254 MachineInstr *Result = Ldst.getNextNode(); in tryToCombine()
256 Ldst.removeFromParent(); in tryToCombine()
257 Add.getParent()->insertAfter(Add.getIterator(), &Ldst); in tryToCombine()
264 int NewOpcode = ARC::getPostIncOpcode(Ldst.getOpcode()); in tryToCombine()
267 changeToAddrMode(Ldst, NewOpcode, NewBaseReg, Add.getOperand(2)); in tryToCombine()
276 ARCOptAddrMode::canJoinInstructions(MachineInstr *Ldst, MachineInstr *Add, in canJoinInstructions() argument
278 assert(Ldst && Add && "NULL instruction passed"); in canJoinInstructions()
281 MachineInstr *Last = Ldst; in canJoinInstructions()
282 if (MDT->dominates(Ldst, Add)) in canJoinInstructions()
284 else if (!MDT->dominates(Add, Ldst)) in canJoinInstructions()
291 if (!AII->getBaseAndOffsetPosition(*Ldst, BasePos, OffPos)) { in canJoinInstructions()
298 Register BaseReg = Ldst->getOperand(BasePos).getReg(); in canJoinInstructions()
306 if (Ldst->mayStore() && Ldst->getOperand(0).isReg()) { in canJoinInstructions()
307 Register StReg = Ldst->getOperand(0).getReg(); in canJoinInstructions()
317 if (&MI == Ldst || &MI == Add) in canJoinInstructions()
319 if (&MI != Add && MDT->dominates(Ldst, &MI)) in canJoinInstructions()
321 else if (!MDT->dominates(&MI, Ldst)) in canJoinInstructions()
337 } else if (canHoistLoadStoreTo(Ldst, Add)) { in canJoinInstructions()
349 *Uses = (Result == Ldst) ? UsesAfterLdst : UsesAfterAdd; in canJoinInstructions()
400 bool ARCOptAddrMode::canHoistLoadStoreTo(MachineInstr *Ldst, MachineInstr *To) { in canHoistLoadStoreTo() argument
401 if (Ldst->getParent() != To->getParent()) in canHoistLoadStoreTo()
403 MachineBasicBlock::const_iterator MI(To), ME(Ldst), in canHoistLoadStoreTo()
404 End(Ldst->getParent()->end()); in canHoistLoadStoreTo()
406 bool IsStore = Ldst->mayStore(); in canHoistLoadStoreTo()
417 for (auto &O : Ldst->explicit_operands()) { in canHoistLoadStoreTo()
452 void ARCOptAddrMode::changeToAddrMode(MachineInstr &Ldst, unsigned NewOpcode, in changeToAddrMode() argument
455 bool IsStore = Ldst.mayStore(); in changeToAddrMode()
458 AII->getBaseAndOffsetPosition(Ldst, BasePos, OffPos); in changeToAddrMode()
460 Register BaseReg = Ldst.getOperand(BasePos).getReg(); in changeToAddrMode()
462 Ldst.removeOperand(OffPos); in changeToAddrMode()
463 Ldst.removeOperand(BasePos); in changeToAddrMode()
466 Src = Ldst.getOperand(BasePos - 1); in changeToAddrMode()
467 Ldst.removeOperand(BasePos - 1); in changeToAddrMode()
470 Ldst.setDesc(AST->getInstrInfo()->get(NewOpcode)); in changeToAddrMode()
471 Ldst.addOperand(MachineOperand::CreateReg(NewBase, true)); in changeToAddrMode()
473 Ldst.addOperand(Src); in changeToAddrMode()
474 Ldst.addOperand(MachineOperand::CreateReg(BaseReg, false)); in changeToAddrMode()
475 Ldst.addOperand(NewOffset); in changeToAddrMode()
476 LLVM_DEBUG(dbgs() << "[ABAW] New Ldst: " << Ldst); in changeToAddrMode()