LLVM API Documentation
#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"
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 Value * | HandleByValArgument (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) |
|
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 |
HandleByValArgument - When inlining a call site that has a byval argument, we have to make the implicit memcpy explicit by adding it.
Definition at line 341 of file InlineFunction.cpp.
References Align(), llvm::Function::begin(), llvm::ConstantInt::get(), llvm::Value::getContext(), llvm::Intrinsic::getDeclaration(), llvm::ConstantInt::getFalse(), llvm::Type::getInt32Ty(), llvm::Type::getInt64Ty(), llvm::Type::getInt8PtrTy(), llvm::Value::getName(), llvm::getOrEnforceKnownAlignment(), llvm::Instruction::getParent(), llvm::BasicBlock::getParent(), llvm::GlobalValue::getParent(), llvm::DataLayout::getPrefTypeAlignment(), llvm::ConstantExpr::getSizeOf(), llvm::Value::getType(), llvm::DataLayout::getTypeStoreSize(), llvm::Intrinsic::memcpy, llvm::Function::onlyReadsMemory(), and llvm::InlineFunctionInfo::TD.
Referenced by llvm::InlineFunction().
|
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 |
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 |
Definition at line 434 of file InlineFunction.cpp.
References llvm::Type::getContext(), llvm::Type::getInt8PtrTy(), llvm::AllocaInst::getType(), I, isUsedByLifetimeMarker(), llvm::Value::use_begin(), and llvm::Value::use_end().
Referenced by llvm::InlineFunction().
Definition at line 417 of file InlineFunction.cpp.
References llvm::Intrinsic::lifetime_end, llvm::Intrinsic::lifetime_start, llvm::Value::use_begin(), and llvm::Value::use_end().
Referenced by hasLifetimeMarkers().
|
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 may remain.
Definition at line 279 of file InlineFunction.cpp.
References llvm::CallGraphNode::addCalledFunction(), llvm::CallGraphNode::begin(), llvm::InlineFunctionInfo::CG, llvm::dyn_cast(), llvm::ValueMap< KeyT, ValueT, Config >::end(), llvm::CallGraphNode::end(), F(), llvm::ValueMap< KeyT, ValueT, Config >::find(), llvm::CallSiteBase< FunTy, ValTy, UserTy, InstrTy, CallTy, InvokeTy, IterTy >::getCalledFunction(), llvm::CallSiteBase< FunTy, ValTy, UserTy, InstrTy, CallTy, InvokeTy, IterTy >::getInstruction(), llvm::Instruction::getParent(), llvm::BasicBlock::getParent(), I, llvm::InlineFunctionInfo::InlinedCalls, llvm::CallGraphNode::removeCallEdgeFor(), and llvm::ValueMapIterator< DenseMapT, KeyT >::ValueTypeProxy::second.
Referenced by llvm::InlineFunction().
|
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().