|
LLVM
4.0.0
|
#include "llvm/Transforms/Scalar/LowerExpectIntrinsic.h"#include "llvm/ADT/SmallVector.h"#include "llvm/ADT/Statistic.h"#include "llvm/IR/BasicBlock.h"#include "llvm/IR/Constants.h"#include "llvm/IR/Function.h"#include "llvm/IR/Instructions.h"#include "llvm/IR/Intrinsics.h"#include "llvm/IR/LLVMContext.h"#include "llvm/IR/MDBuilder.h"#include "llvm/IR/Metadata.h"#include "llvm/Pass.h"#include "llvm/Support/CommandLine.h"#include "llvm/Support/Debug.h"#include "llvm/Transforms/Scalar.h"Go to the source code of this file.
Macros | |
| #define | DEBUG_TYPE "lower-expect-intrinsic" |
Functions | |
| STATISTIC (ExpectIntrinsicsHandled,"Number of 'expect' intrinsic instructions handled") | |
| static bool | handleSwitchExpect (SwitchInst &SI) |
| template<class BrSelInst > | |
| static bool | handleBrSelExpect (BrSelInst &BSI) |
| static bool | handleBranchExpect (BranchInst &BI) |
| static bool | lowerExpectIntrinsic (Function &F) |
| INITIALIZE_PASS (LowerExpectIntrinsic,"lower-expect","Lower 'expect' Intrinsics", false, false) FunctionPass *llvm | |
Variables | |
| static cl::opt< uint32_t > | LikelyBranchWeight ("likely-branch-weight", cl::Hidden, cl::init(2000), cl::desc("Weight of the branch likely to be taken (default = 2000)")) |
| static cl::opt< uint32_t > | UnlikelyBranchWeight ("unlikely-branch-weight", cl::Hidden, cl::init(1), cl::desc("Weight of the branch unlikely to be taken (default = 1)")) |
| #define DEBUG_TYPE "lower-expect-intrinsic" |
Definition at line 32 of file LowerExpectIntrinsic.cpp.
|
static |
Definition at line 140 of file LowerExpectIntrinsic.cpp.
References llvm::BranchInst::isUnconditional().
Referenced by lowerExpectIntrinsic().
|
static |
Definition at line 87 of file LowerExpectIntrinsic.cpp.
References llvm::dyn_cast(), llvm::CallInst::getArgOperand(), llvm::CallInst::getCalledFunction(), llvm::Value::getContext(), llvm::Function::getIntrinsicID(), llvm::User::getOperand(), llvm::CmpInst::getPredicate(), llvm::CmpInst::ICMP_NE, llvm::ConstantInt::isOne(), LikelyBranchWeight, llvm::LLVMContext::MD_prof, llvm::User::setOperand(), and UnlikelyBranchWeight.
Referenced by lowerExpectIntrinsic().
|
static |
Definition at line 56 of file LowerExpectIntrinsic.cpp.
References llvm::SwitchInst::case_default(), llvm::dyn_cast(), llvm::SwitchInst::findCaseValue(), llvm::CallInst::getArgOperand(), llvm::CallInst::getCalledFunction(), llvm::SwitchInst::CaseIteratorT< SwitchInstTy, ConstantIntTy, BasicBlockTy >::getCaseIndex(), llvm::SwitchInst::getCondition(), llvm::Value::getContext(), llvm::Function::getIntrinsicID(), llvm::SwitchInst::getNumCases(), LikelyBranchWeight, llvm::LLVMContext::MD_prof, llvm::SwitchInst::setCondition(), llvm::Instruction::setMetadata(), and UnlikelyBranchWeight.
Referenced by lowerExpectIntrinsic().
| INITIALIZE_PASS | ( | LowerExpectIntrinsic | , |
| "lower-expect" | , | ||
| "Lower 'expect' Intrinsics" | , | ||
| false | , | ||
| false | |||
| ) |
Definition at line 214 of file LowerExpectIntrinsic.cpp.
Definition at line 147 of file LowerExpectIntrinsic.cpp.
References llvm::dyn_cast(), llvm::Instruction::eraseFromParent(), llvm::CallInst::getArgOperand(), llvm::CallInst::getCalledFunction(), llvm::Function::getIntrinsicID(), handleBranchExpect(), handleBrSelExpect(), handleSwitchExpect(), llvm::Value::replaceAllUsesWith(), and SI.
Referenced by llvm::LowerExpectIntrinsicPass::run().
| STATISTIC | ( | ExpectIntrinsicsHandled | , |
| "Number of 'expect' intrinsic instructions handled" | |||
| ) |
|
static |
Referenced by handleBrSelExpect(), and handleSwitchExpect().
|
static |
Referenced by handleBrSelExpect(), and handleSwitchExpect().
1.8.6