LLVM  4.0.0
Macros | Functions | Variables
SCCP.cpp File Reference
#include "llvm/Transforms/IPO/SCCP.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/PointerIntPair.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/ConstantFolding.h"
#include "llvm/Analysis/GlobalsModRef.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/IR/CallSite.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/InstVisitor.h"
#include "llvm/IR/Instructions.h"
#include "llvm/Pass.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Transforms/IPO.h"
#include "llvm/Transforms/Scalar.h"
#include "llvm/Transforms/Scalar/SCCP.h"
#include "llvm/Transforms/Utils/Local.h"
#include <algorithm>
Include dependency graph for SCCP.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "sccp"
 

Functions

 STATISTIC (NumInstRemoved,"Number of instructions removed")
 
 STATISTIC (NumDeadBlocks,"Number of basic blocks unreachable")
 
 STATISTIC (IPNumInstRemoved,"Number of instructions removed by IPSCCP")
 
 STATISTIC (IPNumArgsElimed,"Number of arguments constant propagated by IPSCCP")
 
 STATISTIC (IPNumGlobalConst,"Number of globals found to be constant by IPSCCP")
 
static bool tryToReplaceWithConstant (SCCPSolver &Solver, Value *V)
 
static bool runSCCP (Function &F, const DataLayout &DL, const TargetLibraryInfo *TLI)
 
 INITIALIZE_PASS_BEGIN (SCCPLegacyPass,"sccp","Sparse Conditional Constant Propagation", false, false) INITIALIZE_PASS_END(SCCPLegacyPass
 
static bool AddressIsTaken (const GlobalValue *GV)
 
static void findReturnsToZap (Function &F, SmallPtrSet< Function *, 32 > &AddressTakenFunctions, SmallVector< ReturnInst *, 8 > &ReturnsToZap)
 
static bool runIPSCCP (Module &M, const DataLayout &DL, const TargetLibraryInfo *TLI)
 
 INITIALIZE_PASS_BEGIN (IPSCCPLegacyPass,"ipsccp","Interprocedural Sparse Conditional Constant Propagation", false, false) INITIALIZE_PASS_END(IPSCCPLegacyPass
 

Variables

 sccp
 
Sparse Conditional Constant Propagation
 
Sparse Conditional Constant false
 
 ipsccp
 

Macro Definition Documentation

#define DEBUG_TYPE   "sccp"

Definition at line 47 of file SCCP.cpp.

Function Documentation

static bool AddressIsTaken ( const GlobalValue GV)
static
static void findReturnsToZap ( Function F,
SmallPtrSet< Function *, 32 > &  AddressTakenFunctions,
SmallVector< ReturnInst *, 8 > &  ReturnsToZap 
)
static
INITIALIZE_PASS_BEGIN ( SCCPLegacyPass  ,
"sccp"  ,
"Sparse Conditional Constant Propagation ,
false  ,
false   
)
INITIALIZE_PASS_BEGIN ( IPSCCPLegacyPass  ,
"ipsccp"  ,
"Interprocedural Sparse Conditional Constant Propagation ,
false  ,
false   
)
static bool runIPSCCP ( Module M,
const DataLayout DL,
const TargetLibraryInfo TLI 
)
static

Definition at line 1688 of file SCCP.cpp.

References AddressIsTaken(), llvm::Function::arg_begin(), llvm::Function::arg_end(), llvm::Function::args(), assert(), llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::begin(), llvm::Function::begin(), llvm::changeToUnreachable(), llvm::SmallVectorImpl< T >::clear(), llvm::ConstantFoldTerminator(), llvm::BranchInst::Create(), llvm::dbgs(), DEBUG, llvm::dyn_cast(), E, llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::Function::end(), llvm::iplist_impl< IntrusiveListT, TraitsT >::erase(), llvm::Instruction::eraseFromParent(), findReturnsToZap(), llvm::Function::front(), G, llvm::UndefValue::get(), llvm::Function::getBasicBlockList(), llvm::Value::getName(), llvm::TerminatorInst::getNumSuccessors(), llvm::Instruction::getParent(), llvm::Function::getReturnType(), llvm::TerminatorInst::getSuccessor(), llvm::Value::getType(), llvm::GlobalValue::hasExactDefinition(), llvm::Function::hasFnAttribute(), llvm::GlobalValue::hasLocalLinkage(), I, i, llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::GlobalValue::isDeclaration(), llvm::Type::isStructTy(), llvm::Type::isVoidTy(), llvm_unreachable, llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), llvm::BasicBlock::removePredecessor(), llvm::SmallVectorTemplateCommon< T >::size(), tryToReplaceWithConstant(), llvm::Value::use_empty(), llvm::Value::user_back(), llvm::Value::user_begin(), and llvm::Value::user_end().

Referenced by llvm::IPSCCPPass::run().

static bool runSCCP ( Function F,
const DataLayout DL,
const TargetLibraryInfo TLI 
)
static
STATISTIC ( NumInstRemoved  ,
"Number of instructions removed"   
)
STATISTIC ( NumDeadBlocks  ,
"Number of basic blocks unreachable"   
)
STATISTIC ( IPNumInstRemoved  ,
"Number of instructions removed by IPSCCP"   
)
STATISTIC ( IPNumArgsElimed  ,
"Number of arguments constant propagated by IPSCCP"   
)
STATISTIC ( IPNumGlobalConst  ,
"Number of globals found to be constant by IPSCCP"   
)
static bool tryToReplaceWithConstant ( SCCPSolver &  Solver,
Value V 
)
static

Variable Documentation

Interprocedural Sparse Conditional Constant false

Definition at line 1642 of file SCCP.cpp.

ipsccp

Definition at line 1950 of file SCCP.cpp.

Interprocedural Sparse Conditional Constant Propagation

Definition at line 1642 of file SCCP.cpp.

sccp

Definition at line 1642 of file SCCP.cpp.