Lines Matching full:cleanup
13 // A "cleanup" is a piece of code which needs to be executed whenever
152 EHCleanupScope *cleanup = dyn_cast<EHCleanupScope>(&*it); in containsOnlyLifetimeMarkers() local
153 if (!cleanup || !cleanup->isLifetimeMarker()) in containsOnlyLifetimeMarkers()
163 if (auto *cleanup = dyn_cast<EHCleanupScope>(&*find(si))) in requiresLandingPad() local
164 if (cleanup->isLifetimeMarker()) { in requiresLandingPad()
165 si = cleanup->getEnclosingEHScope(); in requiresLandingPad()
178 EHCleanupScope &cleanup = cast<EHCleanupScope>(*find(si)); in getInnermostActiveNormalCleanup() local
179 if (cleanup.isActive()) return si; in getInnermostActiveNormalCleanup()
180 si = cleanup.getEnclosingNormalCleanup(); in getInnermostActiveNormalCleanup()
214 EHCleanupScope &Cleanup = cast<EHCleanupScope>(*begin()); in popCleanup() local
215 InnermostNormalCleanup = Cleanup.getEnclosingNormalCleanup(); in popCleanup()
216 InnermostEHScope = Cleanup.getEnclosingEHScope(); in popCleanup()
217 deallocate(Cleanup.getAllocatedSize()); in popCleanup()
219 // Destroy the cleanup. in popCleanup()
220 Cleanup.Destroy(); in popCleanup()
267 /// fixups than the fixup depth on the innermost normal cleanup, or
268 /// else fixups that we try to add to that cleanup will end up in the
273 // normal cleanup; otherwise there really shouldn't be any fixups. in popNullFixups()
286 // Create a variable to decide whether the cleanup needs to be run. in initFullExprCleanup()
288 "cleanup.cond"); in initFullExprCleanup()
297 // Set that as the active flag in the cleanup. in initFullExprCleanup()
298 EHCleanupScope &cleanup = cast<EHCleanupScope>(*EHStack.begin()); in initFullExprCleanup() local
299 assert(!cleanup.hasActiveFlag() && "cleanup already has active flag?"); in initFullExprCleanup()
300 cleanup.setActiveFlag(active); in initFullExprCleanup()
302 if (cleanup.isNormalCleanup()) cleanup.setTestFlagInNormalCleanup(); in initFullExprCleanup()
303 if (cleanup.isEHCleanup()) cleanup.setTestFlagInEHCleanup(); in initFullExprCleanup()
306 void EHScopeStack::Cleanup::anchor() {} in anchor()
322 /// outermost normal cleanup; resolve them all by adding cases to the
336 // appropriate cleanup entry. This is required in the specific in ResolveAllBranchFixups()
340 // i.e. where there's an unresolved fixup inside a single cleanup in ResolveAllBranchFixups()
360 /// Transitions the terminator of the given exit-block of a cleanup to
361 /// be a cleanup switch.
372 "cleanup.dest", Term); in TransitionToCleanupSwitch()
420 /// Pops cleanup blocks until the given savepoint is reached.
428 // cleanup, we're going to emit another normal cleanup which in PopCleanupBlocks()
437 /// Pops cleanup blocks until the given savepoint is reached, then add the
449 "misaligned cleanup stack entry"); in PopCleanupBlocks()
469 Entry = CGF.createBasicBlock("cleanup"); in CreateNormalEntry()
475 /// Attempts to reduce a cleanup's entry block to a fallthrough. This
477 /// simplified/optimized for the tighter constraints on cleanup blocks.
489 // If we were previously inserting at the end of the cleanup entry in SimplifyCleanupEntry()
499 // are phis in the cleanup. in SimplifyCleanupEntry()
515 EHScopeStack::Cleanup *Fn, in EmitCleanup()
516 EHScopeStack::Cleanup::Flags flags, in EmitCleanup()
518 // If there's an active flag, load it and skip the cleanup if it's in EmitCleanup()
522 ContBB = CGF.createBasicBlock("cleanup.done"); in EmitCleanup()
523 llvm::BasicBlock *CleanupBB = CGF.createBasicBlock("cleanup.action"); in EmitCleanup()
525 = CGF.Builder.CreateLoad(ActiveFlag, "cleanup.is_active"); in EmitCleanup()
530 // Ask the cleanup to emit itself. in EmitCleanup()
532 assert(CGF.HaveInsertPoint() && "cleanup ended with no insertion point?"); in EmitCleanup()
542 // Exit is the exit block of a cleanup, so it always terminates in in ForwardPrebranchedFallthrough()
557 /// We don't need a normal entry block for the given cleanup.
562 /// exact ways in which we form branches to cleanup entries.
583 // The switch operand is a load from the cleanup-dest alloca. in destroyOptimisticNormalEntry()
600 /// Pops a cleanup block. If the block includes a normal cleanup, the
601 /// current insertion point is threaded through the cleanup, as are
602 /// any branch fixups on the cleanup.
604 assert(!EHStack.empty() && "cleanup stack is empty!"); in PopCleanupBlock()
605 assert(isa<EHCleanupScope>(*EHStack.begin()) && "top not a cleanup!"); in PopCleanupBlock()
618 // Check whether we need an EH cleanup. This is only true if we've in PopCleanupBlock()
619 // generated a lazy EH cleanup block. in PopCleanupBlock()
625 // Check the three conditions which might require a normal cleanup: in PopCleanupBlock()
627 // - whether there are branch fix-ups through this cleanup in PopCleanupBlock()
639 // end of the last cleanup, which points to the current scope. The in PopCleanupBlock()
645 // If this is a normal cleanup, then having a prebranched in PopCleanupBlock()
660 // cleanup, rewrite it so that it leads to the appropriate place. in PopCleanupBlock()
665 // cleanup, just forward it to the next block, leaving the in PopCleanupBlock()
671 // Otherwise, we need to make a new block. If the normal cleanup in PopCleanupBlock()
687 // If we don't need the cleanup at all, we're done. in PopCleanupBlock()
696 // Copy the cleanup emission data out. This uses either a stack in PopCleanupBlock()
705 EHScopeStack::Cleanup *Fn; in PopCleanupBlock()
709 Fn = reinterpret_cast<EHScopeStack::Cleanup *>(CleanupBufferStack.buffer); in PopCleanupBlock()
713 Fn = reinterpret_cast<EHScopeStack::Cleanup *>(CleanupBufferHeap.get()); in PopCleanupBlock()
716 EHScopeStack::Cleanup::Flags cleanupFlags; in PopCleanupBlock()
726 // If we have a fallthrough and no other need for the cleanup, in PopCleanupBlock()
737 // the cleanup block and then try to clean up after ourselves. in PopCleanupBlock()
746 // If there's a fallthrough, we need to store the cleanup in PopCleanupBlock()
753 // because the cleanup is inactive. in PopCleanupBlock()
755 assert(!IsActive && "source without fallthrough for active cleanup"); in PopCleanupBlock()
764 // III. Figure out where we're going and build the cleanup in PopCleanupBlock()
774 // to the enclosing cleanup in PopCleanupBlock()
793 // Clean up the possibly dead store to the cleanup dest slot. in PopCleanupBlock()
821 createLoadInstBefore(getNormalCleanupDestSlot(), "cleanup.dest", in PopCleanupBlock()
831 FallthroughDest = createBasicBlock("cleanup.cont"); in PopCleanupBlock()
851 // IV. Pop the cleanup and emit it. in PopCleanupBlock()
857 // Append the prepared cleanup prologue from above. in PopCleanupBlock()
879 // cleanup because the cleanup is inactive. in PopCleanupBlock()
888 // cleanup, but we're not supposed to branch through to the next in PopCleanupBlock()
889 // cleanup. in PopCleanupBlock()
895 // cleanup and then through to the next. in PopCleanupBlock()
922 // Emit the EH cleanup if required. in PopCleanupBlock()
947 // We only actually emit the cleanup code if the cleanup is either in PopCleanupBlock()
976 // Calculate the innermost active normal cleanup. in isObviouslyBranchWithoutCleanups()
980 // If we're not in an active normal cleanup scope, or if the in isObviouslyBranchWithoutCleanups()
981 // destination scope is within the innermost active normal cleanup in isObviouslyBranchWithoutCleanups()
993 /// the current cleanup-protected scope. The target scope may not yet
1007 // Calculate the innermost active normal cleanup. in EmitBranchThroughCleanup()
1011 // If we're not in an active normal cleanup scope, or if the in EmitBranchThroughCleanup()
1012 // destination scope is within the innermost active normal cleanup in EmitBranchThroughCleanup()
1020 // If we can't resolve the destination cleanup scope, just add this in EmitBranchThroughCleanup()
1021 // to the current cleanup scope as a branch fixup. in EmitBranchThroughCleanup()
1039 // Adjust BI to point to the first cleanup block. in EmitBranchThroughCleanup()
1055 // If this is the last cleanup we're propagating through, tell it in EmitBranchThroughCleanup()
1093 EHScopeStack::stable_iterator cleanup) { in IsUsedAsEHCleanup() argument
1095 if (EHStack.find(cleanup)->hasEHBranches()) in IsUsedAsEHCleanup()
1100 i = EHStack.getInnermostEHScope(); i != cleanup; ) { in IsUsedAsEHCleanup()
1101 assert(cleanup.strictlyEncloses(i)); in IsUsedAsEHCleanup()
1118 /// The given cleanup block is changing activation state. Configure a
1119 /// cleanup variable if necessary.
1129 // We always need the flag if we're activating the cleanup in a in SetupCleanupBlockActivation()
1131 // location doesn't necessarily dominate the cleanup's code. in SetupCleanupBlockActivation()
1137 // Calculate whether the cleanup was used: in SetupCleanupBlockActivation()
1139 // - as a normal cleanup in SetupCleanupBlockActivation()
1146 // - as an EH cleanup in SetupCleanupBlockActivation()
1159 "cleanup.isactive"); in SetupCleanupBlockActivation()
1180 /// Activate a cleanup that was created in an inactivated state.
1192 /// Deactive a cleanup that was created in an active state.
1201 // If it's a normal cleanup, we need to pretend that the in DeactivateCleanupBlock()
1218 CreateTempAlloca(Builder.getInt32Ty(), "cleanup.dest.slot"); in getNormalCleanupDestSlot()