LLVM 24.0.0git
SystemZElimCompare.cpp File Reference

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "systemz-elim-compare"

Functions

 STATISTIC (BranchOnCounts, "Number of branch-on-count instructions")
 STATISTIC (LoadAndTraps, "Number of load-and-trap instructions")
 STATISTIC (EliminatedComparisons, "Number of eliminated comparisons")
 STATISTIC (FusedComparisons, "Number of fused compare-and-branch instructions")
 INITIALIZE_PASS (SystemZElimCompareLegacy, DEBUG_TYPE, "SystemZ Comparison Elimination", false, false) static bool preservesValueOf(MachineInstr &MI
static bool resultTests (MachineInstr &MI, unsigned Reg)
static Reference getRegReferences (MachineInstr &MI, unsigned Reg, const TargetRegisterInfo *TRI)
static bool convertToBRCT (MachineInstr &MI, MachineInstr &Compare, SmallVectorImpl< MachineInstr * > &CCUsers, const SystemZInstrInfo *TII, const TargetRegisterInfo *TRI)
static bool convertToLoadAndTrap (MachineInstr &MI, MachineInstr &Compare, SmallVectorImpl< MachineInstr * > &CCUsers, const SystemZInstrInfo *TII, const TargetRegisterInfo *TRI)
static bool isAddWithImmediate (unsigned Opcode)
static bool adjustCCMasksForInstr (MachineInstr &MI, MachineInstr &Compare, SmallVectorImpl< MachineInstr * > &CCUsers, unsigned ConvOpc, const SystemZInstrInfo *TII, const TargetRegisterInfo *TRI)
static bool convertToLoadAndTest (MachineInstr &MI, MachineInstr &Compare, SmallVectorImpl< MachineInstr * > &CCUsers, const SystemZInstrInfo *TII, const TargetRegisterInfo *TRI)
static bool convertToLogical (MachineInstr &MI, MachineInstr &Compare, SmallVectorImpl< MachineInstr * > &CCUsers, const SystemZInstrInfo *TII, const TargetRegisterInfo *TRI)
static bool optimizeCompareZero (MachineInstr &Compare, SmallVectorImpl< MachineInstr * > &CCUsers, const SystemZInstrInfo *TII, const TargetRegisterInfo *TRI)
static bool fuseCompareOperations (MachineInstr &Compare, SmallVectorImpl< MachineInstr * > &CCUsers, const SystemZInstrInfo *TII, const TargetRegisterInfo *TRI)
static bool processBlock (MachineBasicBlock &MBB, const SystemZInstrInfo *TII, const TargetRegisterInfo *TRI)
static bool runElimCompareOnMF (MachineFunction &F)

Variables

unsigned Reg

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "systemz-elim-compare"

Definition at line 40 of file SystemZElimCompare.cpp.

Function Documentation

◆ adjustCCMasksForInstr()

◆ convertToBRCT()

◆ convertToLoadAndTest()

bool convertToLoadAndTest ( MachineInstr & MI,
MachineInstr & Compare,
SmallVectorImpl< MachineInstr * > & CCUsers,
const SystemZInstrInfo * TII,
const TargetRegisterInfo * TRI )
static

◆ convertToLoadAndTrap()

◆ convertToLogical()

bool convertToLogical ( MachineInstr & MI,
MachineInstr & Compare,
SmallVectorImpl< MachineInstr * > & CCUsers,
const SystemZInstrInfo * TII,
const TargetRegisterInfo * TRI )
static

Definition at line 439 of file SystemZElimCompare.cpp.

References adjustCCMasksForInstr(), MI, TII, and TRI.

Referenced by optimizeCompareZero().

◆ fuseCompareOperations()

◆ getRegReferences()

Reference getRegReferences ( MachineInstr & MI,
unsigned Reg,
const TargetRegisterInfo * TRI )
static

Definition at line 120 of file SystemZElimCompare.cpp.

References MI, llvm::Ref, Reg, and TRI.

Referenced by convertToBRCT(), convertToLoadAndTrap(), and optimizeCompareZero().

◆ INITIALIZE_PASS()

INITIALIZE_PASS ( SystemZElimCompareLegacy ,
DEBUG_TYPE ,
"SystemZ Comparison Elimination" ,
false ,
false  ) &

References DEBUG_TYPE.

◆ isAddWithImmediate()

bool isAddWithImmediate ( unsigned Opcode)
static

Definition at line 245 of file SystemZElimCompare.cpp.

Referenced by adjustCCMasksForInstr().

◆ optimizeCompareZero()

◆ processBlock()

◆ resultTests()

bool resultTests ( MachineInstr & MI,
unsigned Reg )
static

Definition at line 111 of file SystemZElimCompare.cpp.

References MI, and Reg.

Referenced by optimizeCompareZero().

◆ runElimCompareOnMF()

bool runElimCompareOnMF ( MachineFunction & F)
static

Definition at line 705 of file SystemZElimCompare.cpp.

References Changed, F, MBB, processBlock(), TII, and TRI.

Referenced by llvm::SystemZElimComparePass::run().

◆ STATISTIC() [1/4]

STATISTIC ( BranchOnCounts ,
"Number of branch-on-count instructions"  )

◆ STATISTIC() [2/4]

STATISTIC ( EliminatedComparisons ,
"Number of eliminated comparisons"  )

◆ STATISTIC() [3/4]

STATISTIC ( FusedComparisons ,
"Number of fused compare-and-branch instructions"  )

References llvm::Other.

◆ STATISTIC() [4/4]

STATISTIC ( LoadAndTraps ,
"Number of load-and-trap instructions"  )

Variable Documentation

◆ Reg

unsigned Reg
Initial value:
{
switch (MI.getOpcode()) {
case SystemZ::LR:
case SystemZ::LGR:
case SystemZ::LGFR:
case SystemZ::LTR:
case SystemZ::LTGR:
case SystemZ::LTGFR:
if (MI.getOperand(1).getReg() == Reg)
return true;
}
return false
IRTranslator LLVM IR MI

Definition at line 94 of file SystemZElimCompare.cpp.