LLVM: lib/CodeGen/GlobalMergeFunctions.cpp File Reference (original) (raw)

Go to the source code of this file.

Macros
#define DEBUG_TYPE "global-merge-func"
Functions
STATISTIC (NumMergedFunctions, "Number of functions that are actually merged using function hash")
STATISTIC (NumAnalyzedModues, "Number of modules that are analyzed")
STATISTIC (NumAnalyzedFunctions, "Number of functions that are analyzed")
STATISTIC (NumEligibleFunctions, "Number of functions that are eligible")
static bool isCalleeOperand (const CallBase *CI, unsigned OpIdx)
Returns true if the \OpIdx operand of CI is the callee operand.
static bool canParameterizeCallOperand (const CallBase *CI, unsigned OpIdx)
bool isEligibleFunction (Function *F)
Returns true if function F is eligible for merging.
static bool isEligibleInstructionForConstantSharing (const Instruction *I)
static bool ignoreOp (const Instruction *I, unsigned OpIdx)
static Function * createMergedFunction (FuncMergeInfo &FI, ArrayRef< Type * > ConstParamTypes, const ParamLocsVecTy &ParamLocsVec)
static void createThunk (FuncMergeInfo &FI, ArrayRef< Constant * > Params, Function *ToFunc)
static bool checkConstHashCompatible (const DenseMap< IndexPair, stable_hash > &OldInstOpndIndexToConstHash, const DenseMap< IndexPair, stable_hash > &CurrInstOpndIndexToConstHash)
static bool checkConstLocationCompatible (const StableFunctionMap::StableFunctionEntry &SF, const IndexInstrMap &IndexInstruction, const ParamLocsVecTy &ParamLocsVec)
static ParamLocsVecTy computeParamInfo (const StableFunctionMap::StableFunctionEntries &SFS)
INITIALIZE_PASS (GlobalMergeFuncPassWrapper, "global-merge-func", "Global merge function pass", false, false) ModulePass *llvm

DEBUG_TYPE

#define DEBUG_TYPE "global-merge-func"

canParameterizeCallOperand()

checkConstHashCompatible()

Definition at line 306 of file GlobalMergeFunctions.cpp.

References llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find(), and llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::insert().

Referenced by llvm::GlobalMergeFunc::merge().

checkConstLocationCompatible()

Definition at line 329 of file GlobalMergeFunctions.cpp.

References assert(), llvm::cast(), llvm::StableFunctionMap::StableFunctionEntry::IndexOperandHashMap, llvm::MapVector< KeyT, ValueT, MapType, VectorType >::lookup(), and llvm::MapVector< KeyT, ValueT, MapType, VectorType >::size().

Referenced by llvm::GlobalMergeFunc::merge().

computeParamInfo()

createMergedFunction()

Definition at line 186 of file GlobalMergeFunctions.cpp.

References llvm::Function::addFnAttr(), llvm::SmallVectorImpl< T >::append(), llvm::Function::arg_begin(), assert(), llvm::ArrayRef< T >::begin(), llvm::Function::begin(), llvm::Function::copyAttributesFrom(), llvm::Function::Create(), llvm::GlobalValue::DefaultStorageClass, llvm::ArrayRef< T >::end(), FuncMergeInfo::F, llvm::FunctionType::get(), llvm::Function::getArg(), llvm::Value::getName(), llvm::User::getOperand(), llvm::Value::getType(), FuncMergeInfo::IndexInstruction, llvm::GlobalValue::InternalLinkage, llvm::MapVector< KeyT, ValueT, MapType, VectorType >::lookup(), llvm::GlobalMergeFunc::MergingInstanceSuffix, llvm::Value::replaceAllUsesWith(), llvm::GlobalValue::setDLLStorageClass(), llvm::GlobalValue::setLinkage(), llvm::Function::setSubprogram(), llvm::SmallVectorTemplateCommon< T, typename >::size(), llvm::Function::splice(), and llvm::StringRef::str().

Referenced by llvm::GlobalMergeFunc::merge().

createThunk()

Definition at line 251 of file GlobalMergeFunctions.cpp.

References assert(), llvm::BasicBlock::Create(), FuncMergeInfo::F, llvm::Function::getAttributes(), llvm::Function::getCallingConv(), llvm::Function::getFunctionType(), llvm::FunctionType::getNumParams(), llvm::CallBase::setAttributes(), llvm::CallBase::setCallingConv(), llvm::CallInst::setTailCallKind(), llvm::ArrayRef< T >::size(), llvm::CallingConv::SwiftTail, llvm::CallInst::TCK_MustTail, and llvm::CallInst::TCK_Tail.

Referenced by llvm::GlobalMergeFunc::merge().

ignoreOp()

INITIALIZE_PASS()

INITIALIZE_PASS ( GlobalMergeFuncPassWrapper ,
"global-merge-func" ,
"Global merge function pass" ,
false ,
false )

isCalleeOperand()

isEligibleFunction()

isEligibleInstructionForConstantSharing()

STATISTIC() [1/4]

STATISTIC ( NumAnalyzedFunctions ,
"Number of functions that are analyzed" )

STATISTIC() [2/4]

STATISTIC ( NumAnalyzedModues ,
"Number of modules that are analyzed" )

STATISTIC() [3/4]

STATISTIC ( NumEligibleFunctions ,
"Number of functions that are eligible" )

STATISTIC() [4/4]

STATISTIC ( NumMergedFunctions ,
"Number of functions that are actually merged using function hash" )

DisableCGDataForMerging