LLVM 22.0.0git
PPCReduceCRLogicals.cpp File Reference

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "ppc-reduce-cr-ops"

Functions

 STATISTIC (NumContainedSingleUseBinOps, "Number of single-use binary CR logical ops contained in a block")
 STATISTIC (NumToSplitBlocks, "Number of binary CR logical ops that can be used to split blocks")
 STATISTIC (TotalCRLogicals, "Number of CR logical ops.")
 STATISTIC (TotalNullaryCRLogicals, "Number of nullary CR logical ops (CRSET/CRUNSET).")
 STATISTIC (TotalUnaryCRLogicals, "Number of unary CR logical ops.")
 STATISTIC (TotalBinaryCRLogicals, "Number of CR logical ops.")
 STATISTIC (NumBlocksSplitOnBinaryCROp, "Number of blocks split on CR binary logical ops.")
 STATISTIC (NumNotSplitIdenticalOperands, "Number of blocks not split due to operands being identical.")
 STATISTIC (NumNotSplitChainCopies, "Number of blocks not split due to operands being chained copies.")
 STATISTIC (NumNotSplitWrongOpcode, "Number of blocks not split due to the wrong opcode.")
static void updatePHIs (MachineBasicBlock *Successor, MachineBasicBlock *OrigMBB, MachineBasicBlock *NewMBB, MachineRegisterInfo *MRI)
 Given a basic block Successor that potentially contains PHIs, this function will look for any incoming values in the PHIs that are supposed to be coming from OrigMBB but whose definition is actually in NewMBB.
static void addIncomingValuesToPHIs (MachineBasicBlock *Successor, MachineBasicBlock *OrigMBB, MachineBasicBlock *NewMBB, MachineRegisterInfo *MRI)
 Given a basic block Successor that potentially contains PHIs, this function will look for PHIs that have an incoming value from OrigMBB and will add the same incoming value from NewMBB.
static bool splitMBB (BlockSplitInfo &BSI)
 Splits a MachineBasicBlock to branch before SplitBefore.
