24 static bool isArithmeticBccPair(
const MachineInstr *FirstMI,
30 if (FirstMI ==
nullptr)
34 case AArch64::ADDSWri:
35 case AArch64::ADDSWrr:
36 case AArch64::ADDSXri:
37 case AArch64::ADDSXrr:
38 case AArch64::ANDSWri:
39 case AArch64::ANDSWrr:
40 case AArch64::ANDSXri:
41 case AArch64::ANDSXrr:
42 case AArch64::SUBSWri:
43 case AArch64::SUBSWrr:
44 case AArch64::SUBSXri:
45 case AArch64::SUBSXrr:
46 case AArch64::BICSWrr:
47 case AArch64::BICSXrr:
49 case AArch64::ADDSWrs:
50 case AArch64::ADDSXrs:
51 case AArch64::ANDSWrs:
52 case AArch64::ANDSXrs:
53 case AArch64::SUBSWrs:
54 case AArch64::SUBSXrs:
55 case AArch64::BICSWrs:
56 case AArch64::BICSXrs:
58 return !AArch64InstrInfo::hasShiftedReg(*FirstMI);
65 static bool isArithmeticCbzPair(
const MachineInstr *FirstMI,
67 if (SecondMI.
getOpcode() != AArch64::CBZW &&
74 if (FirstMI ==
nullptr)
100 case AArch64::ADDXrs:
101 case AArch64::ANDWrs:
102 case AArch64::ANDXrs:
103 case AArch64::SUBWrs:
104 case AArch64::SUBXrs:
105 case AArch64::BICWrs:
106 case AArch64::BICXrs:
108 return !AArch64InstrInfo::hasShiftedReg(*FirstMI);
120 case AArch64::AESMCrr:
121 case AArch64::AESMCrrTied:
122 return FirstMI ==
nullptr || FirstMI->
getOpcode() == AArch64::AESErr;
124 case AArch64::AESIMCrr:
125 case AArch64::AESIMCrrTied:
126 return FirstMI ==
nullptr || FirstMI->
getOpcode() == AArch64::AESDrr;
133 static bool isCryptoEORPair(
const MachineInstr *FirstMI,
135 if (SecondMI.
getOpcode() != AArch64::EORv16i8)
139 if (FirstMI ==
nullptr)
143 case AArch64::AESErr:
144 case AArch64::AESDrr:
145 case AArch64::PMULLv16i8:
146 case AArch64::PMULLv8i8:
147 case AArch64::PMULLv1i64:
148 case AArch64::PMULLv2i64:
166 if ((FirstMI ==
nullptr || FirstMI->
getOpcode() == AArch64::MOVZWi) &&
167 (SecondMI.
getOpcode() == AArch64::MOVKWi &&
172 if((FirstMI ==
nullptr || FirstMI->
getOpcode() == AArch64::MOVZXi) &&
173 (SecondMI.
getOpcode() == AArch64::MOVKXi &&
178 if ((FirstMI ==
nullptr ||
179 (FirstMI->
getOpcode() == AArch64::MOVKXi &&
181 (SecondMI.
getOpcode() == AArch64::MOVKXi &&
189 static bool isAddressLdStPair(
const MachineInstr *FirstMI,
192 case AArch64::STRBBui:
193 case AArch64::STRBui:
194 case AArch64::STRDui:
195 case AArch64::STRHHui:
196 case AArch64::STRHui:
197 case AArch64::STRQui:
198 case AArch64::STRSui:
199 case AArch64::STRWui:
200 case AArch64::STRXui:
201 case AArch64::LDRBBui:
202 case AArch64::LDRBui:
203 case AArch64::LDRDui:
204 case AArch64::LDRHHui:
205 case AArch64::LDRHui:
206 case AArch64::LDRQui:
207 case AArch64::LDRSui:
208 case AArch64::LDRWui:
209 case AArch64::LDRXui:
210 case AArch64::LDRSBWui:
211 case AArch64::LDRSBXui:
212 case AArch64::LDRSHWui:
213 case AArch64::LDRSHXui:
214 case AArch64::LDRSWui:
216 if (FirstMI ==
nullptr)
234 if (SecondMI.
getOpcode() == AArch64::CSELWr) {
236 if (FirstMI ==
nullptr)
241 case AArch64::SUBSWrs:
242 return !AArch64InstrInfo::hasShiftedReg(*FirstMI);
243 case AArch64::SUBSWrx:
244 return !AArch64InstrInfo::hasExtendedReg(*FirstMI);
245 case AArch64::SUBSWrr:
246 case AArch64::SUBSWri:
252 if (SecondMI.
getOpcode() == AArch64::CSELXr) {
254 if (FirstMI ==
nullptr)
259 case AArch64::SUBSXrs:
260 return !AArch64InstrInfo::hasShiftedReg(*FirstMI);
261 case AArch64::SUBSXrx:
262 case AArch64::SUBSXrx64:
263 return !AArch64InstrInfo::hasExtendedReg(*FirstMI);
264 case AArch64::SUBSXrr:
265 case AArch64::SUBSXri:
274 static bool isArithmeticLogicPair(
const MachineInstr *FirstMI,
276 if (AArch64InstrInfo::hasShiftedReg(SecondMI))
281 case AArch64::ADDWrr:
282 case AArch64::ADDXrr:
283 case AArch64::SUBWrr:
284 case AArch64::SUBXrr:
285 case AArch64::ADDWrs:
286 case AArch64::ADDXrs:
287 case AArch64::SUBWrs:
288 case AArch64::SUBXrs:
290 case AArch64::ANDWrr:
291 case AArch64::ANDXrr:
292 case AArch64::BICWrr:
293 case AArch64::BICXrr:
294 case AArch64::EONWrr:
295 case AArch64::EONXrr:
296 case AArch64::EORWrr:
297 case AArch64::EORXrr:
298 case AArch64::ORNWrr:
299 case AArch64::ORNXrr:
300 case AArch64::ORRWrr:
301 case AArch64::ORRXrr:
302 case AArch64::ANDWrs:
303 case AArch64::ANDXrs:
304 case AArch64::BICWrs:
305 case AArch64::BICXrs:
306 case AArch64::EONWrs:
307 case AArch64::EONXrs:
308 case AArch64::EORWrs:
309 case AArch64::EORXrs:
310 case AArch64::ORNWrs:
311 case AArch64::ORNXrs:
312 case AArch64::ORRWrs:
313 case AArch64::ORRXrs:
315 if (FirstMI ==
nullptr)
320 case AArch64::ADDWrr:
321 case AArch64::ADDXrr:
322 case AArch64::ADDSWrr:
323 case AArch64::ADDSXrr:
324 case AArch64::SUBWrr:
325 case AArch64::SUBXrr:
326 case AArch64::SUBSWrr:
327 case AArch64::SUBSXrr:
329 case AArch64::ADDWrs:
330 case AArch64::ADDXrs:
331 case AArch64::ADDSWrs:
332 case AArch64::ADDSXrs:
333 case AArch64::SUBWrs:
334 case AArch64::SUBXrs:
335 case AArch64::SUBSWrs:
336 case AArch64::SUBSXrs:
337 return !AArch64InstrInfo::hasShiftedReg(*FirstMI);
342 case AArch64::ADDSWrr:
343 case AArch64::ADDSXrr:
344 case AArch64::SUBSWrr:
345 case AArch64::SUBSXrr:
346 case AArch64::ADDSWrs:
347 case AArch64::ADDSXrs:
348 case AArch64::SUBSWrs:
349 case AArch64::SUBSXrs:
351 if (FirstMI ==
nullptr)
356 case AArch64::ADDWrr:
357 case AArch64::ADDXrr:
358 case AArch64::SUBWrr:
359 case AArch64::SUBXrr:
361 case AArch64::ADDWrs:
362 case AArch64::ADDXrs:
363 case AArch64::SUBWrs:
364 case AArch64::SUBXrs:
365 return !AArch64InstrInfo::hasShiftedReg(*FirstMI);
This class represents lattice values for constants.
static bool isAESPair(const MachineInstr *FirstMI, const MachineInstr &SecondMI)
bool hasFuseLiterals() const
bool hasFuseArithmeticLogic() const
const HexagonInstrInfo * TII
bool hasArithmeticBccFusion() const
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
std::unique_ptr< ScheduleDAGMutation > createMacroFusionDAGMutation(ShouldSchedulePredTy shouldScheduleAdjacent)
Create a DAG scheduling mutation to pair instructions back to back for instructions that benefit acco...
bool hasFuseAddress() const
TargetInstrInfo - Interface to description of machine instruction set.
static bool isLiteralsPair(const MachineInstr *FirstMI, const MachineInstr &SecondMI)
bool definesRegister(unsigned Reg, const TargetRegisterInfo *TRI=nullptr) const
Return true if the MachineInstr fully defines the specified register.
std::unique_ptr< ScheduleDAGMutation > createAArch64MacroFusionDAGMutation()
Note that you have to add: DAG.addMutation(createAArch64MacroFusionDAGMutation()); to AArch64PassConf...
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.
bool hasArithmeticCbzFusion() const
bool hasFuseCryptoEOR() const
TargetSubtargetInfo - Generic base class for all target subtargets.
Representation of each machine instruction.
bool hasFuseCCSelect() const
const MachineOperand & getOperand(unsigned i) const