LLVM  6.0.0svn
Macros | Functions | Variables
MergeFunctions.cpp File Reference
#include "llvm/ADT/Hashing.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/IR/CallSite.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DebugInfo.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/ValueHandle.h"
#include "llvm/IR/ValueMap.h"
#include "llvm/Pass.h"
#include "llvm/Support/CommandLine.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/Utils/FunctionComparator.h"
#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 ValuecreateCast (IRBuilder<> &Builder, Value *V, Type *DestTy)
 

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

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "mergefunc"

Definition at line 118 of file MergeFunctions.cpp.

Function Documentation

◆ createCast()

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

Definition at line 473 of file MergeFunctions.cpp.

References llvm::AMDGPU::CodeObject::Kernel::Key::Args, llvm::Function::args(), assert(), llvm::BasicBlock::back(), llvm::BasicBlock::begin(), llvm::Function::begin(), C, llvm::ScaledNumbers::compare(), llvm::Function::copyAttributesFrom(), llvm::GlobalAlias::create(), llvm::BasicBlock::Create(), llvm::Function::Create(), llvm::IRBuilder< T, Inserter >::CreateBitCast(), llvm::IRBuilder< T, Inserter >::CreateExtractValue(), llvm::IRBuilder< T, Inserter >::CreateInsertValue(), llvm::IRBuilder< T, Inserter >::CreateIntToPtr(), llvm::IRBuilder< T, Inserter >::CreatePtrToInt(), llvm::dbgs(), DEBUG, E, llvm::BasicBlock::end(), llvm::Function::end(), llvm::Instruction::eraseFromParent(), llvm::BasicBlock::eraseFromParent(), llvm::Function::eraseFromParent(), F, llvm::Function::front(), G, llvm::DebugLoc::get(), llvm::UndefValue::get(), llvm::GlobalObject::getAlignment(), llvm::Function::getAttributes(), llvm::Function::getCallingConv(), llvm::Function::getContext(), llvm::Function::getEntryBlock(), llvm::Function::getFunctionType(), llvm::GlobalValue::getLinkage(), llvm::Value::getName(), llvm::FunctionType::getParamType(), llvm::GlobalValue::getParent(), llvm::Function::getReturnType(), llvm::Type::getStructElementType(), llvm::Type::getStructNumElements(), llvm::Function::getSubprogram(), llvm::BasicBlock::getTerminator(), llvm::Value::getType(), llvm::GlobalValue::getVisibility(), H, llvm::GlobalValue::hasLocalLinkage(), I, llvm::SmallSet< T, N, C >::insert(), llvm::Type::isIntegerTy(), llvm::GlobalValue::isInterposable(), llvm::DILocalVariable::isParameter(), llvm::Type::isPointerTy(), llvm::Type::isStructTy(), llvm::Type::isVoidTy(), llvm::makeArrayRef(), llvm::max(), MergeFunctionsPDI, llvm::iplist_impl< IntrusiveListT, TraitsT >::pop_back(), llvm::Metadata::print(), llvm::Value::print(), llvm::GlobalValue::PrivateLinkage, llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), llvm::sys::fs::remove(), llvm::Value::replaceAllUsesWith(), llvm::GlobalObject::setAlignment(), llvm::CallInst::setAttributes(), llvm::CallInst::setCallingConv(), llvm::Instruction::setDebugLoc(), llvm::GlobalValue::setLinkage(), llvm::CallInst::setTailCall(), SI, llvm::BasicBlock::size(), llvm::Function::size(), llvm::Value::takeName(), llvm::Value::use_empty(), and llvm::Value::users().

◆ 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

◆ 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

Referenced by createCast().

◆ 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