|
LLVM 24.0.0git
|
#include "llvm/Transforms/Scalar/PlaceSafepoints.h"#include "ScalarOptions.h"#include "llvm/InitializePasses.h"#include "llvm/Pass.h"#include "llvm/ADT/SetVector.h"#include "llvm/ADT/Statistic.h"#include "llvm/Analysis/CFG.h"#include "llvm/Analysis/LoopInfo.h"#include "llvm/Analysis/ScalarEvolution.h"#include "llvm/Analysis/TargetLibraryInfo.h"#include "llvm/IR/Dominators.h"#include "llvm/IR/IntrinsicInst.h"#include "llvm/IR/LegacyPassManager.h"#include "llvm/IR/Module.h"#include "llvm/IR/Statepoint.h"#include "llvm/Support/Debug.h"#include "llvm/Transforms/Scalar.h"#include "llvm/Transforms/Utils/BasicBlockUtils.h"#include "llvm/Transforms/Utils/Cloning.h"#include "llvm/Transforms/Utils/Local.h"Go to the source code of this file.
Macros | |
| #define | DEBUG_TYPE "place-safepoints" |
Functions | |
| STATISTIC (NumEntrySafepoints, "Number of entry safepoints inserted") | |
| STATISTIC (NumBackedgeSafepoints, "Number of backedge safepoints inserted") | |
| STATISTIC (CallInLoop, "Number of loops without safepoints due to calls in loop") | |
| STATISTIC (FiniteExecution, "Number of loops without safepoints finite execution") | |
| INITIALIZE_PASS_BEGIN (PlaceBackedgeSafepointsLegacyPass, "place-backedge-safepoints-impl", "Place Backedge Safepoints", false, false) INITIALIZE_PASS_END(PlaceBackedgeSafepointsLegacyPass | |
| place backedge safepoints Place Backedge static false bool | containsUnconditionalCallSafepoint (Loop *L, BasicBlock *Header, BasicBlock *Pred, DominatorTree &DT, const TargetLibraryInfo &TLI) |
| Returns true if this loop is known to contain a call safepoint which must unconditionally execute on any iteration of the loop which returns to the loop header via an edge from Pred. | |
| static bool | mustBeFiniteCountedLoop (const ScalarOptions &Opts, Loop *L, ScalarEvolution *SE, BasicBlock *Pred) |
| Returns true if this loop is known to terminate in a finite number of iterations. | |
| static Instruction * | findLocationForEntrySafepoint (Function &F, DominatorTree &DT) |
| static bool | isGCSafepointPoll (Function &F) |
| static bool | shouldRewriteFunction (Function &F) |
| Returns true if this function should be rewritten to include safepoint polls and parseable call sites. | |
| static bool | enableEntrySafepoints (const ScalarOptions &Opts, Function &F) |
| static bool | enableBackedgeSafepoints (const ScalarOptions &Opts, Function &F) |
| static bool | enableCallSafepoints (const ScalarOptions &Opts, Function &F) |
| static void | InsertSafepointPoll (BasicBlock::iterator InsertBefore, std::vector< CallBase * > &ParsePointsNeeded, const TargetLibraryInfo &TLI) |
| static bool | needsStatepoint (CallBase *Call, const TargetLibraryInfo &TLI) |
| static void | scanOneBB (Instruction *Start, Instruction *End, std::vector< CallInst * > &Calls, DenseSet< BasicBlock * > &Seen, std::vector< BasicBlock * > &Worklist) |
| static void | scanInlinedCode (Instruction *Start, Instruction *End, std::vector< CallInst * > &Calls, DenseSet< BasicBlock * > &Seen) |
| static bool | doesNotRequireEntrySafepointBefore (CallBase *Call) |
| Returns true if an entry safepoint is not required before this callsite in the caller function. | |
Variables | |
| place backedge safepoints | impl |
| place backedge safepoints Place Backedge | Safepoints |
| place backedge safepoints Place Backedge | false |
| const char | GCSafepointPollName [] = "gc.safepoint_poll" |
| #define DEBUG_TYPE "place-safepoints" |
Definition at line 74 of file PlaceSafepoints.cpp.
|
static |
Returns true if this loop is known to contain a call safepoint which must unconditionally execute on any iteration of the loop which returns to the loop header via an edge from Pred.
Returns a conservative correct answer; i.e. false is always valid.
Definition at line 385 of file PlaceSafepoints.cpp.
References assert(), Call, llvm::DominatorTree::dominates(), llvm::dyn_cast(), llvm::DomTreeNodeBase< NodeT >::getBlock(), llvm::DomTreeNodeBase< NodeT >::getIDom(), llvm::DominatorTreeBase< NodeT, IsPostDom >::getNode(), I, and needsStatepoint().
Returns true if an entry safepoint is not required before this callsite in the caller function.
Definition at line 495 of file PlaceSafepoints.cpp.
References Call, llvm::dyn_cast(), and II.
Referenced by findLocationForEntrySafepoint().
Definition at line 597 of file PlaceSafepoints.cpp.
References F.
Referenced by llvm::PlaceSafepointsPass::runImpl().
Definition at line 600 of file PlaceSafepoints.cpp.
References F.
Referenced by llvm::PlaceSafepointsPass::runImpl().
Definition at line 594 of file PlaceSafepoints.cpp.
References F.
Referenced by llvm::PlaceSafepointsPass::runImpl().
|
static |
Definition at line 518 of file PlaceSafepoints.cpp.
References assert(), Call, doesNotRequireEntrySafepointBefore(), llvm::dyn_cast(), F, llvm::BasicBlock::getUniquePredecessor(), and I.
Referenced by llvm::PlaceSafepointsPass::runImpl().
| INITIALIZE_PASS_BEGIN | ( | PlaceBackedgeSafepointsLegacyPass | , |
| "place-backedge-safepoints-impl" | , | ||
| "Place Backedge Safepoints" | , | ||
| false | , | ||
| false | ) |
References INITIALIZE_PASS_DEPENDENCY, and INITIALIZE_PASS_END.
|
static |
Definition at line 608 of file PlaceSafepoints.cpp.
References assert(), llvm::BasicBlock::begin(), llvm::CallInst::Create(), llvm::BasicBlock::end(), F, GCSafepointPollName, llvm::FunctionType::get(), llvm::BasicBlock::getParent(), llvm::Type::getVoidTy(), llvm::InlineFunction(), llvm::isPotentiallyReachable(), llvm::InlineResult::isSuccess(), needsStatepoint(), scanInlinedCode(), and llvm::InlineFunctionInfo::StaticAllocas.
Referenced by llvm::PlaceSafepointsPass::runImpl().
Definition at line 573 of file PlaceSafepoints.cpp.
References F, and GCSafepointPollName.
Referenced by llvm::PlaceSafepointsPass::runImpl().
|
static |
Returns true if this loop is known to terminate in a finite number of iterations.
Note that this function may return false for a loop which does actual terminate in a finite constant number of iterations due to conservatism in the analysis.
Definition at line 427 of file PlaceSafepoints.cpp.
References llvm::ScalarEvolution::getConstantMaxBackedgeTakenCount(), llvm::ScalarEvolution::getExitCount(), llvm::ConstantRange::getUnsignedMax(), llvm::ScalarEvolution::getUnsignedRange(), llvm::isa(), and llvm::APInt::isIntN().
|
static |
Definition at line 369 of file PlaceSafepoints.cpp.
References Call, llvm::callsGCLeafFunction(), llvm::dyn_cast(), and llvm::isa().
Referenced by containsUnconditionalCallSafepoint(), and InsertSafepointPoll().
|
static |
Definition at line 479 of file PlaceSafepoints.cpp.
References llvm::BasicBlock::begin(), llvm::End, llvm::detail::DenseSetImpl< ValueT, MapTy >::insert(), and scanOneBB().
Referenced by InsertSafepointPoll().
|
static |
Definition at line 452 of file PlaceSafepoints.cpp.
References assert(), llvm::dyn_cast(), llvm::End, llvm::BasicBlock::getParent(), llvm::detail::DenseSetImpl< ValueT, MapTy >::insert(), llvm::isa(), and llvm::successors().
Referenced by scanInlinedCode().
Returns true if this function should be rewritten to include safepoint polls and parseable call sites.
The main point of this function is to be an extension point for custom logic.
Definition at line 580 of file PlaceSafepoints.cpp.
References F.
Referenced by llvm::PlaceSafepointsPass::runImpl().
| STATISTIC | ( | CallInLoop | , |
| "Number of loops without safepoints due to calls in loop" | ) |
| STATISTIC | ( | FiniteExecution | , |
| "Number of loops without safepoints finite execution" | ) |
References llvm::PassRegistry::getPassRegistry(), and llvm::Global.
| STATISTIC | ( | NumBackedgeSafepoints | , |
| "Number of backedge safepoints inserted" | ) |
| STATISTIC | ( | NumEntrySafepoints | , |
| "Number of entry safepoints inserted" | ) |
| place backedge safepoints Place Backedge false |
Definition at line 155 of file PlaceSafepoints.cpp.
Definition at line 571 of file PlaceSafepoints.cpp.
Referenced by InsertSafepointPoll(), and isGCSafepointPoll().
| place backedge safepoints impl |
Definition at line 154 of file PlaceSafepoints.cpp.
| place backedge safepoints Place Backedge Safepoints |
Definition at line 155 of file PlaceSafepoints.cpp.