LLVM 22.0.0git
GlobalMergeFunctions.cpp File Reference

Go to the source code of this file.

Classes

struct  FuncMergeInfo
 Tuple to hold function info to process merging. More...

Namespaces

namespace  llvm
 This is an optimization pass for GlobalISel generic memory operations.

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 FunctioncreateMergedFunction (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_BEGIN (GlobalMergeFuncPassWrapper, "global-merge-func", "Global merge function pass", false, false) INITIALIZE_PASS_END(GlobalMergeFuncPassWrapper
LLVM_ABI ModulePassllvm::createGlobalMergeFuncPass ()
 This pass performs merging similar functions globally.

Variables

static cl::opt< boolDisableCGDataForMerging ("disable-cgdata-for-merging", cl::Hidden, cl::desc("Disable codegen data for function merging. Local " "merging is still enabled within a module."), cl::init(false))
global merge func
global merge Global merge function pass
global merge Global merge function false

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "global-merge-func"

Definition at line 25 of file GlobalMergeFunctions.cpp.

Function Documentation

◆ canParameterizeCallOperand()

◆ checkConstHashCompatible()

◆ checkConstLocationCompatible()

◆ computeParamInfo()

◆ createMergedFunction()

◆ createThunk()

◆ ignoreOp()

◆ INITIALIZE_PASS_BEGIN()

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

◆ isCalleeOperand()

bool isCalleeOperand ( const CallBase * CI,
unsigned OpIdx )
static

Returns true if the \OpIdx operand of CI is the callee operand.

Definition at line 43 of file GlobalMergeFunctions.cpp.

References llvm::CallBase::getCalledOperandUse(), llvm::User::getOperandUse(), and OpIdx.

Referenced by canParameterizeCallOperand().

◆ isEligibleFunction()

bool isEligibleFunction ( Function * F)

Returns true if function F is eligible for merging.

Definition at line 81 of file GlobalMergeFunctions.cpp.

References llvm::dyn_cast(), F, I, and llvm::CallingConv::SwiftTail.

Referenced by llvm::GlobalMergeFunc::analyze(), and llvm::GlobalMergeFunc::merge().

◆ isEligibleInstructionForConstantSharing()

bool isEligibleInstructionForConstantSharing ( const Instruction * I)
static

Definition at line 117 of file GlobalMergeFunctions.cpp.

References I.

Referenced by ignoreOp().

◆ 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"  )

Variable Documentation

◆ DisableCGDataForMerging

cl::opt< bool > DisableCGDataForMerging("disable-cgdata-for-merging", cl::Hidden, cl::desc("Disable codegen data for function merging. Local " "merging is still enabled within a module."), cl::init(false)) ( "disable-cgdata-for-merging" ,
cl::Hidden ,
cl::desc("Disable codegen data for function merging. Local " "merging is still enabled within a module.") ,
cl::init(false)  )
static

◆ false

global merge Global merge function false

Definition at line 593 of file GlobalMergeFunctions.cpp.

◆ func

◆ pass

global merge Global merge function pass

Definition at line 593 of file GlobalMergeFunctions.cpp.

Referenced by LLVMTargetMachineEmit(), and llvm::verifySafepointIR().