|
LLVM
4.0.0
|
#include "llvm/CodeGen/Passes.h"#include "BranchFolding.h"#include "llvm/ADT/STLExtras.h"#include "llvm/ADT/ScopeExit.h"#include "llvm/ADT/SmallSet.h"#include "llvm/ADT/Statistic.h"#include "llvm/CodeGen/LivePhysRegs.h"#include "llvm/CodeGen/MachineBlockFrequencyInfo.h"#include "llvm/CodeGen/MachineBranchProbabilityInfo.h"#include "llvm/CodeGen/MachineFunctionPass.h"#include "llvm/CodeGen/MachineInstrBuilder.h"#include "llvm/CodeGen/MachineModuleInfo.h"#include "llvm/CodeGen/MachineRegisterInfo.h"#include "llvm/CodeGen/TargetSchedule.h"#include "llvm/Support/CommandLine.h"#include "llvm/Support/Debug.h"#include "llvm/Support/ErrorHandling.h"#include "llvm/Support/raw_ostream.h"#include "llvm/Target/TargetInstrInfo.h"#include "llvm/Target/TargetLowering.h"#include "llvm/Target/TargetRegisterInfo.h"#include "llvm/Target/TargetSubtargetInfo.h"#include <algorithm>#include <utility>Go to the source code of this file.
Macros | |
| #define | DEBUG_TYPE "ifcvt" |
Functions | |
| STATISTIC (NumSimple,"Number of simple if-conversions performed") | |
| STATISTIC (NumSimpleFalse,"Number of simple (F) if-conversions performed") | |
| STATISTIC (NumTriangle,"Number of triangle if-conversions performed") | |
| STATISTIC (NumTriangleRev,"Number of triangle (R) if-conversions performed") | |
| STATISTIC (NumTriangleFalse,"Number of triangle (F) if-conversions performed") | |
| STATISTIC (NumTriangleFRev,"Number of triangle (F/R) if-conversions performed") | |
| STATISTIC (NumDiamonds,"Number of diamond if-conversions performed") | |
| STATISTIC (NumForkedDiamonds,"Number of forked-diamond if-conversions performed") | |
| STATISTIC (NumIfConvBBs,"Number of if-converted blocks") | |
| STATISTIC (NumDupBBs,"Number of duplicated blocks") | |
| STATISTIC (NumUnpred,"Number of true blocks of diamonds unpredicated") | |
| static MachineBasicBlock * | findFalseBlock (MachineBasicBlock *BB, MachineBasicBlock *TrueBB) |
| BB has a fallthrough. Find its 'false' successor given its 'true' successor. More... | |
| static MachineBasicBlock * | getNextBlock (MachineBasicBlock &MBB) |
| Returns the next block in the function blocks ordering. More... | |
| static void | shrinkInclusiveRange (MachineBasicBlock::iterator &Begin, MachineBasicBlock::iterator &It, bool &Empty) |
| Shrink the provided inclusive range by one instruction. More... | |
| static void | verifySameBranchInstructions (MachineBasicBlock *MBB1, MachineBasicBlock *MBB2) |
| static bool | canFallThroughTo (MachineBasicBlock &MBB, MachineBasicBlock &ToMBB) |
| Returns true either if ToMBB is the next block after MBB or that all the intervening blocks are empty (given MBB can fall through to its next block). More... | |
| static void | InsertUncondBranch (MachineBasicBlock &MBB, MachineBasicBlock &ToMBB, const TargetInstrInfo *TII) |
Inserts an unconditional branch from MBB to ToMBB. More... | |
| static void | UpdatePredRedefs (MachineInstr &MI, LivePhysRegs &Redefs) |
| Behaves like LiveRegUnits::StepForward() but also adds implicit uses to all values defined in MI which are also live/used by MI. More... | |
| static void | RemoveKills (MachineInstr &MI, const LivePhysRegs &DontKill) |
Remove kill flags from operands with a registers in the DontKill set. More... | |
| static void | RemoveKills (MachineBasicBlock::iterator I, MachineBasicBlock::iterator E, const LivePhysRegs &DontKill, const MCRegisterInfo &MCRI) |
Walks a range of machine instructions and removes kill flags for registers in the DontKill set. More... | |
| static bool | MaySpeculate (const MachineInstr &MI, SmallSet< unsigned, 4 > &LaterRedefs) |
Variables | |
| static cl::opt< int > | IfCvtFnStart ("ifcvt-fn-start", cl::init(-1), cl::Hidden) |
| static cl::opt< int > | IfCvtFnStop ("ifcvt-fn-stop", cl::init(-1), cl::Hidden) |
| static cl::opt< int > | IfCvtLimit ("ifcvt-limit", cl::init(-1), cl::Hidden) |
| static cl::opt< bool > | DisableSimple ("disable-ifcvt-simple", cl::init(false), cl::Hidden) |
| static cl::opt< bool > | DisableSimpleF ("disable-ifcvt-simple-false", cl::init(false), cl::Hidden) |
| static cl::opt< bool > | DisableTriangle ("disable-ifcvt-triangle", cl::init(false), cl::Hidden) |
| static cl::opt< bool > | DisableTriangleR ("disable-ifcvt-triangle-rev", cl::init(false), cl::Hidden) |
| static cl::opt< bool > | DisableTriangleF ("disable-ifcvt-triangle-false", cl::init(false), cl::Hidden) |
| static cl::opt< bool > | DisableTriangleFR ("disable-ifcvt-triangle-false-rev", cl::init(false), cl::Hidden) |
| static cl::opt< bool > | DisableDiamond ("disable-ifcvt-diamond", cl::init(false), cl::Hidden) |
| static cl::opt< bool > | DisableForkedDiamond ("disable-ifcvt-forked-diamond", cl::init(false), cl::Hidden) |
| static cl::opt< bool > | IfCvtBranchFold ("ifcvt-branch-fold", cl::init(true), cl::Hidden) |
| #define DEBUG_TYPE "ifcvt" |
Definition at line 42 of file IfConversion.cpp.
|
static |
Returns true either if ToMBB is the next block after MBB or that all the intervening blocks are empty (given MBB can fall through to its next block).
Definition at line 1344 of file IfConversion.cpp.
References E, llvm::MachineFunction::end(), llvm::ilist_node_impl< OptionsT >::getIterator(), and llvm::MachineBasicBlock::getParent().
|
static |
BB has a fallthrough. Find its 'false' successor given its 'true' successor.
Definition at line 492 of file IfConversion.cpp.
References llvm::MachineBasicBlock::successors().
|
inlinestatic |
Returns the next block in the function blocks ordering.
If it is the end, returns NULL.
Definition at line 516 of file IfConversion.cpp.
References E, llvm::MachineFunction::end(), llvm::ilist_node_impl< OptionsT >::getIterator(), llvm::MachineBasicBlock::getParent(), and I.
|
static |
Inserts an unconditional branch from MBB to ToMBB.
Definition at line 1372 of file IfConversion.cpp.
References llvm::TargetInstrInfo::insertBranch().
|
static |
Definition at line 2037 of file IfConversion.cpp.
References llvm::SmallSet< T, N, C >::count(), llvm::MachineInstr::isSafeToMove(), llvm::MachineInstr::operands(), and SawStore.
|
static |
Remove kill flags from operands with a registers in the DontKill set.
Definition at line 1450 of file IfConversion.cpp.
References llvm::LivePhysRegs::contains(), and llvm::MachineOperandIteratorBase::isValid().
Referenced by RemoveKills().
|
static |
Walks a range of machine instructions and removes kill flags for registers in the DontKill set.
Definition at line 1461 of file IfConversion.cpp.
References llvm::make_range(), MI, and RemoveKills().
|
inlinestatic |
Shrink the provided inclusive range by one instruction.
If the range was one instruction (It == Begin), It is not modified, but Empty is set to true.
Definition at line 594 of file IfConversion.cpp.
Referenced by verifySameBranchInstructions().
| STATISTIC | ( | NumSimple | , |
| "Number of simple if-conversions performed" | |||
| ) |
| STATISTIC | ( | NumTriangle | , |
| "Number of triangle if-conversions performed" | |||
| ) |
| STATISTIC | ( | NumTriangleRev | , |
| "Number of triangle (R) if-conversions performed" | |||
| ) |
| STATISTIC | ( | NumDiamonds | , |
| "Number of diamond if-conversions performed" | |||
| ) |
| STATISTIC | ( | NumForkedDiamonds | , |
| "Number of forked-diamond if-conversions performed" | |||
| ) |
| STATISTIC | ( | NumIfConvBBs | , |
| "Number of if-converted blocks" | |||
| ) |
| STATISTIC | ( | NumDupBBs | , |
| "Number of duplicated blocks" | |||
| ) |
| STATISTIC | ( | NumUnpred | , |
| "Number of true blocks of diamonds unpredicated" | |||
| ) |
|
static |
Behaves like LiveRegUnits::StepForward() but also adds implicit uses to all values defined in MI which are also live/used by MI.
Definition at line 1389 of file IfConversion.cpp.
References llvm::MachineInstrBuilder::addReg(), assert(), llvm::SparseSet< ValueT, KeyFunctorT, SparseT >::count(), llvm::RegState::Define, llvm::MCRegisterInfo::getNumRegs(), llvm::MachineInstr::getParent(), llvm::MachineBasicBlock::getParent(), llvm::MachineOperand::getParent(), llvm::MachineOperand::getReg(), llvm::TargetSubtargetInfo::getRegisterInfo(), llvm::MachineFunction::getSubtarget(), llvm::RegState::Implicit, llvm::SparseSet< ValueT, KeyFunctorT, SparseT >::insert(), llvm::MachineOperand::isDead(), llvm::MachineOperand::isReg(), llvm::MachineOperand::isRegMask(), llvm::MCRegisterInfo::DiffListIterator::isValid(), llvm::MachineOperand::setIsDead(), and llvm::SparseSet< ValueT, KeyFunctorT, SparseT >::setUniverse().
|
static |
Definition at line 741 of file IfConversion.cpp.
References assert(), llvm::MachineBasicBlock::begin(), llvm::MachineBasicBlock::end(), shrinkInclusiveRange(), and llvm::skipDebugInstructionsBackward().
|
static |
|
static |
|
static |
|
static |
|
static |
1.8.6