LLVM API Documentation

InlineFunction.cpp File Reference

#include "llvm/Transforms/Utils/Cloning.h"
#include "llvm/Constants.h"
#include "llvm/DerivedTypes.h"
#include "llvm/Module.h"
#include "llvm/Instructions.h"
#include "llvm/Intrinsics.h"
#include "llvm/Analysis/CallGraph.h"
#include "llvm/Support/CallSite.h"

Include dependency graph for InlineFunction.cpp:

Go to the source code of this file.

Functions

bool llvm::InlineFunction (CallInst *CI, CallGraph *CG)
bool llvm::InlineFunction (InvokeInst *II, CallGraph *CG)
static void HandleInlinedInvoke (InvokeInst *II, BasicBlock *FirstNewBlock, ClonedCodeInfo &InlinedCodeInfo)
static void UpdateCallGraphAfterInlining (const Function *Caller, const Function *Callee, Function::iterator FirstNewBlock, std::map< const Value *, Value * > &ValueMap, CallGraph &CG)
bool llvm::InlineFunction (CallSite CS, CallGraph *CG)


Function Documentation

static void HandleInlinedInvoke ( InvokeInst II,
BasicBlock FirstNewBlock,
ClonedCodeInfo InlinedCodeInfo 
) [static]

HandleInlinedInvoke - If we inlined an invoke site, we need to convert calls in the body of the inlined function into invokes and turn unwind instructions into branches to the invoke unwind dest.

II is the invoke instruction begin inlined. FirstNewBlock is the first block of the inlined code (the last block is the end of the function), and InlineCodeInfo is information about the code that got inlined.

Definition at line 39 of file InlineFunction.cpp.

References BB, llvm::BasicBlock::begin(), llvm::ClonedCodeInfo::ContainsCalls, llvm::ClonedCodeInfo::ContainsUnwinds, E, llvm::BasicBlock::end(), llvm::Function::end(), llvm::CallInst::getCalledFunction(), llvm::CallInst::getCalledValue(), llvm::CallInst::getCallingConv(), llvm::BasicBlock::getInstList(), llvm::Function::getIntrinsicID(), llvm::Value::getName(), llvm::BasicBlock::getParent(), llvm::BasicBlock::getTerminator(), II, llvm::User::op_begin(), llvm::User::op_end(), llvm::BasicBlock::removePredecessor(), llvm::Value::replaceAllUsesWith(), Split(), and llvm::BasicBlock::splitBasicBlock().

Referenced by llvm::InlineFunction().

static void UpdateCallGraphAfterInlining ( const Function Caller,
const Function Callee,
Function::iterator  FirstNewBlock,
std::map< const Value *, Value * > &  ValueMap,
CallGraph CG 
) [static]

UpdateCallGraphAfterInlining - Once we have cloned code over from a callee into the caller, update the specified callgraph to reflect the changes we made. Note that it's possible that not all code was copied over, so only some edges of the callgraph will be remain.

Definition at line 143 of file InlineFunction.cpp.

References llvm::CallGraphNode::addCalledFunction(), llvm::CallGraphNode::begin(), E, llvm::CallGraphNode::end(), and llvm::CallGraphNode::removeCallEdgeTo().

Referenced by llvm::InlineFunction().