LLVM  mainline
Defines | Typedefs | Functions
Inliner.cpp File Reference
#include "llvm/Transforms/IPO/InlinerPass.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/AssumptionCache.h"
#include "llvm/Analysis/BasicAliasAnalysis.h"
#include "llvm/Analysis/CallGraph.h"
#include "llvm/Analysis/InlineCost.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/IR/CallSite.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DiagnosticInfo.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Module.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Transforms/Utils/Cloning.h"
#include "llvm/Transforms/Utils/Local.h"
Include dependency graph for Inliner.cpp:

Go to the source code of this file.

Defines

#define DEBUG_TYPE   "inline"

Typedefs

typedef DenseMap< ArrayType
*, std::vector< AllocaInst * > > 
InlinedArrayAllocasTy

Functions

 STATISTIC (NumInlined,"Number of functions inlined")
 STATISTIC (NumCallsDeleted,"Number of call sites deleted, not inlined")
 STATISTIC (NumDeleted,"Number of functions deleted because all callers found")
 STATISTIC (NumMergedAllocas,"Number of allocas merged together")
 STATISTIC (NumCallerCallersAnalyzed,"Number of caller-callers analyzed")
static bool InlineCallIfPossible (Pass &P, CallSite CS, InlineFunctionInfo &IFI, InlinedArrayAllocasTy &InlinedArrayAllocas, int InlineHistory, bool InsertLifetime)
 If it is possible to inline the specified call site, do so and update the CallGraph for this operation.
static void emitAnalysis (CallSite CS, const Twine &Msg)
static bool InlineHistoryIncludes (Function *F, int InlineHistoryID, const SmallVectorImpl< std::pair< Function *, int > > &InlineHistory)
 Return true if the specified inline history ID indicates an inline history that includes the specified function.

Define Documentation

#define DEBUG_TYPE   "inline"

Definition at line 38 of file Inliner.cpp.


Typedef Documentation

Definition at line 66 of file Inliner.cpp.


Function Documentation

static void emitAnalysis ( CallSite  CS,
const Twine Msg 
) [static]
static bool InlineCallIfPossible ( Pass P,
CallSite  CS,
InlineFunctionInfo IFI,
InlinedArrayAllocasTy InlinedArrayAllocas,
int  InlineHistory,
bool  InsertLifetime 
) [static]

If it is possible to inline the specified call site, do so and update the CallGraph for this operation.

This function also does some basic book-keeping to update the IR. The InlinedArrayAllocas map keeps track of any allocas that are already available from other functions inlined into the caller. If we are able to inline this call site we attempt to reuse already available allocas or add any new allocas to the set if not possible.

Definition at line 76 of file Inliner.cpp.

References llvm::createLegacyPMAAResults(), llvm::createLegacyPMBasicAAResult(), llvm::dbgs(), DEBUG, llvm::DL, llvm::dyn_cast(), llvm::Instruction::eraseFromParent(), llvm::DataLayout::getABITypeAlignment(), llvm::AllocaInst::getAlignment(), llvm::AllocaInst::getAllocatedType(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, IterTy >::getCalledFunction(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, IterTy >::getCaller(), llvm::Value::getContext(), llvm::Module::getDataLayout(), llvm::MetadataAsValue::getIfExists(), llvm::LocalAsMetadata::getIfExists(), llvm::Instruction::getParent(), llvm::GlobalValue::getParent(), llvm::InlineFunction(), llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::AllocaInst::isArrayAllocation(), llvm::AttributeFuncs::mergeAttributesForInlining(), llvm::SmallVectorTemplateBase< T, isPodLike >::push_back(), llvm::Value::replaceAllUsesWith(), llvm::SmallVectorTemplateCommon< T, typename >::size(), llvm::InlineFunctionInfo::StaticAllocas, and llvm::Value::users().

Referenced by llvm::Inliner::runOnSCC().

static bool InlineHistoryIncludes ( Function F,
int  InlineHistoryID,
const SmallVectorImpl< std::pair< Function *, int > > &  InlineHistory 
) [static]

Return true if the specified inline history ID indicates an inline history that includes the specified function.

Definition at line 346 of file Inliner.cpp.

Referenced by llvm::Inliner::runOnSCC().

STATISTIC ( NumInlined  ,
"Number of functions inlined"   
)
STATISTIC ( NumCallsDeleted  ,
"Number of call sites  deleted,
not inlined"   
)
STATISTIC ( NumDeleted  ,
"Number of functions deleted because all callers found"   
)
STATISTIC ( NumMergedAllocas  ,
"Number of allocas merged together"   
)
STATISTIC ( NumCallerCallersAnalyzed  ,
"Number of caller-callers analyzed"   
)