LLVM API Documentation

IfConversion.cpp File Reference

#include "llvm/Function.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/Target/TargetInstrInfo.h"
#include "llvm/Target/TargetLowering.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/ADT/DepthFirstIterator.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/STLExtras.h"

Include dependency graph for IfConversion.cpp:

Go to the source code of this file.

Defines

#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 (NumIfConvBBs,"Number of if-converted blocks")
 STATISTIC (NumDupBBs,"Number of duplicated blocks")
FunctionPass * llvm::createIfConverterPass ()
 IfConverter Pass - This pass performs machine code if conversion.
static MachineBasicBlock * findFalseBlock (MachineBasicBlock *BB, MachineBasicBlock *TrueBB)
static MachineBasicBlock * getNextBlock (MachineBasicBlock *BB)
static MachineBasicBlock::iterator firstNonBranchInst (MachineBasicBlock *BB, const TargetInstrInfo *TII)
static bool canFallThroughTo (MachineBasicBlock *BB, MachineBasicBlock *ToBB)
static void InsertUncondBranch (MachineBasicBlock *BB, MachineBasicBlock *ToBB, const TargetInstrInfo *TII)

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 RegisterPass< IfConverter > X ("if-converter","If Converter")


Define Documentation

#define DEBUG_TYPE   "ifcvt"

Definition at line 14 of file IfConversion.cpp.


Function Documentation

static bool canFallThroughTo ( MachineBasicBlock *  BB,
MachineBasicBlock *  ToBB 
) [static]

canFallThroughTo - Returns true either if ToBB is the next block after BB or that all the intervening blocks are empty (given BB can fall through to its next block).

Definition at line 803 of file IfConversion.cpp.

References E, llvm::MachineFunction::end(), and llvm::MachineBasicBlock::getParent().

static MachineBasicBlock* findFalseBlock ( MachineBasicBlock *  BB,
MachineBasicBlock *  TrueBB 
) [static]

findFalseBlock - BB has a fallthrough. Find its 'false' successor given its 'true' successor.

Definition at line 368 of file IfConversion.cpp.

References E, llvm::MachineBasicBlock::succ_begin(), and llvm::MachineBasicBlock::succ_end().

static MachineBasicBlock::iterator firstNonBranchInst ( MachineBasicBlock *  BB,
const TargetInstrInfo *  TII 
) [static]

static MachineBasicBlock* getNextBlock ( MachineBasicBlock *  BB  )  [inline, static]

getNextBlock - Returns the next block in the function blocks ordering. If it is the end, returns NULL.

Definition at line 393 of file IfConversion.cpp.

References E, llvm::MachineFunction::end(), and llvm::MachineBasicBlock::getParent().

static void InsertUncondBranch ( MachineBasicBlock *  BB,
MachineBasicBlock *  ToBB,
const TargetInstrInfo *  TII 
) [static]

InsertUncondBranch - Inserts an unconditional branch from BB to ToBB.

Definition at line 829 of file IfConversion.cpp.

References llvm::TargetInstrInfo::InsertBranch().

STATISTIC ( NumDupBBs  ,
"Number of duplicated blocks"   
)

STATISTIC ( NumIfConvBBs  ,
"Number of if-converted blocks"   
)

STATISTIC ( NumDiamonds  ,
"Number of diamond if-conversions performed"   
)

STATISTIC ( NumTriangleFRev  ,
"Number of triangle (F/R) if-conversions performed"   
)

STATISTIC ( NumTriangleFalse  ,
"Number of triangle (F) if-conversions performed"   
)

STATISTIC ( NumTriangleRev  ,
"Number of triangle (R) if-conversions performed"   
)

STATISTIC ( NumTriangle  ,
"Number of triangle if-conversions performed"   
)

STATISTIC ( NumSimpleFalse  ,
"Number of simple (F) if-conversions performed"   
)

STATISTIC ( NumSimple  ,
"Number of simple if-conversions performed"   
)


Variable Documentation

