28 if (FirstMI ==
nullptr)
40 case AArch64::ADDSWri:
41 case AArch64::ADDSWrr:
42 case AArch64::ADDSXri:
43 case AArch64::ADDSXrr:
44 case AArch64::ANDSWri:
45 case AArch64::ANDSWrr:
46 case AArch64::ANDSXri:
47 case AArch64::ANDSXrr:
48 case AArch64::SUBSWri:
49 case AArch64::SUBSWrr:
50 case AArch64::SUBSXri:
51 case AArch64::SUBSXrr:
52 case AArch64::BICSWrr:
53 case AArch64::BICSXrr:
55 case AArch64::ADDSWrs:
56 case AArch64::ADDSXrs:
57 case AArch64::ANDSWrs:
58 case AArch64::ANDSXrs:
59 case AArch64::SUBSWrs:
60 case AArch64::SUBSXrs:
61 case AArch64::BICSWrs:
62 case AArch64::BICSXrs:
64 return !AArch64InstrInfo::hasShiftedReg(*FirstMI);
73 if (SecondMI.
getOpcode() != AArch64::CBZW &&
80 if (FirstMI ==
nullptr)
100 case AArch64::SUBWri:
101 case AArch64::SUBWrr:
102 case AArch64::SUBXri:
103 case AArch64::SUBXrr:
105 case AArch64::ADDWrs:
106 case AArch64::ADDXrs:
107 case AArch64::ANDWrs:
108 case AArch64::ANDXrs:
109 case AArch64::SUBWrs:
110 case AArch64::SUBXrs:
111 case AArch64::BICWrs:
112 case AArch64::BICXrs:
114 return !AArch64InstrInfo::hasShiftedReg(*FirstMI);
129 return DestFirst == DestSecond;
136 unsigned SecondOpcode = SecondMI.
getOpcode();
137 switch (SecondOpcode) {
139 case AArch64::AESMCrr:
140 case AArch64::AESMCrrTied:
141 if (FirstMI ==
nullptr)
143 if (FirstMI->
getOpcode() != AArch64::AESErr)
145 return SecondOpcode == AArch64::AESMCrrTied ||
148 case AArch64::AESIMCrr:
149 case AArch64::AESIMCrrTied:
150 if (FirstMI ==
nullptr)
152 if (FirstMI->
getOpcode() != AArch64::AESDrr)
154 return SecondOpcode == AArch64::AESIMCrrTied ||
164 if (SecondMI.
getOpcode() != AArch64::EORv16i8)
168 if (FirstMI ==
nullptr)
172 case AArch64::AESErr:
173 case AArch64::AESDrr:
174 case AArch64::PMULLv16i8:
175 case AArch64::PMULLv8i8:
176 case AArch64::PMULLv1i64:
177 case AArch64::PMULLv2i64:
187 if ((FirstMI ==
nullptr || FirstMI->
getOpcode() == AArch64::ADRP) &&
198 if ((FirstMI ==
nullptr || FirstMI->
getOpcode() == AArch64::MOVZWi) &&
199 (SecondMI.
getOpcode() == AArch64::MOVKWi &&
204 if((FirstMI ==
nullptr || FirstMI->
getOpcode() == AArch64::MOVZXi) &&
205 (SecondMI.
getOpcode() == AArch64::MOVKXi &&
210 if ((FirstMI ==
nullptr ||
211 (FirstMI->
getOpcode() == AArch64::MOVKXi &&
213 (SecondMI.
getOpcode() == AArch64::MOVKXi &&
224 case AArch64::STRBBui:
225 case AArch64::STRBui:
226 case AArch64::STRDui:
227 case AArch64::STRHHui:
228 case AArch64::STRHui:
229 case AArch64::STRQui:
230 case AArch64::STRSui:
231 case AArch64::STRWui:
232 case AArch64::STRXui:
233 case AArch64::LDRBBui:
234 case AArch64::LDRBui:
235 case AArch64::LDRDui:
236 case AArch64::LDRHHui:
237 case AArch64::LDRHui:
238 case AArch64::LDRQui:
239 case AArch64::LDRSui:
240 case AArch64::LDRWui:
241 case AArch64::LDRXui:
242 case AArch64::LDRSBWui:
243 case AArch64::LDRSBXui:
244 case AArch64::LDRSHWui:
245 case AArch64::LDRSHXui:
246 case AArch64::LDRSWui:
248 if (FirstMI ==
nullptr)
266 if (SecondMI.
getOpcode() == AArch64::CSELWr) {
268 if (FirstMI ==
nullptr)
273 case AArch64::SUBSWrs:
274 return !AArch64InstrInfo::hasShiftedReg(*FirstMI);
275 case AArch64::SUBSWrx:
276 return !AArch64InstrInfo::hasExtendedReg(*FirstMI);
277 case AArch64::SUBSWrr:
278 case AArch64::SUBSWri:
284 if (SecondMI.
getOpcode() == AArch64::CSELXr) {
286 if (FirstMI ==
nullptr)
291 case AArch64::SUBSXrs:
292 return !AArch64InstrInfo::hasShiftedReg(*FirstMI);
293 case AArch64::SUBSXrx:
294 case AArch64::SUBSXrx64:
295 return !AArch64InstrInfo::hasExtendedReg(*FirstMI);
296 case AArch64::SUBSXrr:
297 case AArch64::SUBSXri:
309 case AArch64::FCSELSrrr:
310 case AArch64::FCSELDrrr:
311 case AArch64::FCSELHrrr:
318 if (FirstMI ==
nullptr)
322 case AArch64::FCMPSrr:
323 case AArch64::FCMPDrr:
324 case AArch64::FCMPESrr:
325 case AArch64::FCMPEDrr:
326 case AArch64::FCMPHrr:
327 case AArch64::FCMPEHrr:
337 if ((SecondMI.
getOpcode() == AArch64::CSINCWr &&
340 (SecondMI.
getOpcode() == AArch64::CSINCXr &&
344 if (FirstMI ==
nullptr)
350 case AArch64::SUBSWrs:
351 case AArch64::SUBSXrs:
352 return !AArch64InstrInfo::hasShiftedReg(*FirstMI);
353 case AArch64::SUBSWrx:
354 case AArch64::SUBSXrx:
355 case AArch64::SUBSXrx64:
356 return !AArch64InstrInfo::hasExtendedReg(*FirstMI);
357 case AArch64::SUBSWri:
358 case AArch64::SUBSWrr:
359 case AArch64::SUBSXri:
360 case AArch64::SUBSXrr:
371 if (AArch64InstrInfo::hasShiftedReg(SecondMI))
376 case AArch64::ADDWrr:
377 case AArch64::ADDXrr:
378 case AArch64::SUBWrr:
379 case AArch64::SUBXrr:
380 case AArch64::ADDWrs:
381 case AArch64::ADDXrs:
382 case AArch64::SUBWrs:
383 case AArch64::SUBXrs:
385 case AArch64::ANDWrr:
386 case AArch64::ANDXrr:
387 case AArch64::BICWrr:
388 case AArch64::BICXrr:
389 case AArch64::EONWrr:
390 case AArch64::EONXrr:
391 case AArch64::EORWrr:
392 case AArch64::EORXrr:
393 case AArch64::ORNWrr:
394 case AArch64::ORNXrr:
395 case AArch64::ORRWrr:
396 case AArch64::ORRXrr:
397 case AArch64::ANDWrs:
398 case AArch64::ANDXrs:
399 case AArch64::BICWrs:
400 case AArch64::BICXrs:
401 case AArch64::EONWrs:
402 case AArch64::EONXrs:
403 case AArch64::EORWrs:
404 case AArch64::EORXrs:
405 case AArch64::ORNWrs:
406 case AArch64::ORNXrs:
407 case AArch64::ORRWrs:
408 case AArch64::ORRXrs:
410 if (FirstMI ==
nullptr)
415 case AArch64::ADDWrr:
416 case AArch64::ADDXrr:
417 case AArch64::ADDSWrr:
418 case AArch64::ADDSXrr:
419 case AArch64::SUBWrr:
420 case AArch64::SUBXrr:
421 case AArch64::SUBSWrr:
422 case AArch64::SUBSXrr:
424 case AArch64::ADDWrs:
425 case AArch64::ADDXrs:
426 case AArch64::ADDSWrs:
427 case AArch64::ADDSXrs:
428 case AArch64::SUBWrs:
429 case AArch64::SUBXrs:
430 case AArch64::SUBSWrs:
431 case AArch64::SUBSXrs:
432 return !AArch64InstrInfo::hasShiftedReg(*FirstMI);
437 case AArch64::ADDSWrr:
438 case AArch64::ADDSXrr:
439 case AArch64::SUBSWrr:
440 case AArch64::SUBSXrr:
441 case AArch64::ADDSWrs:
442 case AArch64::ADDSXrs:
443 case AArch64::SUBSWrs:
444 case AArch64::SUBSXrs:
446 if (FirstMI ==
nullptr)
451 case AArch64::ADDWrr:
452 case AArch64::ADDXrr:
453 case AArch64::SUBWrr:
454 case AArch64::SUBXrr:
456 case AArch64::ADDWrs:
457 case AArch64::ADDXrs:
458 case AArch64::SUBWrs:
459 case AArch64::SUBXrs:
460 return !AArch64InstrInfo::hasShiftedReg(*FirstMI);
471 bool NeedsSubtract =
false;
475 case AArch64::SUBWri:
476 case AArch64::SUBXri:
477 NeedsSubtract =
true;
479 case AArch64::ADDWri:
480 case AArch64::ADDXri:
493 if (FirstMI ==
nullptr) {
498 case AArch64::SUBWrs:
499 case AArch64::SUBXrs:
500 if (AArch64InstrInfo::hasShiftedReg(*FirstMI))
503 case AArch64::SUBWrr:
504 case AArch64::SUBXrr:
510 case AArch64::ADDWrs:
511 case AArch64::ADDXrs:
512 if (AArch64InstrInfo::hasShiftedReg(*FirstMI))
515 case AArch64::ADDWrr:
516 case AArch64::ADDXrr:
517 if (!NeedsSubtract) {
537 if (ST.hasCmpBccFusion() || ST.hasArithmeticBccFusion()) {
538 bool CmpOnly = !ST.hasArithmeticBccFusion();
544 if (ST.hasFuseAES() &&
isAESPair(FirstMI, SecondMI))
562 if (ST.hasFuseAddSub2RegAndConstOne() &&
569std::unique_ptr<ScheduleDAGMutation>
static bool isFCmpFCSelPair(const MachineInstr *FirstMI, const MachineInstr &SecondMI)
Floating-point compare and floating-point conditional select.
static bool isAddSub2RegAndConstOnePair(const MachineInstr *FirstMI, const MachineInstr &SecondMI)
static bool isCmpCSelPair(const MachineInstr *FirstMI, const MachineInstr &SecondMI)
Compare and conditional select.
static bool isArithmeticBccPair(const MachineInstr *FirstMI, const MachineInstr &SecondMI, bool CmpOnly)
CMN, CMP, TST followed by Bcc.
static bool isAddressLdStPair(const MachineInstr *FirstMI, const MachineInstr &SecondMI)
Fuse address generation and loads or stores.
static bool isArithmeticCbzPair(const MachineInstr *FirstMI, const MachineInstr &SecondMI)
ALU operations followed by CBZ/CBNZ.
static bool shouldScheduleAdjacent(const TargetInstrInfo &TII, const TargetSubtargetInfo &TSI, const MachineInstr *FirstMI, const MachineInstr &SecondMI)
Check if the instr pair, FirstMI and SecondMI, should be fused together.
static bool isAESPair(const MachineInstr *FirstMI, const MachineInstr &SecondMI)
AES crypto encoding or decoding.
static bool isCmpCSetPair(const MachineInstr *FirstMI, const MachineInstr &SecondMI)
Compare and cset.
static bool isAdrpAddPair(const MachineInstr *FirstMI, const MachineInstr &SecondMI)
static bool mayHaveWAWDependency(const MachineInstr &FirstMI, const MachineInstr &SecondMI)
static bool isArithmeticLogicPair(const MachineInstr *FirstMI, const MachineInstr &SecondMI)
static bool isCryptoEORPair(const MachineInstr *FirstMI, const MachineInstr &SecondMI)
AESE/AESD/PMULL + EOR.
static bool isLiteralsPair(const MachineInstr *FirstMI, const MachineInstr &SecondMI)
Literal generation.
const HexagonInstrInfo * TII
Representation of each machine instruction.
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
bool definesRegister(Register Reg, const TargetRegisterInfo *TRI) const
Return true if the MachineInstr fully defines the specified register.
const MachineOperand & getOperand(unsigned i) const
bool isReg() const
isReg - Tests if this is a MO_Register operand.
bool isImm() const
isImm - Tests if this is a MO_Immediate operand.
Register getReg() const
getReg - Returns the register number.
Wrapper class representing virtual and physical registers.
constexpr bool isPhysical() const
Return true if the specified register number is in the physical register namespace.
TargetInstrInfo - Interface to description of machine instruction set.
TargetSubtargetInfo - Generic base class for all target subtargets.
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI std::unique_ptr< ScheduleDAGMutation > createMacroFusionDAGMutation(ArrayRef< MacroFusionPredTy > Predicates, bool BranchOnly=false)
Create a DAG scheduling mutation to pair instructions back to back for instructions that benefit acco...
std::unique_ptr< ScheduleDAGMutation > createAArch64MacroFusionDAGMutation()
Note that you have to add: DAG.addMutation(createAArch64MacroFusionDAGMutation()); to AArch64TargetMa...
static bool shouldScheduleAdjacent(const TargetInstrInfo &TII, const TargetSubtargetInfo &TSI, const MachineInstr *FirstMI, const MachineInstr &SecondMI)
Check if the instr pair, FirstMI and SecondMI, should be fused together.