LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
InlineFunction.cpp File Reference
#include "llvm/Transforms/Utils/Cloning.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Analysis/CallGraph.h"
#include "llvm/Analysis/InstructionSimplify.h"
#include "llvm/DebugInfo.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/Module.h"
#include "llvm/Support/CallSite.h"
#include "llvm/Transforms/Utils/Local.h"
Include dependency graph for InlineFunction.cpp:

Go to the source code of this file.

Functions

static bool HandleCallsInBlockInlinedThroughInvoke (BasicBlock *BB, InvokeInliningInfo &Invoke)
 
static void HandleInlinedInvoke (InvokeInst *II, BasicBlock *FirstNewBlock, ClonedCodeInfo &InlinedCodeInfo)
 
static void UpdateCallGraphAfterInlining (CallSite CS, Function::iterator FirstNewBlock, ValueToValueMapTy &VMap, InlineFunctionInfo &IFI)
 
static ValueHandleByValArgument (Value *Arg, Instruction *TheCall, const Function *CalledFunc, InlineFunctionInfo &IFI, unsigned ByValAlignment)
 
static bool isUsedByLifetimeMarker (Value *V)
 
static bool hasLifetimeMarkers (AllocaInst *AI)
 
static DebugLoc updateInlinedAtInfo (const DebugLoc &DL, const DebugLoc &InlinedAtDL, LLVMContext &Ctx)
 
static void fixupLineNumbers (Function *Fn, Function::iterator FI, Instruction *TheCall)
 

Function Documentation

static void fixupLineNumbers ( Function Fn,
Function::iterator  FI,
Instruction TheCall 
)
static

fixupLineNumbers - Update inlined instructions' line numbers to to encode location where these instructions are inlined.

Definition at line 468 of file InlineFunction.cpp.

References llvm::createInlinedVariable(), llvm::Function::end(), llvm::Instruction::getDebugLoc(), llvm::DebugLoc::isUnknown(), and updateInlinedAtInfo().

Referenced by llvm::InlineFunction().

static Value* HandleByValArgument ( Value Arg,
Instruction TheCall,
const Function CalledFunc,
InlineFunctionInfo IFI,
unsigned  ByValAlignment 
)
static
static bool HandleCallsInBlockInlinedThroughInvoke ( BasicBlock BB,
InvokeInliningInfo &  Invoke 
)
static

HandleCallsInBlockInlinedThroughInvoke - When we inline a basic block into an invoke, we have to turn all of the calls that can throw into invokes. This function analyze BB to see if there are any calls, and if so, it rewrites them to be invokes that jump to InvokeDest and fills in the PHI nodes in that block with the values specified in InvokeDestPHIValues.

Returns true to indicate that the next block should be skipped.

Definition at line 177 of file InlineFunction.cpp.

References llvm::CallSiteBase< FunTy, ValTy, UserTy, InstrTy, CallTy, InvokeTy, IterTy >::arg_begin(), llvm::CallSiteBase< FunTy, ValTy, UserTy, InstrTy, CallTy, InvokeTy, IterTy >::arg_end(), llvm::BasicBlock::begin(), llvm::InvokeInst::Create(), llvm::CallInst::doesNotThrow(), llvm::dyn_cast(), llvm::BasicBlock::end(), llvm::CallInst::getAttributes(), llvm::CallInst::getCalledValue(), llvm::CallInst::getCallingConv(), llvm::LandingPadInst::getClause(), llvm::BasicBlock::getInstList(), llvm::Value::getName(), llvm::LandingPadInst::getNumClauses(), I, llvm::iplist< NodeTy, Traits >::pop_back(), llvm::iplist< NodeTy, Traits >::pop_front(), llvm::Value::replaceAllUsesWith(), Split(), and llvm::BasicBlock::splitBasicBlock().

Referenced by HandleInlinedInvoke().

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.

II is the invoke instruction being 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 238 of file InlineFunction.cpp.

References llvm::ClonedCodeInfo::ContainsCalls, llvm::Function::end(), llvm::InvokeInst::getLandingPadInst(), llvm::Instruction::getParent(), llvm::BasicBlock::getParent(), llvm::InvokeInst::getUnwindDest(), HandleCallsInBlockInlinedThroughInvoke(), I, llvm::SmallPtrSet< PtrType, SmallSize >::insert(), and llvm::BasicBlock::removePredecessor().

Referenced by llvm::InlineFunction().

static bool hasLifetimeMarkers ( AllocaInst AI)
static
static bool isUsedByLifetimeMarker ( Value V)
static
static void UpdateCallGraphAfterInlining ( CallSite  CS,
Function::iterator  FirstNewBlock,
ValueToValueMapTy VMap,
InlineFunctionInfo IFI 
)
static
static DebugLoc updateInlinedAtInfo ( const DebugLoc DL,
const DebugLoc InlinedAtDL,
LLVMContext Ctx 
)
static

updateInlinedAtInfo - Helper function used by fixupLineNumbers to recursively update InlinedAtEntry of a DebugLoc.

Definition at line 452 of file InlineFunction.cpp.

References llvm::DebugLoc::get(), llvm::DebugLoc::getAsMDNode(), llvm::DebugLoc::getCol(), llvm::DebugLoc::getFromDILocation(), llvm::DebugLoc::getInlinedAt(), llvm::DebugLoc::getLine(), and llvm::DebugLoc::getScope().

Referenced by fixupLineNumbers().