LLVM 24.0.0git
AArch64MacroFusion.cpp File Reference

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "aarch64-macro-fusion"

Functions

 STATISTIC (NumFusedArithmeticBcc, "Number of arithmetic-Bcc fusions")
 STATISTIC (NumFusedArithmeticCbz, "Number of arithmetic-Cbz fusions")
 STATISTIC (NumFusedAES, "Number of AES fusions")
 STATISTIC (NumFusedCryptoEOR, "Number of crypto-EOR fusions")
 STATISTIC (NumFusedAdrpAdd, "Number of ADRP-ADD fusions")
 STATISTIC (NumFusedLiterals, "Number of literal-generation fusions")
 STATISTIC (NumFusedAddress, "Number of address-generation load/store fusions")
 STATISTIC (NumFusedCmpCSel, "Number of compare-CSEL fusions")
 STATISTIC (NumFusedFCmpFCSel, "Number of FP-compare-FCSEL fusions")
 STATISTIC (NumFusedCmpCSet, "Number of compare-CSET fusions")
 STATISTIC (NumFusedArithmeticLogic, "Number of arithmetic-logic fusions")
 STATISTIC (NumFusedAddSub2RegAndConstOne, "Number of add/sub-two-register-and-constant-one fusions")
 STATISTIC (NumFusedAppleSMECompute, "Number of Apple SME compute fusions")
 STATISTIC (NumFusedFMinFMax, "Number of FMIN-FMAX fusions")
static bool isArithmeticBccPair (const MachineInstr *FirstMI, const MachineInstr &SecondMI, bool CmpOnly)
 CMN, CMP, TST followed by Bcc.
static bool isArithmeticCbzPair (const MachineInstr *FirstMI, const MachineInstr &SecondMI)
 ALU operations followed by CBZ/CBNZ.
static bool mayHaveWAWDependency (const MachineInstr &FirstMI, const MachineInstr &SecondMI)
static bool isAESPair (const MachineInstr *FirstMI, const MachineInstr &SecondMI)
 AES crypto encoding or decoding.
static bool isCryptoEORPair (const MachineInstr *FirstMI, const MachineInstr &SecondMI)
 AESE/AESD/PMULL + EOR.
static bool isAdrpAddPair (const MachineInstr *FirstMI, const MachineInstr &SecondMI)
static bool isLiteralsPair (const MachineInstr *FirstMI, const MachineInstr &SecondMI)
 Literal generation.
static bool isAddressLdStPair (const MachineInstr *FirstMI, const MachineInstr &SecondMI)
 Fuse address generation and loads or stores.
static bool isCmpCSelPair (const MachineInstr *FirstMI, const MachineInstr &SecondMI)
 Compare and conditional select.
static bool isFCmpFCSelPair (const MachineInstr *FirstMI, const MachineInstr &SecondMI)
 Floating-point compare and floating-point conditional select.
static bool isCmpCSetPair (const MachineInstr *FirstMI, const MachineInstr &SecondMI)
 Compare and cset.
static bool isArithmeticLogicPair (const MachineInstr *FirstMI, const MachineInstr &SecondMI)
static bool isAddSub2RegAndConstOnePair (const MachineInstr *FirstMI, const MachineInstr &SecondMI)
static bool definesRegInClass (const MachineInstr &MI, const TargetRegisterInfo *TRI, const TargetRegisterClass &Class)
static bool readsRegInClass (const MachineInstr &MI, const TargetRegisterInfo *TRI, const TargetRegisterClass &Class)
static bool isFusableAppleSMEComputeOp (const MachineInstr &MI, const TargetInstrInfo &TII, const TargetRegisterInfo *TRI)
static bool isAppleSMEComputePair (const MachineInstr *FirstMI, const MachineInstr &SecondMI, const TargetInstrInfo &TII, const TargetRegisterInfo *TRI)
static bool isFMinFMax (unsigned Opcode)
static bool isFMinFMaxPair (const MachineInstr *FirstMI, const MachineInstr &SecondMI)
static bool shouldScheduleAdjacent (const TargetInstrInfo &TII, const TargetSubtargetInfo &TSI, const MachineInstr *FirstMI, const MachineInstr &SecondMI, const SDep *Dep)
 Check if the instr pair, FirstMI and SecondMI, should be fused together.

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "aarch64-macro-fusion"

