LLVM API Documentation

MergeFunctions.cpp File Reference

#include "llvm/Transforms/IPO.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/FoldingSet.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Constants.h"
#include "llvm/InlineAsm.h"
#include "llvm/Instructions.h"
#include "llvm/LLVMContext.h"
#include "llvm/Module.h"
#include "llvm/Pass.h"
#include "llvm/Support/CallSite.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include <map>
#include <vector>

Include dependency graph for MergeFunctions.cpp:

Go to the source code of this file.

Defines

#define DEBUG_TYPE   "mergefunc"

Enumerations

enum  LinkageCategory { ExternalStrong, ExternalWeak, Internal }

Functions

 STATISTIC (NumFunctionsMerged,"Number of functions merged")
ModulePass * llvm::createMergeFunctionsPass ()
static unsigned long hash (const Function *F)
static Value * IgnoreBitcasts (Value *V)
static bool isEquivalentType (const Type *Ty1, const Type *Ty2)
static bool isEquivalentOperation (const Instruction *I1, const Instruction *I2)
static bool compare (const Value *V, const Value *U)
static bool equals (const BasicBlock *BB1, const BasicBlock *BB2, DenseMap< const Value *, const Value * > &ValueMap, DenseMap< const Value *, const Value * > &SpeculationMap)
static bool equals (const Function *F, const Function *G)
static LinkageCategory categorize (const Function *F)
static void ThunkGToF (Function *F, Function *G)
static void AliasGToF (Function *F, Function *G)
static bool fold (std::vector< Function * > &FnVec, unsigned i, unsigned j)

Variables

static RegisterPass
< MergeFunctions > 
X ("mergefunc","Merge Functions")


Define Documentation

#define DEBUG_TYPE   "mergefunc"

Definition at line 42 of file MergeFunctions.cpp.


Enumeration Type Documentation

Enumerator:
ExternalStrong 
ExternalWeak 
Internal 

Definition at line 446 of file MergeFunctions.cpp.


Function Documentation

static void AliasGToF ( Function *  F,
Function *  G 
) [static]

static LinkageCategory categorize ( const Function *  F  )  [static]

static bool compare ( const Value *  V,
const Value *  U 
) [static]

static bool equals ( const Function *  F,
const Function *  G 
) [static]

static bool equals ( const BasicBlock *  BB1,
const BasicBlock *  BB2,
DenseMap< const Value *, const Value * > &  ValueMap,
DenseMap< const Value *, const Value * > &  SpeculationMap 
) [static]

static bool fold ( std::vector< Function * > &  FnVec,
unsigned  i,
unsigned  j 
) [static]

static unsigned long hash ( const Function *  F  )  [static]

static Value* IgnoreBitcasts ( Value *  V  )  [static]

IgnoreBitcasts - given a bitcast, returns the first non-bitcast found by walking the chain of cast operands. Otherwise, returns the argument.

Definition at line 101 of file MergeFunctions.cpp.

Referenced by equals().

static bool isEquivalentOperation ( const Instruction *  I1,
const Instruction *  I2 
) [static]

isEquivalentOperation - determine whether the two operations are the same except that pointer-to-A and pointer-to-B are equivalent. This should be kept in sync with Instruction::isSameOperationAs.

Definition at line 188 of file MergeFunctions.cpp.

References llvm::Intrinsic::getAttributes(), llvm::User::getNumOperands(), llvm::Instruction::getOpcode(), llvm::User::getOperand(), getPredicate(), llvm::AttrListPtr::getRawPointer(), llvm::Value::getType(), llvm::Value::hasSameSubclassOptionalData(), isEquivalentType(), and LI.

Referenced by equals().

static bool isEquivalentType ( const Type *  Ty1,
const Type *  Ty2 
) [static]

STATISTIC ( NumFunctionsMerged  ,
"Number of functions merged"   
)

static void ThunkGToF ( Function *  F,
Function *  G 
) [static]


Variable Documentation

char ID [static]

Definition at line 66 of file MergeFunctions.cpp.

RegisterPass<MergeFunctions> X("mergefunc","Merge Functions") [static]