LLVM: lib/Transforms/Scalar/PlaceSafepoints.cpp File Reference (original) (raw)

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 (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 (Function &F)
static bool enableBackedgeSafepoints (Function &F)
static bool enableCallSafepoints (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
static cl::opt< bool > AllBackedges ("spp-all-backedges", cl::Hidden, cl::init(false))
static cl::opt< int > CountedLoopTripWidth ("spp-counted-loop-trip-width", cl::Hidden, cl::init(32))
How narrow does the trip count of a loop have to be to have to be considered "counted"?
static cl::opt< bool > SplitBackedge ("spp-split-backedge", cl::Hidden, cl::init(false))
static cl::opt< bool > NoEntry ("spp-no-entry", cl::Hidden, cl::init(false))
static cl::opt< bool > NoCall ("spp-no-call", cl::Hidden, cl::init(false))
static cl::opt< bool > NoBackedge ("spp-no-backedge", cl::Hidden, cl::init(false))
place backedge safepoints impl
place backedge safepoints Place Backedge Safepoints
place backedge safepoints Place Backedge false
const char GCSafepointPollName [] = "gc.safepoint_poll"

DEBUG_TYPE

#define DEBUG_TYPE "place-safepoints"

containsUnconditionalCallSafepoint()

doesNotRequireEntrySafepointBefore()

bool doesNotRequireEntrySafepointBefore ( CallBase * Call) static

enableBackedgeSafepoints()

enableCallSafepoints()

enableEntrySafepoints()

findLocationForEntrySafepoint()

INITIALIZE_PASS_BEGIN()

INITIALIZE_PASS_BEGIN ( PlaceBackedgeSafepointsLegacyPass ,
"place-backedge-safepoints-impl" ,
"Place Backedge Safepoints" ,
false ,
false )

InsertSafepointPoll()

Definition at line 620 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().

isGCSafepointPoll()

mustBeFiniteCountedLoop()

needsStatepoint()

scanInlinedCode()

scanOneBB()

shouldRewriteFunction()

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 598 of file PlaceSafepoints.cpp.

References F.

Referenced by llvm::PlaceSafepointsPass::runImpl().

STATISTIC() [1/4]

STATISTIC ( CallInLoop ,
"Number of loops without safepoints due to calls in loop" )

STATISTIC() [2/4]

STATISTIC ( FiniteExecution ,
"Number of loops without safepoints finite execution" )

STATISTIC() [3/4]

STATISTIC ( NumBackedgeSafepoints ,
"Number of backedge safepoints inserted" )

STATISTIC() [4/4]

STATISTIC ( NumEntrySafepoints ,
"Number of entry safepoints inserted" )

AllBackedges

cl::opt< bool > AllBackedges("spp-all-backedges", cl::Hidden, cl::init(false)) ( "spp-all-backedges" , cl::Hidden , cl::init(false) ) static

CountedLoopTripWidth

cl::opt< int > CountedLoopTripWidth("spp-counted-loop-trip-width", cl::Hidden, cl::init(32)) ( "spp-counted-loop-trip-width" , cl::Hidden , cl::init(32) ) static

How narrow does the trip count of a loop have to be to have to be considered "counted"?

Counted loops do not get safepoints at backedges.

Referenced by mustBeFiniteCountedLoop().

false

place backedge safepoints Place Backedge false

GCSafepointPollName

const char GCSafepointPollName[] = "gc.safepoint_poll"

impl

place backedge safepoints impl

NoBackedge

cl::opt< bool > NoBackedge("spp-no-backedge", cl::Hidden, cl::init(false)) ( "spp-no-backedge" , cl::Hidden , cl::init(false) ) static

NoCall

cl::opt< bool > NoCall("spp-no-call", cl::Hidden, cl::init(false)) ( "spp-no-call" , cl::Hidden , cl::init(false) ) static

NoEntry

cl::opt< bool > NoEntry("spp-no-entry", cl::Hidden, cl::init(false)) ( "spp-no-entry" , cl::Hidden , cl::init(false) ) static

Safepoints

place backedge safepoints Place Backedge Safepoints

SplitBackedge

cl::opt< bool > SplitBackedge("spp-split-backedge", cl::Hidden, cl::init(false)) ( "spp-split-backedge" , cl::Hidden , cl::init(false) ) static