Definition at line 20 of file AArch64MacroFusion.cpp.

Function Documentation

◆ definesRegInClass()

bool definesRegInClass ( const MachineInstr & MI,
const TargetRegisterInfo * TRI,
const TargetRegisterClass & Class )
static

Definition at line 559 of file AArch64MacroFusion.cpp.

References llvm::any_of(), MI, Reg, and TRI.

Referenced by isFusableAppleSMEComputeOp().

◆ isAddressLdStPair()

bool isAddressLdStPair ( const MachineInstr * FirstMI,
const MachineInstr & SecondMI )
static

Fuse address generation and loads or stores.

Definition at line 254 of file AArch64MacroFusion.cpp.

References llvm::MachineOperand::getImm(), llvm::MachineInstr::getOpcode(), and llvm::MachineInstr::getOperand().

Referenced by shouldScheduleAdjacent().

◆ isAddSub2RegAndConstOnePair()

◆ isAdrpAddPair()

bool isAdrpAddPair ( const MachineInstr * FirstMI,
const MachineInstr & SecondMI )
static

Definition at line 217 of file AArch64MacroFusion.cpp.

References llvm::MachineInstr::getOpcode().

Referenced by shouldScheduleAdjacent().

◆ isAESPair()

bool isAESPair ( const MachineInstr * FirstMI,
const MachineInstr & SecondMI )
static

AES crypto encoding or decoding.

Definition at line 166 of file AArch64MacroFusion.cpp.

References llvm::MachineInstr::getOpcode(), and mayHaveWAWDependency().

Referenced by shouldScheduleAdjacent().

◆ isAppleSMEComputePair()

bool isAppleSMEComputePair ( const MachineInstr * FirstMI,
const MachineInstr & SecondMI,
const TargetInstrInfo & TII,
const TargetRegisterInfo * TRI )
static

Definition at line 613 of file AArch64MacroFusion.cpp.

References isFusableAppleSMEComputeOp(), TII, and TRI.

Referenced by shouldScheduleAdjacent().

◆ isArithmeticBccPair()

bool isArithmeticBccPair ( const MachineInstr * FirstMI,
const MachineInstr & SecondMI,
bool CmpOnly )
static

◆ isArithmeticCbzPair()

bool isArithmeticCbzPair ( const MachineInstr * FirstMI,
const MachineInstr & SecondMI )
static

ALU operations followed by CBZ/CBNZ.

Definition at line 90 of file AArch64MacroFusion.cpp.

References llvm::MachineInstr::getOpcode().

Referenced by shouldScheduleAdjacent().

◆ isArithmeticLogicPair()

bool isArithmeticLogicPair ( const MachineInstr * FirstMI,
const MachineInstr & SecondMI )
static

Definition at line 402 of file AArch64MacroFusion.cpp.

References llvm::MachineInstr::getOpcode().

Referenced by shouldScheduleAdjacent().

◆ isCmpCSelPair()

bool isCmpCSelPair ( const MachineInstr * FirstMI,
const MachineInstr & SecondMI )
static

Compare and conditional select.

Definition at line 296 of file AArch64MacroFusion.cpp.

References llvm::MachineInstr::definesRegister(), and llvm::MachineInstr::getOpcode().

Referenced by shouldScheduleAdjacent().

◆ isCmpCSetPair()

◆ isCryptoEORPair()

bool isCryptoEORPair ( const MachineInstr * FirstMI,
const MachineInstr & SecondMI )
static

AESE/AESD/PMULL + EOR.

Definition at line 195 of file AArch64MacroFusion.cpp.

References llvm::MachineInstr::getOpcode().

Referenced by shouldScheduleAdjacent().

◆ isFCmpFCSelPair()

bool isFCmpFCSelPair ( const MachineInstr * FirstMI,
const MachineInstr & SecondMI )
static

Floating-point compare and floating-point conditional select.

Definition at line 339 of file AArch64MacroFusion.cpp.

References llvm::MachineInstr::getOpcode().

Referenced by shouldScheduleAdjacent().

◆ isFMinFMax()

bool isFMinFMax ( unsigned Opcode)
static

Definition at line 628 of file AArch64MacroFusion.cpp.

Referenced by isFMinFMaxPair().

