LLVM
8.0.1
|
#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/Support/Debug.h"
Go to the source code of this file.
Classes | |
struct | BlockSplitInfo |
Namespaces | |
llvm | |
This class represents lattice values for constants. | |
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.") | |
void | llvm::initializePPCReduceCRLogicalsPass (PassRegistry &) |
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 . More... | |
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 . More... | |
static bool | splitMBB (BlockSplitInfo &BSI) |
Splits a MachineBasicBlock to branch before SplitBefore . More... | |
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. More... | |
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 |
Definition at line 32 of file PPCReduceCRLogicals.cpp.
Referenced by computeBranchTargetAndInversion().
|
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 89 of file PPCReduceCRLogicals.cpp.
References llvm::MachineInstrBuilder::addReg(), assert(), llvm::MachineOperand::getMBB(), llvm::MachineBasicBlock::instrs(), llvm::MachineBasicBlock::isSuccessor(), and MI.
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 242 of file PPCReduceCRLogicals.cpp.
References llvm::AnalysisUsage::addRequired(), assert(), B, llvm::MachineBasicBlock::begin(), llvm::MCID::Branch, llvm::PPCISD::CR6SET, llvm::PPCISD::CR6UNSET, llvm::dbgs(), DEBUG_TYPE, llvm::Pass::dump(), dump(), llvm::dump(), llvm::MachineInstr::dump(), E, llvm::MachineFunctionPass::getAnalysisUsage(), llvm::MachineBasicBlock::getFirstTerminator(), llvm::MachineFunction::getFunction(), llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getOperand(), llvm::MachineInstr::getParent(), getParent(), llvm::PassRegistry::getPassRegistry(), llvm::MachineOperand::getReg(), llvm::MachineOperand::getSubReg(), llvm::MachineFunction::getSubtarget(), initialize(), INITIALIZE_PASS_BEGIN(), INITIALIZE_PASS_DEPENDENCY, llvm::initializePPCReduceCRLogicalsPass(), isBinary(), llvm::MachineInstr::isCopy(), isNullary(), llvm::TargetRegisterInfo::isVirtualRegister(), LLVM_DEBUG, LLVM_DUMP_METHOD, llvm_unreachable, MI, MRI, Reg, llvm::MipsISD::Ret, llvm::MachineBasicBlock::splice(), splitMBB(), TII, TRI, llvm::PPCSubtarget::useCRBits(), and UseMI.
INITIALIZE_PASS_BEGIN | ( | PPCReduceCRLogicals | , |
DEBUG_TYPE | , | ||
"PowerPC Reduce CR logical Operation" | , | ||
false | , | ||
false | |||
) |
Referenced by computeBranchTargetAndInversion().
|
static |
Definition at line 228 of file PPCReduceCRLogicals.cpp.
References llvm::MachineInstr::getNumOperands().
Referenced by computeBranchTargetAndInversion().
|
static |
Definition at line 232 of file PPCReduceCRLogicals.cpp.
References llvm::MachineInstr::getNumOperands().
Referenced by computeBranchTargetAndInversion().
|
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 144 of file PPCReduceCRLogicals.cpp.
References addIncomingValuesToPHIs(), BlockSplitInfo::allInstrsInSameMBB(), assert(), B, BlockSplitInfo::BranchToFallThrough, llvm::BuildMI(), llvm::MachineFunction::CreateMachineBasicBlock(), llvm::dbgs(), llvm::MachineBasicBlock::dump(), llvm::MachineBasicBlock::end(), llvm::MachineInstr::eraseFromParent(), llvm::BranchProbability::getCompl(), llvm::MachineInstr::getDebugLoc(), llvm::MachineBranchProbabilityInfo::getEdgeProbability(), llvm::MachineBasicBlock::getFirstTerminator(), llvm::MachineOperand::getMBB(), llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getOperand(), llvm::MachineInstr::getParent(), llvm::MachineOperand::getReg(), llvm::MachineFunction::getRegInfo(), llvm::MachineFunction::getSubtarget(), llvm::BranchProbability::getUnknown(), llvm::MachineFunction::insert(), BlockSplitInfo::InvertNewBranch, BlockSplitInfo::InvertOrigBranch, llvm::MachineRegisterInfo::isSSA(), LLVM_DEBUG, BlockSplitInfo::MBPI, BlockSplitInfo::MIToDelete, MRI, BlockSplitInfo::NewCond, BlockSplitInfo::OrigBranch, llvm::MachineBasicBlock::splice(), BlockSplitInfo::SplitBefore, BlockSplitInfo::SplitCond, llvm::MachineBasicBlock::succ_begin(), llvm::MachineBasicBlock::successors(), TII, llvm::MachineBasicBlock::transferSuccessors(), and updatePHIs().
Referenced by computeBranchTargetAndInversion(), and getNonDebugInstr().
STATISTIC | ( | NumContainedSingleUseBinOps | , |
"Number of single-use binary CR logical ops contained in a block" | |||
) |
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 |
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 60 of file PPCReduceCRLogicals.cpp.
References DefMI, llvm::MachineOperand::getMBB(), llvm::MachineInstr::getParent(), llvm::MachineRegisterInfo::getVRegDef(), llvm::MachineBasicBlock::instrs(), llvm::MachineBasicBlock::isSuccessor(), MI, and llvm::MachineOperand::setMBB().
Referenced by splitMBB().
DEBUG_TYPE |
Definition at line 707 of file PPCReduceCRLogicals.cpp.
PowerPC Reduce CR logical false |
Definition at line 707 of file PPCReduceCRLogicals.cpp.
PowerPC Reduce CR logical Operation |
Definition at line 707 of file PPCReduceCRLogicals.cpp.
Referenced by llvm::AtomicCmpXchgInst::AtomicCmpXchgInst(), llvm::AtomicRMWInst::classof(), encodeCnt(), FindMatchingEpilog(), FunctionNumber(), llvm::MCCFIInstruction::getOperation(), llvm::ISD::getSetCCInverse(), llvm::ISD::getUnorderedFlavor(), LowerINTRINSIC_W_CHAIN(), and useSinCos().