LLVM  6.0.0svn
Macros | Functions | Variables
MergeFunctions.cpp File Reference
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/SmallSet.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 (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 135 of file MergeFunctions.cpp.

Function Documentation

◆ createCast()

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

Definition at line 472 of file MergeFunctions.cpp.

References Arg, llvm::AMDGPU::HSAMD::Kernel::Key::Args, llvm::Function::args(), assert(), llvm::BasicBlock::back(), llvm::BasicBlock::begin(), llvm::Function::begin(), C, llvm::ScaledNumbers::compare(), llvm::Function::copyAttributesFrom(), 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::GlobalNumberState::erase(), 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::ConstantExpr::getBitCast(), 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::getType(), H, llvm::GlobalValue::hasGlobalUnnamedAddr(), 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/3]

STATISTIC ( NumFunctionsMerged  ,
"Number of functions merged"   
)

◆ STATISTIC() [2/3]

STATISTIC ( NumThunksWritten  ,
"Number of thunks generated"   
)

◆ STATISTIC() [3/3]

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