Lines Matching full:cleanup
12 // A "cleanup" is a piece of code which needs to be executed whenever
118 EHCleanupScope *cleanup = dyn_cast<EHCleanupScope>(&*it); in containsOnlyLifetimeMarkers() local
119 if (!cleanup || !cleanup->isLifetimeMarker()) in containsOnlyLifetimeMarkers()
129 if (auto *cleanup = dyn_cast<EHCleanupScope>(&*find(si))) in requiresLandingPad() local
130 if (cleanup->isLifetimeMarker()) { in requiresLandingPad()
131 si = cleanup->getEnclosingEHScope(); in requiresLandingPad()
144 EHCleanupScope &cleanup = cast<EHCleanupScope>(*find(si)); in getInnermostActiveNormalCleanup() local
145 if (cleanup.isActive()) return si; in getInnermostActiveNormalCleanup()
146 si = cleanup.getEnclosingNormalCleanup(); in getInnermostActiveNormalCleanup()
160 // terminate is the current EH scope, we may skip adding any EH cleanup in pushCleanup()
197 EHCleanupScope &Cleanup = cast<EHCleanupScope>(*begin()); in popCleanup() local
198 InnermostNormalCleanup = Cleanup.getEnclosingNormalCleanup(); in popCleanup()
199 InnermostEHScope = Cleanup.getEnclosingEHScope(); in popCleanup()
200 deallocate(Cleanup.getAllocatedSize()); in popCleanup()
202 // Destroy the cleanup. in popCleanup()
203 Cleanup.Destroy(); in popCleanup()
250 /// fixups than the fixup depth on the innermost normal cleanup, or
251 /// else fixups that we try to add to that cleanup will end up in the
256 // normal cleanup; otherwise there really shouldn't be any fixups. in popNullFixups()
269 // Create a variable to decide whether the cleanup needs to be run. in createCleanupActiveFlag()
271 Builder.getInt1Ty(), CharUnits::One(), "cleanup.cond"); in createCleanupActiveFlag()
284 // Set that as the active flag in the cleanup. in initFullExprCleanupWithFlag()
285 EHCleanupScope &cleanup = cast<EHCleanupScope>(*EHStack.begin()); in initFullExprCleanupWithFlag() local
286 assert(!cleanup.hasActiveFlag() && "cleanup already has active flag?"); in initFullExprCleanupWithFlag()
287 cleanup.setActiveFlag(ActiveFlag); in initFullExprCleanupWithFlag()
289 if (cleanup.isNormalCleanup()) cleanup.setTestFlagInNormalCleanup(); in initFullExprCleanupWithFlag()
290 if (cleanup.isEHCleanup()) cleanup.setTestFlagInEHCleanup(); in initFullExprCleanupWithFlag()
293 void EHScopeStack::Cleanup::anchor() {} in anchor()
311 /// outermost normal cleanup; resolve them all by adding cases to the
325 // appropriate cleanup entry. This is required in the specific in ResolveAllBranchFixups()
329 // i.e. where there's an unresolved fixup inside a single cleanup in ResolveAllBranchFixups()
349 /// Transitions the terminator of the given exit-block of a cleanup to
350 /// be a cleanup switch.
361 "cleanup.dest", Term, CGF); in TransitionToCleanupSwitch()
409 /// Pops cleanup blocks until the given savepoint is reached.
421 // cleanup, we're going to emit another normal cleanup which in PopCleanupBlocks()
464 /// Pops cleanup blocks until the given savepoint is reached, then add the
476 "misaligned cleanup stack entry"); in PopCleanupBlocks()
503 Entry = CGF.createBasicBlock("cleanup"); in CreateNormalEntry()
509 /// Attempts to reduce a cleanup's entry block to a fallthrough. This
511 /// simplified/optimized for the tighter constraints on cleanup blocks.
523 // If we were previously inserting at the end of the cleanup entry in SimplifyCleanupEntry()
533 // are phis in the cleanup. in SimplifyCleanupEntry()
549 EHScopeStack::Cleanup *Fn, in EmitCleanup()
550 EHScopeStack::Cleanup::Flags flags, in EmitCleanup()
552 // If there's an active flag, load it and skip the cleanup if it's in EmitCleanup()
556 ContBB = CGF.createBasicBlock("cleanup.done"); in EmitCleanup()
557 llvm::BasicBlock *CleanupBB = CGF.createBasicBlock("cleanup.action"); in EmitCleanup()
559 = CGF.Builder.CreateLoad(ActiveFlag, "cleanup.is_active"); in EmitCleanup()
564 // Ask the cleanup to emit itself. in EmitCleanup()
566 assert(CGF.HaveInsertPoint() && "cleanup ended with no insertion point?"); in EmitCleanup()
576 // Exit is the exit block of a cleanup, so it always terminates in in ForwardPrebranchedFallthrough()
591 /// We don't need a normal entry block for the given cleanup.
596 /// exact ways in which we form branches to cleanup entries.
617 // The switch operand is a load from the cleanup-dest alloca. in destroyOptimisticNormalEntry()
634 /// Pops a cleanup block. If the block includes a normal cleanup, the
635 /// current insertion point is threaded through the cleanup, as are
636 /// any branch fixups on the cleanup.
639 assert(!EHStack.empty() && "cleanup stack is empty!"); in PopCleanupBlock()
640 assert(isa<EHCleanupScope>(*EHStack.begin()) && "top not a cleanup!"); in PopCleanupBlock()
644 // If we are deactivating a normal cleanup, we need to pretend that the in PopCleanupBlock()
659 // Check whether we need an EH cleanup. This is only true if we've in PopCleanupBlock()
660 // generated a lazy EH cleanup block. in PopCleanupBlock()
666 // Check the three conditions which might require a normal cleanup: in PopCleanupBlock()
668 // - whether there are branch fix-ups through this cleanup in PopCleanupBlock()
681 // end of the last cleanup, which points to the current scope. The in PopCleanupBlock()
687 // If this is a normal cleanup, then having a prebranched in PopCleanupBlock()
702 // cleanup, rewrite it so that it leads to the appropriate place. in PopCleanupBlock()
711 // cleanup, just forward it to the next block, leaving the in PopCleanupBlock()
717 // Otherwise, we need to make a new block. If the normal cleanup in PopCleanupBlock()
733 // If we don't need the cleanup at all, we're done. in PopCleanupBlock()
744 // Copy the cleanup emission data out. This uses either a stack in PopCleanupBlock()
754 EHScopeStack::Cleanup *Fn; in PopCleanupBlock()
758 Fn = reinterpret_cast<EHScopeStack::Cleanup *>(CleanupBufferStack); in PopCleanupBlock()
762 Fn = reinterpret_cast<EHScopeStack::Cleanup *>(CleanupBufferHeap.get()); in PopCleanupBlock()
765 EHScopeStack::Cleanup::Flags cleanupFlags; in PopCleanupBlock()
776 // per Windows ABI which is "normally" Cleanup in callee in PopCleanupBlock()
778 // If we are deactivating a normal cleanup then we don't have a in PopCleanupBlock()
792 // If we have a fallthrough and no other need for the cleanup, in PopCleanupBlock()
812 // the cleanup block and then try to clean up after ourselves. in PopCleanupBlock()
821 // If there's a fallthrough, we need to store the cleanup in PopCleanupBlock()
828 // because the cleanup is inactive. in PopCleanupBlock()
830 assert(!IsActive && "source without fallthrough for active cleanup"); in PopCleanupBlock()
839 // intercept normal cleanup to mark SEH scope end in PopCleanupBlock()
847 // III. Figure out where we're going and build the cleanup in PopCleanupBlock()
857 // to the enclosing cleanup in PopCleanupBlock()
881 // Clean up the possibly dead store to the cleanup dest slot. in PopCleanupBlock()
908 // pass the abnormal exit flag to Fn (SEH cleanup) in PopCleanupBlock()
912 getNormalCleanupDestSlot(), "cleanup.dest", nullptr, *this); in PopCleanupBlock()
921 FallthroughDest = createBasicBlock("cleanup.cont"); in PopCleanupBlock()
941 // IV. Pop the cleanup and emit it. in PopCleanupBlock()
948 // Append the prepared cleanup prologue from above. in PopCleanupBlock()
970 // cleanup because the cleanup is inactive. in PopCleanupBlock()
979 // cleanup, but we're not supposed to branch through to the next in PopCleanupBlock()
980 // cleanup. in PopCleanupBlock()
986 // cleanup and then through to the next. in PopCleanupBlock()
1015 // Emit the EH cleanup if required. in PopCleanupBlock()
1038 // Non-MSVC personalities need to terminate when an EH cleanup throws. in PopCleanupBlock()
1046 // We only actually emit the cleanup code if the cleanup is either in PopCleanupBlock()
1075 // Calculate the innermost active normal cleanup. in isObviouslyBranchWithoutCleanups()
1079 // If we're not in an active normal cleanup scope, or if the in isObviouslyBranchWithoutCleanups()
1080 // destination scope is within the innermost active normal cleanup in isObviouslyBranchWithoutCleanups()
1092 /// the current cleanup-protected scope. The target scope may not yet
1106 // Calculate the innermost active normal cleanup. in EmitBranchThroughCleanup()
1110 // If we're not in an active normal cleanup scope, or if the in EmitBranchThroughCleanup()
1111 // destination scope is within the innermost active normal cleanup in EmitBranchThroughCleanup()
1119 // If we can't resolve the destination cleanup scope, just add this in EmitBranchThroughCleanup()
1120 // to the current cleanup scope as a branch fixup. in EmitBranchThroughCleanup()
1138 // Adjust BI to point to the first cleanup block. in EmitBranchThroughCleanup()
1154 // If this is the last cleanup we're propagating through, tell it in EmitBranchThroughCleanup()
1173 EHScopeStack::stable_iterator cleanup) { in IsUsedAsEHCleanup() argument
1175 if (EHStack.find(cleanup)->hasEHBranches()) in IsUsedAsEHCleanup()
1180 i = EHStack.getInnermostEHScope(); i != cleanup; ) { in IsUsedAsEHCleanup()
1181 assert(cleanup.strictlyEncloses(i)); in IsUsedAsEHCleanup()
1198 /// The given cleanup block is changing activation state. Configure a
1199 /// cleanup variable if necessary.
1209 // We always need the flag if we're activating the cleanup in a in SetupCleanupBlockActivation()
1211 // location doesn't necessarily dominate the cleanup's code. in SetupCleanupBlockActivation()
1217 // Calculate whether the cleanup was used: in SetupCleanupBlockActivation()
1219 // - as a normal cleanup in SetupCleanupBlockActivation()
1225 // - as an EH cleanup in SetupCleanupBlockActivation()
1240 "cleanup.isactive"); in SetupCleanupBlockActivation()
1262 /// Activate a cleanup that was created in an inactivated state.
1274 /// Deactive a cleanup that was created in an active state.
1299 CreateDefaultAlignTempAlloca(Builder.getInt32Ty(), "cleanup.dest.slot"); in getNormalCleanupDestSlot()