Thanks to visit codestin.com
Credit goes to llvm.org

LLVM 22.0.0git
llvm::GlobalMergeFunc Class Reference

GlobalMergeFunc is a ModulePass that implements a function merging mechanism using stable function hashes. More...

#include "llvm/CodeGen/GlobalMergeFunctions.h"

Public Member Functions

 GlobalMergeFunc (const ModuleSummaryIndex *Index)
void initializeMergerMode (const Module &M)
bool run (Module &M)
void analyze (Module &M)
 Analyze module to create stable function into LocalFunctionMap.
void emitFunctionMap (Module &M)
 Emit LocalFunctionMap into __llvm_merge section.
bool merge (Module &M, const StableFunctionMap *FunctionMap)
 Merge functions in the module using the given function map.

Static Public Attributes

static constexpr const char MergingInstanceSuffix [] = ".Tgm"
 The suffix used to identify the merged function that parameterizes the constant values.

Detailed Description

GlobalMergeFunc is a ModulePass that implements a function merging mechanism using stable function hashes.

It identifies and merges functions with matching hashes across modules to optimize binary size.

Definition at line 50 of file GlobalMergeFunctions.h.

Constructor & Destructor Documentation

◆ GlobalMergeFunc()

llvm::GlobalMergeFunc::GlobalMergeFunc ( const ModuleSummaryIndex * Index)
inline

Definition at line 63 of file GlobalMergeFunctions.h.

Member Function Documentation

◆ analyze()

void GlobalMergeFunc::analyze ( Module & M)

Analyze module to create stable function into LocalFunctionMap.

Definition at line 149 of file GlobalMergeFunctions.cpp.

References llvm::SmallVectorImpl< T >::emplace_back(), llvm::get_stable_name(), ignoreOp(), isEligibleFunction(), and llvm::StructuralHashWithDifferences().

Referenced by run().

◆ emitFunctionMap()

void GlobalMergeFunc::emitFunctionMap ( Module & M)

◆ initializeMergerMode()

void GlobalMergeFunc::initializeMergerMode ( const Module & M)

◆ merge()

◆ run()

Member Data Documentation

◆ MergingInstanceSuffix

const char llvm::GlobalMergeFunc::MergingInstanceSuffix[] = ".Tgm"
staticconstexpr

The suffix used to identify the merged function that parameterizes the constant values.

Note that the original function, without this suffix, becomes a thunk supplying contexts to the merged function via parameters.

Definition at line 61 of file GlobalMergeFunctions.h.

Referenced by createMergedFunction().


The documentation for this class was generated from the following files: