LLVM API Documentation
#include "llvm/Transforms/Scalar.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/ValueMap.h"
#include "llvm/Analysis/DominatorInternals.h"
#include "llvm/Analysis/Dominators.h"
#include "llvm/Analysis/InstructionSimplify.h"
#include "llvm/Assembly/Writer.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/InlineAsm.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/Pass.h"
#include "llvm/Support/CallSite.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/GetElementPtrTypeIterator.h"
#include "llvm/Support/PatternMatch.h"
#include "llvm/Support/ValueHandle.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetLibraryInfo.h"
#include "llvm/Target/TargetLowering.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
#include "llvm/Transforms/Utils/BuildLibCalls.h"
#include "llvm/Transforms/Utils/BypassSlowDivision.h"
#include "llvm/Transforms/Utils/Local.h"
Go to the source code of this file.
Macros | |
#define | DEBUG_TYPE "codegenprepare" |
Functions | |
STATISTIC (NumBlocksElim,"Number of blocks eliminated") | |
STATISTIC (NumPHIsElim,"Number of trivial PHIs eliminated") | |
STATISTIC (NumGEPsElim,"Number of GEPs converted to casts") | |
STATISTIC (NumCmpUses,"Number of uses of Cmp expressions replaced with uses of ""sunken Cmps") | |
STATISTIC (NumCastUses,"Number of uses of Cast expressions replaced with uses ""of sunken Casts") | |
STATISTIC (NumMemoryInsts,"Number of memory instructions whose address ""computations were sunk") | |
STATISTIC (NumExtsMoved,"Number of [s|z]ext instructions combined with loads") | |
STATISTIC (NumExtUses,"Number of uses of [s|z]ext instructions optimized") | |
STATISTIC (NumRetsDup,"Number of return instructions duplicated") | |
STATISTIC (NumDbgValueMoved,"Number of debug value instructions moved") | |
STATISTIC (NumSelectsExpanded,"Number of selects turned into branches") | |
INITIALIZE_PASS_BEGIN (CodeGenPrepare,"codegenprepare","Optimize for code generation", false, false) INITIALIZE_PASS_END(CodeGenPrepare | |
static bool | OptimizeNoopCopyExpression (CastInst *CI, const TargetLowering &TLI) |
static bool | OptimizeCmpExpression (CmpInst *CI) |
static bool | IsNonLocalValue (Value *V, BasicBlock *BB) |
static bool | isFormingBranchFromSelectProfitable (SelectInst *SI) |
Variables | |
static cl::opt< bool > | DisableBranchOpts ("disable-cgp-branch-opts", cl::Hidden, cl::init(false), cl::desc("Disable branch optimizations in CodeGenPrepare")) |
static cl::opt< bool > | DisableSelectToBranch ("disable-cgp-select2branch", cl::Hidden, cl::init(false), cl::desc("Disable select to branch conversion.")) |
codegenprepare | |
Optimize for code | generation |
Optimize for code | false |
#define DEBUG_TYPE "codegenprepare" |
Definition at line 16 of file CodeGenPrepare.cpp.
INITIALIZE_PASS_BEGIN | ( | CodeGenPrepare | , |
"codegenprepare" | , | ||
"Optimize for code generation" | , | ||
false | , | ||
false | |||
) |
|
static |
isFormingBranchFromSelectProfitable - Returns true if a SelectInst should be turned into an explicit branch.
Definition at line 1797 of file CodeGenPrepare.cpp.
References llvm::dyn_cast(), llvm::SelectInst::getCondition(), llvm::User::getOperand(), and llvm::Value::hasOneUse().
|
static |
IsNonLocalValue - Return true if the specified values are defined in a different basic block than BB.
Definition at line 1442 of file CodeGenPrepare.cpp.
References llvm::Instruction::getParent().
OptimizeCmpExpression - sink the given CmpInst into user blocks to reduce the number of virtual registers that must be created and coalesced. This is a clear win except on targets with multiple condition code registers (PowerPC), where it might lose; some adjustment may be wanted there.
Return true if any changes are made.
InsertedCmp - Only insert a cmp in each block once.
Definition at line 536 of file CodeGenPrepare.cpp.
References llvm::CmpInst::Create(), llvm::Instruction::eraseFromParent(), llvm::BasicBlock::getFirstInsertionPt(), llvm::CmpInst::getOpcode(), llvm::User::getOperand(), llvm::Instruction::getParent(), llvm::CmpInst::getPredicate(), llvm::Value::use_begin(), llvm::Value::use_empty(), and llvm::Value::use_end().
|
static |
OptimizeNoopCopyExpression - If the specified cast instruction is a noop copy (e.g. it's casting from one pointer type to another, i32->i8 on PPC), sink it into user blocks to reduce the number of virtual registers that must be created and coalesced.
Return true if any changes are made.
InsertedCasts - Only insert a cast in each block once.
Definition at line 454 of file CodeGenPrepare.cpp.
References llvm::EVT::bitsLT(), llvm::CastInst::Create(), llvm::Instruction::eraseFromParent(), llvm::Value::getContext(), llvm::BasicBlock::getFirstInsertionPt(), llvm::PHINode::getIncomingBlock(), llvm::CastInst::getOpcode(), llvm::User::getOperand(), llvm::Instruction::getParent(), llvm::Value::getType(), llvm::TargetLoweringBase::getTypeAction(), llvm::TargetLoweringBase::getTypeToTransformTo(), llvm::TargetLoweringBase::getValueType(), llvm::EVT::isInteger(), llvm::TargetLoweringBase::TypePromoteInteger, llvm::Value::use_begin(), llvm::Value::use_empty(), and llvm::Value::use_end().
STATISTIC | ( | NumBlocksElim | , |
"Number of blocks eliminated" | |||
) |
STATISTIC | ( | NumPHIsElim | , |
"Number of trivial PHIs eliminated" | |||
) |
STATISTIC | ( | NumGEPsElim | , |
"Number of GEPs converted to casts" | |||
) |
STATISTIC | ( | NumCmpUses | , |
"Number of uses of Cmp expressions replaced with uses of ""sunken Cmps" | |||
) |
STATISTIC | ( | NumCastUses | , |
"Number of uses of Cast expressions replaced with uses ""of sunken Casts" | |||
) |
STATISTIC | ( | NumMemoryInsts | , |
"Number of memory instructions whose address ""computations were sunk" | |||
) |
STATISTIC | ( | NumExtsMoved | , |
"Number of ext instructions combined with loads" | [s|z] | ||
) |
STATISTIC | ( | NumExtUses | , |
"Number of uses of ext instructions optimized" | [s|z] | ||
) |
STATISTIC | ( | NumRetsDup | , |
"Number of return instructions duplicated" | |||
) |
STATISTIC | ( | NumDbgValueMoved | , |
"Number of debug value instructions moved" | |||
) |
STATISTIC | ( | NumSelectsExpanded | , |
"Number of selects turned into branches" | |||
) |
codegenprepare |
Definition at line 137 of file CodeGenPrepare.cpp.
|
static |
|
static |
Optimize for code false |
Definition at line 137 of file CodeGenPrepare.cpp.
Optimize for code generation |
Definition at line 137 of file CodeGenPrepare.cpp.