◆ isFMinFMaxPair()

bool isFMinFMaxPair ( const MachineInstr * FirstMI,
const MachineInstr & SecondMI )
static

◆ isFusableAppleSMEComputeOp()

bool isFusableAppleSMEComputeOp ( const MachineInstr & MI,
const TargetInstrInfo & TII,
const TargetRegisterInfo * TRI )
static

Definition at line 574 of file AArch64MacroFusion.cpp.

References definesRegInClass(), MI, readsRegInClass(), TII, and TRI.

Referenced by isAppleSMEComputePair().

◆ isLiteralsPair()

bool isLiteralsPair ( const MachineInstr * FirstMI,
const MachineInstr & SecondMI )
static

◆ mayHaveWAWDependency()

bool mayHaveWAWDependency ( const MachineInstr & FirstMI,
const MachineInstr & SecondMI )
static

◆ readsRegInClass()

bool readsRegInClass ( const MachineInstr & MI,
const TargetRegisterInfo * TRI,
const TargetRegisterClass & Class )
static

Definition at line 567 of file AArch64MacroFusion.cpp.

References llvm::any_of(), MI, Reg, and TRI.

Referenced by isFusableAppleSMEComputeOp().

◆ shouldScheduleAdjacent()

bool shouldScheduleAdjacent ( const TargetInstrInfo & TII,
const TargetSubtargetInfo & TSI,
const MachineInstr * FirstMI,
const MachineInstr & SecondMI,
const SDep * Dep )
static

Check if the instr pair, FirstMI and SecondMI, should be fused together.

Given SecondMI, when FirstMI is unspecified, then check if SecondMI may be part of a fused pair at all.

Definition at line 672 of file AArch64MacroFusion.cpp.

References llvm::TargetSubtargetInfo::getRegisterInfo(), isAddressLdStPair(), isAddSub2RegAndConstOnePair(), isAdrpAddPair(), isAESPair(), isAppleSMEComputePair(), isArithmeticBccPair(), isArithmeticCbzPair(), isArithmeticLogicPair(), isCmpCSelPair(), isCmpCSetPair(), isCryptoEORPair(), isFCmpFCSelPair(), isFMinFMaxPair(), isLiteralsPair(), llvm::isNonDataDep(), TII, and TRI.

◆ STATISTIC() [1/14]

STATISTIC ( NumFusedAddress ,
"Number of address-generation load/store fusions"  )

◆ STATISTIC() [2/14]

STATISTIC ( NumFusedAddSub2RegAndConstOne ,
"Number of add/sub-two-register-and-constant-one fusions"  )

◆ STATISTIC() [3/14]

STATISTIC ( NumFusedAdrpAdd ,
"Number of ADRP-ADD fusions"  )

◆ STATISTIC() [4/14]

STATISTIC ( NumFusedAES ,
"Number of AES fusions"  )

◆ STATISTIC() [5/14]

STATISTIC ( NumFusedAppleSMECompute ,
"Number of Apple SME compute fusions"  )

◆ STATISTIC() [6/14]

STATISTIC ( NumFusedArithmeticBcc ,
"Number of arithmetic-Bcc fusions"  )

◆ STATISTIC() [7/14]

STATISTIC ( NumFusedArithmeticCbz ,
"Number of arithmetic-Cbz fusions"  )

◆ STATISTIC() [8/14]

STATISTIC ( NumFusedArithmeticLogic ,
"Number of arithmetic-logic fusions"  )

◆ STATISTIC() [9/14]

STATISTIC ( NumFusedCmpCSel ,
"Number of compare-CSEL fusions"  )

◆ STATISTIC() [10/14]

STATISTIC ( NumFusedCmpCSet ,
"Number of compare-CSET fusions"  )

◆ STATISTIC() [11/14]

STATISTIC ( NumFusedCryptoEOR ,
"Number of crypto-EOR fusions"  )

◆ STATISTIC() [12/14]

STATISTIC ( NumFusedFCmpFCSel ,
"Number of FP-compare-FCSEL fusions"  )

◆ STATISTIC() [13/14]

STATISTIC ( NumFusedFMinFMax ,
"Number of FMIN-FMAX fusions"  )

◆ STATISTIC() [14/14]

STATISTIC ( NumFusedLiterals ,
"Number of literal-generation fusions"  )