LLVM 20.0.0git
|
#include "PPC.h"
#include "PPCInstrInfo.h"
#include "PPCTargetMachine.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/CodeGen/MachineBranchProbabilityInfo.h"
#include "llvm/CodeGen/MachineDominators.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/InitializePasses.h"
#include "llvm/Support/Debug.h"
Go to the source code of this file.
Classes | |
struct | BlockSplitInfo |
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 |
#define DEBUG_TYPE "ppc-reduce-cr-ops" |
Definition at line 32 of file PPCReduceCRLogicals.cpp.
|
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 85 of file PPCReduceCRLogicals.cpp.
References llvm::MachineInstrBuilder::addMBB(), llvm::MachineInstrBuilder::addReg(), assert(), llvm::MachineOperand::getMBB(), llvm::MachineBasicBlock::isSuccessor(), MI, and llvm::Successor.
Referenced by splitMBB().
|
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 267 of file PPCReduceCRLogicals.cpp.
References llvm_unreachable.
INITIALIZE_PASS_BEGIN | ( | PPCReduceCRLogicals | , |
DEBUG_TYPE | , | ||
"PowerPC Reduce CR logical Operation" | , | ||
false | , | ||
false | |||
) |
|
static |
Definition at line 253 of file PPCReduceCRLogicals.cpp.
References MI.
Referenced by optimizeDoubleFP().
|
static |
Definition at line 257 of file PPCReduceCRLogicals.cpp.
References MI.
|
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 140 of file PPCReduceCRLogicals.cpp.
References addIncomingValuesToPHIs(), llvm::MachineInstrBuilder::addMBB(), llvm::MachineInstrBuilder::addReg(), llvm::MachineBasicBlock::addSuccessor(), BlockSplitInfo::allInstrsInSameMBB(), assert(), BlockSplitInfo::BranchToFallThrough, 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(), BlockSplitInfo::InvertNewBranch, BlockSplitInfo::InvertOrigBranch, llvm::BranchProbability::isUnknown(), LLVM_DEBUG, MBBI, BlockSplitInfo::MBPI, BlockSplitInfo::MIToDelete, MRI, BlockSplitInfo::NewCond, BlockSplitInfo::OrigBranch, llvm::MachineBasicBlock::setSuccProbability(), llvm::MachineBasicBlock::splice(), BlockSplitInfo::SplitBefore, BlockSplitInfo::SplitCond, llvm::MachineBasicBlock::succ_begin(), llvm::MachineBasicBlock::succ_rbegin(), llvm::MachineBasicBlock::succ_size(), llvm::MachineBasicBlock::successors(), TII, llvm::MachineBasicBlock::transferSuccessors(), and updatePHIs().
STATISTIC | ( | NumBlocksSplitOnBinaryCROp | , |
"Number of blocks split on CR binary logical ops." | |||
) |
STATISTIC | ( | NumContainedSingleUseBinOps | , |
"Number of single-use binary CR logical ops contained in a block" | |||
) |
STATISTIC | ( | NumNotSplitChainCopies | , |
"Number of blocks not split due to operands being chained copies." | |||
) |
STATISTIC | ( | NumNotSplitIdenticalOperands | , |
"Number of blocks not split due to operands being identical." | |||
) |
STATISTIC | ( | NumNotSplitWrongOpcode | , |
"Number of blocks not split due to the wrong opcode." | |||
) |
STATISTIC | ( | NumToSplitBlocks | , |
"Number of binary CR logical ops that can be used to split blocks" | |||
) |
STATISTIC | ( | TotalBinaryCRLogicals | , |
"Number of CR logical ops." | |||
) |
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." | |||
) |
|
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 56 of file PPCReduceCRLogicals.cpp.
References DefMI, llvm::MachineOperand::getMBB(), llvm::MachineInstr::getParent(), llvm::MachineBasicBlock::isSuccessor(), MI, MRI, llvm::MachineOperand::setMBB(), and llvm::Successor.
Referenced by splitMBB().
DEBUG_TYPE |
Definition at line 734 of file PPCReduceCRLogicals.cpp.
PowerPC Reduce CR logical false |
Definition at line 735 of file PPCReduceCRLogicals.cpp.
PowerPC Reduce CR logical Operation |
Definition at line 735 of file PPCReduceCRLogicals.cpp.
Referenced by llvm::AtomicRMWInst::AtomicRMWInst(), llvm::MCCFIInstruction::getAddressSpace(), llvm::MCCFIInstruction::getCfiLabel(), llvm::MCCFIInstruction::getOffset(), llvm::MCCFIInstruction::getOperation(), llvm::MCCFIInstruction::getRegister(), llvm::MCCFIInstruction::getRegister2(), getSetCCInverseImpl(), llvm::ISD::getSetCCSwappedOperands(), llvm::MCCFIInstruction::getValues(), llvm::ARMTargetLowering::isComplexDeinterleavingOperationSupported(), LowerINTRINSIC_W_CHAIN(), llvm::logicalview::LVLocationSymbol::printExtra(), llvm::logicalview::LVLocationSymbol::printRawExtra(), llvm::AtomicRMWInst::setOperation(), llvm::ScalarEvolution::willNotOverflow(), and writeDWARFExpression().