Definition at line 105 of file IfConversion.cpp.

Referenced by AddBlockAndPredsToSet(), ApproximateLoopSize(), llvm::DominanceFrontier::calculate(), ChangeToCall(), ChangeToUnreachable(), llvm::CloneFunctionInto(), llvm::CloneLoop(), llvm::CloneTrace(), llvm::CloneTraceInto(), llvm::DominatorTreeBase< llvm::MachineBasicBlock >::compare(), createSlotTracker(), llvm::LPPassManager::deleteSimpleAnalysisValue(), llvm::DFSPass(), llvm::SelectionDAGLowering::EmitBranchForMergedCondition(), llvm::FindFunctionBackedges(), llvm::findStopPoint(), llvm::FoldBranchToCommonDest(), FoldCondBranchOnPHI(), FoldTwoEntryPHINode(), FoldValueComparisonIntoPredecessors(), llvm::MachineBasicBlock::getBasicBlock(), getModuleFromVal(), getSymTab(), HandleInlinedInvoke(), llvm::ValueEnumerator::incorporateFunction(), llvm::InlineFunction(), llvm::BasicInlinerImpl::inlineFunctions(), llvm::Loop::isLCSSAForm(), isUsedOutsideOfDefiningBlock(), LinkFunctionBody(), LLVMInsertBasicBlockInContext(), LLVMPositionBuilder(), LLVMPositionBuilderAtEnd(), llvm::MachineFunction::print(), llvm::LoopBase< llvm::MachineBasicBlock, llvm::MachineLoop >::print(), llvm::AsmPrinter::printBasicBlockLabel(), llvm::MSILWriter::printLoop(), llvm::RemoveSuccessor(), RemoveUnreachableBlocksFromFn(), llvm::UnifyFunctionExitNodes::runOnFunction(), llvm::DebugLabelFolder::runOnMachineFunction(), llvm::Inliner::runOnSCC(), llvm::FunctionLoweringInfo::set(), SimplifyCondBranchToCondBranch(), ThunkGToF(), llvm::UnrollLoop(), llvm::ValueEnumerator::ValueEnumerator(), and WriteFunction().

std::vector<BBInfo> BBAnalysis

BBAnalysis - Results of if-conversion feasibility analysis indexed by basic block number.

Definition at line 144 of file IfConversion.cpp.

BBInfo& BBI

Definition at line 102 of file IfConversion.cpp.

Definition at line 103 of file IfConversion.cpp.

cl::opt<bool> DisableDiamond("disable-ifcvt-diamond", cl::init(false), 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> 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> DisableTriangleR("disable-ifcvt-triangle-rev", cl::init(false), cl::Hidden) [static]

Definition at line 107 of file IfConversion.cpp.

int FnNum

Definition at line 149 of file IfConversion.cpp.

Definition at line 100 of file IfConversion.cpp.

char ID [static]

Definition at line 151 of file IfConversion.cpp.

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]

Definition at line 97 of file IfConversion.cpp.

Definition at line 96 of file IfConversion.cpp.

Definition at line 99 of file IfConversion.cpp.

Definition at line 95 of file IfConversion.cpp.

Definition at line 98 of file IfConversion.cpp.

Definition at line 101 of file IfConversion.cpp.

IfcvtKind Kind

Definition at line 148 of file IfConversion.cpp.

Definition at line 131 of file IfConversion.cpp.

Definition at line 104 of file IfConversion.cpp.

Definition at line 132 of file IfConversion.cpp.

Definition at line 133 of file IfConversion.cpp.

Definition at line 109 of file IfConversion.cpp.

std::vector<MachineBasicBlock*> Roots

Roots - Basic blocks that do not have successors. These are the starting points of Graph traversal.

Definition at line 140 of file IfConversion.cpp.

Definition at line 147 of file IfConversion.cpp.

Definition at line 146 of file IfConversion.cpp.

Definition at line 106 of file IfConversion.cpp.

RegisterPass<IfConverter> X("if-converter","If Converter") [static]