|
LLVM
4.0.0
|
#include "llvm/ADT/ArrayRef.h"#include "llvm/ADT/Statistic.h"#include "llvm/ADT/StringRef.h"#include "llvm/ADT/Twine.h"#include "llvm/Analysis/IndirectCallPromotionAnalysis.h"#include "llvm/Analysis/IndirectCallSiteVisitor.h"#include "llvm/IR/BasicBlock.h"#include "llvm/IR/CallSite.h"#include "llvm/IR/DerivedTypes.h"#include "llvm/IR/DiagnosticInfo.h"#include "llvm/IR/Function.h"#include "llvm/IR/IRBuilder.h"#include "llvm/IR/InstrTypes.h"#include "llvm/IR/Instruction.h"#include "llvm/IR/Instructions.h"#include "llvm/IR/LLVMContext.h"#include "llvm/IR/MDBuilder.h"#include "llvm/IR/PassManager.h"#include "llvm/IR/Type.h"#include "llvm/Pass.h"#include "llvm/PassRegistry.h"#include "llvm/PassSupport.h"#include "llvm/ProfileData/InstrProf.h"#include "llvm/Support/Casting.h"#include "llvm/Support/CommandLine.h"#include "llvm/Support/Debug.h"#include "llvm/Support/ErrorHandling.h"#include "llvm/Transforms/Instrumentation.h"#include "llvm/Transforms/PGOInstrumentation.h"#include "llvm/Transforms/Utils/BasicBlockUtils.h"#include <cassert>#include <cstdint>#include <vector>Go to the source code of this file.
Macros | |
| #define | DEBUG_TYPE "pgo-icall-prom" |
Functions | |
| STATISTIC (NumOfPGOICallPromotion,"Number of indirect call promotions.") | |
| STATISTIC (NumOfPGOICallsites,"Number of indirect call candidate sites.") | |
| INITIALIZE_PASS (PGOIndirectCallPromotionLegacyPass,"pgo-icall-prom","Use PGO instrumentation profile to promote indirect calls to ""direct calls.", false, false) ModulePass *llvm | |
| static void | createIfThenElse (Instruction *Inst, Function *DirectCallee, uint64_t Count, uint64_t TotalCount, BasicBlock **DirectCallBB, BasicBlock **IndirectCallBB, BasicBlock **MergeBB) |
| static bool | getCallRetPHINode (BasicBlock *BB, Instruction *Inst) |
| static void | fixupPHINodeForUnwind (Instruction *Inst, BasicBlock *BB, BasicBlock *OrigBB, BasicBlock *IndirectCallBB, BasicBlock *DirectCallBB) |
| static void | fixupPHINodeForNormalDest (Instruction *Inst, BasicBlock *BB, BasicBlock *OrigBB, BasicBlock *IndirectCallBB, Instruction *NewInst) |
| static Instruction * | insertCallRetCast (const Instruction *Inst, Instruction *DirectCallInst, Function *DirectCallee) |
| static Instruction * | createDirectCallInst (const Instruction *Inst, Function *DirectCallee, BasicBlock *DirectCallBB, BasicBlock *MergeBB) |
| static void | insertCallRetPHI (Instruction *Inst, Instruction *CallResult, Function *DirectCallee) |
| static bool | promoteIndirectCalls (Module &M, bool InLTO) |
Variables | |
| static cl::opt< bool > | DisableICP ("disable-icp", cl::init(false), cl::Hidden, cl::desc("Disable indirect call promotion")) |
| static cl::opt< unsigned > | ICPCutOff ("icp-cutoff", cl::init(0), cl::Hidden, cl::ZeroOrMore, cl::desc("Max number of promotions for this compilaiton")) |
| static cl::opt< unsigned > | ICPCSSkip ("icp-csskip", cl::init(0), cl::Hidden, cl::ZeroOrMore, cl::desc("Skip Callsite up to this number for this compilaiton")) |
| static cl::opt< bool > | ICPLTOMode ("icp-lto", cl::init(false), cl::Hidden, cl::desc("Run indirect-call promotion in LTO ""mode")) |
| static cl::opt< bool > | ICPCallOnly ("icp-call-only", cl::init(false), cl::Hidden, cl::desc("Run indirect-call promotion for call instructions ""only")) |
| static cl::opt< bool > | ICPInvokeOnly ("icp-invoke-only", cl::init(false), cl::Hidden, cl::desc("Run indirect-call promotion for ""invoke instruction only")) |
| static cl::opt< bool > | ICPDUMPAFTER ("icp-dumpafter", cl::init(false), cl::Hidden, cl::desc("Dump IR after transformation happens")) |
| #define DEBUG_TYPE "pgo-icall-prom" |
Definition at line 52 of file IndirectCallPromotion.cpp.
|
static |
Definition at line 461 of file IndirectCallPromotion.cpp.
References assert(), llvm::Instruction::clone(), llvm::dyn_cast(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, IterTy >::getArgument(), llvm::BasicBlock::getFirstInsertionPt(), llvm::Type::getFunctionNumParams(), llvm::Function::getFunctionType(), llvm::BasicBlock::getInstList(), llvm::FunctionType::getParamType(), llvm::Value::getType(), I, llvm::iplist_impl< IntrusiveListT, TraitsT >::insert(), insertCallRetCast(), llvm::LLVMContext::MD_prof, llvm::InvokeInst::mutateFunctionType(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, IterTy >::setArgument(), llvm::InvokeInst::setCalledFunction(), llvm::Instruction::setMetadata(), and llvm::InvokeInst::setNormalDest().
|
static |
Definition at line 319 of file IndirectCallPromotion.cpp.
References llvm::calculateCountScale(), llvm::BranchInst::Create(), llvm::IRBuilder< T, Inserter >::CreateBitCast(), llvm::IRBuilder< T, Inserter >::CreateICmpEQ(), llvm::dyn_cast(), llvm::Instruction::eraseFromParent(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, IterTy >::getCalledValue(), llvm::Value::getContext(), llvm::Type::getInt8PtrTy(), llvm::InvokeInst::getNormalDest(), llvm::Instruction::getParent(), llvm::scaleBranchCount(), llvm::Value::setName(), and llvm::SplitBlockAndInsertIfThenElse().
|
static |
Definition at line 410 of file IndirectCallPromotion.cpp.
References llvm::PHINode::addIncoming(), llvm::dyn_cast(), llvm::PHINode::getBasicBlockIndex(), llvm::PHINode::getIncomingValue(), I, and llvm::PHINode::setIncomingBlock().
|
static |
Definition at line 388 of file IndirectCallPromotion.cpp.
References llvm::PHINode::addIncoming(), llvm::dyn_cast(), llvm::PHINode::getBasicBlockIndex(), llvm::PHINode::getIncomingValue(), I, and llvm::PHINode::setIncomingBlock().
|
static |
Definition at line 366 of file IndirectCallPromotion.cpp.
References llvm::dyn_cast(), llvm::PHINode::getBasicBlockIndex(), llvm::PHINode::getIncomingValue(), llvm::Instruction::getParent(), and I.
Referenced by insertCallRetPHI().
| INITIALIZE_PASS | ( | PGOIndirectCallPromotionLegacyPass | , |
| "pgo-icall-prom" | , | ||
| "Use PGO instrumentation profile to promote indirect calls to ""direct calls." | , | ||
| false | , | ||
| false | |||
| ) |
Definition at line 126 of file IndirectCallPromotion.cpp.
|
static |
Definition at line 432 of file IndirectCallPromotion.cpp.
References llvm::dyn_cast(), llvm::BasicBlock::getParent(), llvm::Function::getReturnType(), llvm::BasicBlock::getTerminator(), llvm::Value::getType(), and llvm::Type::isVoidTy().
Referenced by createDirectCallInst().
|
static |
Definition at line 502 of file IndirectCallPromotion.cpp.
References llvm::PHINode::addIncoming(), llvm::PHINode::Create(), getCallRetPHINode(), llvm::BasicBlock::getInstList(), llvm::Instruction::getParent(), llvm::BasicBlock::getSingleSuccessor(), llvm::Value::getType(), llvm::Type::isVoidTy(), llvm::iplist_impl< IntrusiveListT, TraitsT >::push_front(), and llvm::Value::replaceAllUsesWith().
Definition at line 633 of file IndirectCallPromotion.cpp.
References llvm::InstrProfSymtab::create(), llvm::dbgs(), DEBUG, DisableICP, F, ICPCutOff, and ICPDUMPAFTER.
Referenced by llvm::PGOIndirectCallPromotion::run().
| STATISTIC | ( | NumOfPGOICallPromotion | , |
| "Number of indirect call promotions." | |||
| ) |
| STATISTIC | ( | NumOfPGOICallsites | , |
| "Number of indirect call candidate sites." | |||
| ) |
|
static |
Referenced by promoteIndirectCalls().
|
static |
|
static |
|
static |
Referenced by promoteIndirectCalls().
|
static |
Referenced by promoteIndirectCalls().
|
static |
1.8.6