static bool isBinary (MachineInstr &MI)
static bool isNullary (MachineInstr &MI)
static void computeBranchTargetAndInversion (unsigned CROp, unsigned BROp, bool UsingDef1, bool &InvertNewBranch, bool &InvertOrigBranch, bool &TargetIsFallThrough)
 Given a CR logical operation CROp, branch opcode BROp as well as a flag to indicate if the first operand of CROp is used as the SplitBefore operand, determines whether either of the branches are to be inverted as well as whether the new target should be the original fall-through block.
 INITIALIZE_PASS_BEGIN (PPCReduceCRLogicals, DEBUG_TYPE, "PowerPC Reduce CR logical Operation", false, false) INITIALIZE_PASS_END(PPCReduceCRLogicals

Variables

 DEBUG_TYPE
PowerPC Reduce CR logical Operation
PowerPC Reduce CR logical false

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "ppc-reduce-cr-ops"

Definition at line 31 of file PPCReduceCRLogicals.cpp.

Function Documentation

◆ addIncomingValuesToPHIs()

void addIncomingValuesToPHIs ( MachineBasicBlock * Successor,
MachineBasicBlock * OrigMBB,
MachineBasicBlock * NewMBB,
MachineRegisterInfo * MRI )
static

Given a basic block Successor that potentially contains PHIs, this function will look for PHIs that have an incoming value from OrigMBB and will add the same incoming value from NewMBB.

NOTE: This should only be used if NewMBB is an immediate dominator of OrigMBB.

Definition at line 84 of file PPCReduceCRLogicals.cpp.

References llvm::MachineInstrBuilder::addMBB(), llvm::MachineInstrBuilder::addReg(), assert(), llvm::MachineOperand::getMBB(), llvm::MachineBasicBlock::isSuccessor(), MI, MRI, and llvm::Successor.

Referenced by splitMBB().

◆ computeBranchTargetAndInversion()

void computeBranchTargetAndInversion ( unsigned CROp,
unsigned BROp,
bool UsingDef1,
bool & InvertNewBranch,
bool & InvertOrigBranch,
bool & TargetIsFallThrough )
static

Given a CR logical operation CROp, branch opcode BROp as well as a flag to indicate if the first operand of CROp is used as the SplitBefore operand, determines whether either of the branches are to be inverted as well as whether the new target should be the original fall-through block.

Definition at line 275 of file PPCReduceCRLogicals.cpp.

References llvm_unreachable.

◆ INITIALIZE_PASS_BEGIN()

INITIALIZE_PASS_BEGIN ( PPCReduceCRLogicals ,
DEBUG_TYPE ,
"PowerPC Reduce CR logical Operation" ,
false ,
false  )

◆ isBinary()

bool isBinary ( MachineInstr & MI)
static

Definition at line 261 of file PPCReduceCRLogicals.cpp.

References MI.

Referenced by optimizeDoubleFP().

◆ isNullary()

bool isNullary ( MachineInstr & MI)
static

Definition at line 265 of file PPCReduceCRLogicals.cpp.

References MI.

◆ splitMBB()

bool splitMBB ( BlockSplitInfo & BSI)
static

Splits a MachineBasicBlock to branch before SplitBefore.

The original branch is OrigBranch. The target of the new branch can either be the same as the target of the original branch or the fallthrough successor of the original block as determined by BranchToFallThrough. The branch conditions will be inverted according to InvertNewBranch and InvertOrigBranch. If an instruction that previously fed the branch is to be deleted, it is provided in MIToDelete and NewCond will be used as the branch condition. The branch probabilities will be set if the MachineBranchProbabilityInfo isn't null.

Definition at line 143 of file PPCReduceCRLogicals.cpp.

References addIncomingValuesToPHIs(), llvm::MachineInstrBuilder::addMBB(), llvm::MachineInstrBuilder::addReg(), llvm::MachineBasicBlock::addSuccessor(), assert(), llvm::MachineBasicBlock::back(), llvm::BuildMI(), llvm::MachineFunction::CreateMachineBasicBlock(), llvm::dbgs(), llvm::MachineBasicBlock::dump(), llvm::MachineBasicBlock::end(), llvm::MachineInstr::eraseFromParent(), llvm::find(), llvm::MachineBasicBlock::getBasicBlock(), llvm::BranchProbability::getCompl(), llvm::MachineInstr::getDebugLoc(), llvm::MachineBranchProbabilityInfo::getEdgeProbability(), llvm::MachineBasicBlock::getFirstTerminator(), llvm::ilist_node_impl< OptionsT >::getIterator(), llvm::MachineOperand::getMBB(), llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getOperand(), llvm::MachineBasicBlock::getParent(), llvm::MachineInstr::getParent(), llvm::MachineOperand::getReg(), llvm::MachineFunction::getRegInfo(), llvm::MachineFunction::getSubtarget(), llvm::BranchProbability::getUnknown(), llvm::MachineFunction::insert(), llvm::BranchProbability::isUnknown(), LLVM_DEBUG, MBBI, MRI, llvm::MachineBasicBlock::setCallFrameSize(), llvm::MachineBasicBlock::setSuccProbability(), llvm::MachineBasicBlock::splice(), llvm::MachineBasicBlock::succ_begin(), llvm::MachineBasicBlock::succ_rbegin(), llvm::MachineBasicBlock::succ_size(), llvm::MachineBasicBlock::successors(), TII, llvm::MachineBasicBlock::transferSuccessors(), and updatePHIs().

◆ STATISTIC() [1/10]

STATISTIC ( NumBlocksSplitOnBinaryCROp ,
"Number of blocks split on CR binary logical ops."  )

◆ STATISTIC() [2/10]

STATISTIC ( NumContainedSingleUseBinOps ,
"Number of single-use binary CR logical ops contained in a block"  )

◆ STATISTIC() [3/10]

STATISTIC ( NumNotSplitChainCopies ,
"Number of blocks not split due to operands being chained copies."  )

◆ STATISTIC() [4/10]

STATISTIC ( NumNotSplitIdenticalOperands ,
"Number of blocks not split due to operands being identical."  )

◆ STATISTIC() [5/10]

STATISTIC ( NumNotSplitWrongOpcode ,
"Number of blocks not split due to the wrong opcode."  )

◆ STATISTIC() [6/10]

STATISTIC ( NumToSplitBlocks ,
"Number of binary CR logical ops that can be used to split blocks"  )

◆ STATISTIC() [7/10]

STATISTIC ( TotalBinaryCRLogicals ,
"Number of CR logical ops."  )

◆ STATISTIC() [8/10]

STATISTIC ( TotalCRLogicals ,
"Number of CR logical ops."  )

◆ STATISTIC() [9/10]

STATISTIC ( TotalNullaryCRLogicals ,
"Number of nullary CR logical ops (CRSET/CRUNSET)."  )

◆ STATISTIC() [10/10]

STATISTIC ( TotalUnaryCRLogicals ,
"Number of unary CR logical ops."  )

◆ updatePHIs()

void updatePHIs ( MachineBasicBlock * Successor,
MachineBasicBlock * OrigMBB,
MachineBasicBlock * NewMBB,
MachineRegisterInfo * MRI )
static

Given a basic block Successor that potentially contains PHIs, this function will look for any incoming values in the PHIs that are supposed to be coming from OrigMBB but whose definition is actually in NewMBB.

Any such PHIs will be updated to reflect reality.

Definition at line 55 of file PPCReduceCRLogicals.cpp.

References DefMI, llvm::MachineOperand::getMBB(), llvm::MachineBasicBlock::isSuccessor(), MI, MRI, llvm::MachineOperand::setMBB(), and llvm::Successor.

Referenced by splitMBB().

Variable Documentation

◆ DEBUG_TYPE

DEBUG_TYPE

Definition at line 734 of file PPCReduceCRLogicals.cpp.

◆ false

PowerPC Reduce CR logical false

Definition at line 735 of file PPCReduceCRLogicals.cpp.

◆ Operation