void initializePhiValuesWrapperPassPass(PassRegistry&);
void initializePhysicalRegisterUsageInfoPass(PassRegistry&);
void initializePlaceBackedgeSafepointsLegacyPassPass(PassRegistry &);
-void initializePlaceSafepointsLegacyPassPass(PassRegistry &);
void initializePostDomOnlyPrinterWrapperPassPass(PassRegistry &);
void initializePostDomOnlyViewerWrapperPassPass(PassRegistry &);
void initializePostDomPrinterWrapperPassPass(PassRegistry &);
//===----------------------------------------------------------------------===//
//
-// PlaceSafepoints - Rewrite any IR calls to gc.statepoints and insert any
-// safepoint polls (method entry, backedge) that might be required. This pass
-// does not generate explicit relocation sequences - that's handled by
-// RewriteStatepointsForGC which can be run at an arbitrary point in the pass
-// order following this pass.
-//
-FunctionPass *createPlaceSafepointsPass();
-
-//===----------------------------------------------------------------------===//
-//
// NaryReassociate - Simplify n-ary operations by reassociation.
//
FunctionPass *createNaryReassociatePass();
return false;
}
-namespace {
-class PlaceSafepointsLegacyPass : public FunctionPass {
-public:
- static char ID; // Pass identification, replacement for typeid
-
- PlaceSafepointsLegacyPass() : FunctionPass(ID) {
- initializePlaceSafepointsLegacyPassPass(*PassRegistry::getPassRegistry());
- }
-
- bool runOnFunction(Function &F) override;
-
- StringRef getPassName() const override { return "Safepoint Placement"; }
-
- void getAnalysisUsage(AnalysisUsage &AU) const override {
- // We modify the graph wholesale (inlining, block insertion, etc). We
- // preserve nothing at the moment. We could potentially preserve dom tree
- // if that was worth doing
- AU.addRequired<TargetLibraryInfoWrapperPass>();
- }
-
-private:
- PlaceSafepointsPass Impl;
-};
-} // end anonymous namespace
-
-char PlaceSafepointsLegacyPass::ID = 0;
-
-INITIALIZE_PASS_BEGIN(PlaceSafepointsLegacyPass, "place-safepoints",
- "Place Safepoints", false, false)
-INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass)
-INITIALIZE_PASS_END(PlaceSafepointsLegacyPass, "place-safepoints",
- "Place Safepoints", false, false)
-
-FunctionPass *llvm::createPlaceSafepointsPass() {
- return new PlaceSafepointsLegacyPass();
-}
-
-bool PlaceSafepointsLegacyPass::runOnFunction(Function &F) {
- if (skipFunction(F))
- return false;
-
- LLVM_DEBUG(dbgs() << "********** Begin Safepoint Placement **********\n");
- LLVM_DEBUG(dbgs() << "********** Function: " << F.getName() << '\n');
-
- bool MadeChange =
- Impl.runImpl(F, getAnalysis<TargetLibraryInfoWrapperPass>().getTLI(F));
-
- if (MadeChange) {
- LLVM_DEBUG(dbgs() << "********** Function after Safepoint Placement: "
- << F.getName() << '\n');
- LLVM_DEBUG(dbgs() << F);
- }
- LLVM_DEBUG(dbgs() << "********** End Safepoint Placement **********\n");
-
- return MadeChange;
-}
-
bool PlaceSafepointsPass::runImpl(Function &F, const TargetLibraryInfo &TLI) {
if (F.isDeclaration() || F.empty()) {
// This is a declaration, nothing to do. Must exit early to avoid crash in