LLVM  10.0.0svn
Macros | Functions | Variables
MergeFunctions.cpp File Reference
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/IR/Argument.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/CallSite.h"
#include "llvm/IR/Constant.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/IR/DebugLoc.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/GlobalValue.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/InstrTypes.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Type.h"
#include "llvm/IR/Use.h"
#include "llvm/IR/User.h"
#include "llvm/IR/Value.h"
#include "llvm/IR/ValueHandle.h"
#include "llvm/IR/ValueMap.h"
#include "llvm/Pass.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Transforms/IPO.h"
#include "llvm/Transforms/Utils/FunctionComparator.h"
#include <algorithm>
#include <cassert>
#include <iterator>
#include <set>
#include <utility>
#include <vector>
Include dependency graph for MergeFunctions.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "mergefunc"
 

Functions

 STATISTIC (NumFunctionsMerged, "Number of functions merged")
 
 STATISTIC (NumThunksWritten, "Number of thunks generated")
 
 STATISTIC (NumAliasesWritten, "Number of aliases generated")
 
 STATISTIC (NumDoubleWeak, "Number of new functions created")
 
static bool isEligibleForMerging (Function &F)
 Check whether F is eligible for function merging. More...
 
static ValuecreateCast (IRBuilder<> &Builder, Value *V, Type *DestTy)
 
static bool canCreateThunkFor (Function *F)
 Whether this function may be replaced by a forwarding thunk. More...
 
static bool canCreateAliasFor (Function *F)
 
static bool isFuncOrderCorrect (const Function *F, const Function *G)
 

Variables

static cl::opt< unsignedNumFunctionsForSanityCheck ("mergefunc-sanity", cl::desc("How many functions in module could be used for " "MergeFunctions pass sanity check. " "'0' disables this check. Works only with '-debug' key."), cl::init(0), cl::Hidden)
 
static cl::opt< boolMergeFunctionsPDI ("mergefunc-preserve-debug-info", cl::Hidden, cl::init(false), cl::desc("Preserve debug info in thunk when mergefunc " "transformations are made."))
 
static cl::opt< boolMergeFunctionsAliases ("mergefunc-use-aliases", cl::Hidden, cl::init(false), cl::desc("Allow mergefunc to create aliases"))
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "mergefunc"

Definition at line 134 of file MergeFunctions.cpp.

Function Documentation

◆ canCreateAliasFor()

static bool canCreateAliasFor ( Function F)
static

◆ canCreateThunkFor()

static bool canCreateThunkFor ( Function F)
static

◆ createCast()

static Value* createCast ( IRBuilder<> &  Builder,
Value V,
Type DestTy 
)
static

◆ isEligibleForMerging()

static bool isEligibleForMerging ( Function F)
static

◆ isFuncOrderCorrect()

static bool isFuncOrderCorrect ( const Function F,
const Function G 
)
static

◆ STATISTIC() [1/4]

STATISTIC ( NumFunctionsMerged  ,
"Number of functions merged"   
)

◆ STATISTIC() [2/4]

STATISTIC ( NumThunksWritten  ,
"Number of thunks generated"   
)

◆ STATISTIC() [3/4]

STATISTIC ( NumAliasesWritten  ,
"Number of aliases generated"   
)

◆ STATISTIC() [4/4]

STATISTIC ( NumDoubleWeak  ,
"Number of new functions created"   
)

Variable Documentation

◆ MergeFunctionsAliases

cl::opt<bool> MergeFunctionsAliases("mergefunc-use-aliases", cl::Hidden, cl::init(false), cl::desc("Allow mergefunc to create aliases"))
static

Referenced by canCreateAliasFor().

◆ MergeFunctionsPDI

cl::opt<bool> MergeFunctionsPDI("mergefunc-preserve-debug-info", cl::Hidden, cl::init(false), cl::desc("Preserve debug info in thunk when mergefunc " "transformations are made."))
static

◆ NumFunctionsForSanityCheck

cl::opt<unsigned> NumFunctionsForSanityCheck("mergefunc-sanity", cl::desc("How many functions in module could be used for " "MergeFunctions pass sanity check. " "'0' disables this check. Works only with '-debug' key."), cl::init(0), cl::Hidden)
static