Home | History | Annotate | Download | only in CodeGen

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);
153 if (!cleanup || !cleanup->isLifetimeMarker())
163 if (auto *cleanup = dyn_cast<EHCleanupScope>(&*find(si)))
164 if (cleanup->isLifetimeMarker()) {
165 si = cleanup->getEnclosingEHScope();
178 EHCleanupScope &cleanup = cast<EHCleanupScope>(*find(si));
179 if (cleanup.isActive()) return si;
180 si = cleanup.getEnclosingNormalCleanup();
214 EHCleanupScope &Cleanup = cast<EHCleanupScope>(*begin());
215 InnermostNormalCleanup = Cleanup.getEnclosingNormalCleanup();
216 InnermostEHScope = Cleanup.getEnclosingEHScope();
217 deallocate(Cleanup.getAllocatedSize());
219 // Destroy the cleanup.
220 Cleanup.Destroy();
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.
286 // Create a variable to decide whether the cleanup needs to be run.
288 "cleanup.cond");
297 // Set that as the active flag in the cleanup.
298 EHCleanupScope &cleanup = cast<EHCleanupScope>(*EHStack.begin());
299 assert(!cleanup.hasActiveFlag() && "cleanup already has active flag?");
300 cleanup.setActiveFlag(active);
302 if (cleanup.isNormalCleanup()) cleanup.setTestFlagInNormalCleanup();
303 if (cleanup.isEHCleanup()) cleanup.setTestFlagInEHCleanup();
306 void EHScopeStack::Cleanup::anchor() {}
322 /// outermost normal cleanup; resolve them all by adding cases to the
336 // appropriate cleanup entry. This is required in the specific
340 // i.e. where there's an unresolved fixup inside a single cleanup
360 /// Transitions the terminator of the given exit-block of a cleanup to
361 /// be a cleanup switch.
372 "cleanup.dest", Term);
420 /// Pops cleanup blocks until the given savepoint is reached.
428 // cleanup, we're going to emit another normal cleanup which
437 /// Pops cleanup blocks until the given savepoint is reached, then add the
449 "misaligned cleanup stack entry");
469 Entry = CGF.createBasicBlock("cleanup");
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
499 // are phis in the cleanup.
515 EHScopeStack::Cleanup *Fn,
516 EHScopeStack::Cleanup::Flags flags,
518 // If there's an active flag, load it and skip the cleanup if it's
522 ContBB = CGF.createBasicBlock("cleanup.done");
523 llvm::BasicBlock *CleanupBB = CGF.createBasicBlock("cleanup.action");
525 = CGF.Builder.CreateLoad(ActiveFlag, "cleanup.is_active");
530 // Ask the cleanup to emit itself.
532 assert(CGF.HaveInsertPoint() && "cleanup ended with no insertion point?");
542 // Exit is the exit block of a cleanup, so it always terminates in
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.
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!");
605 assert(isa<EHCleanupScope>(*EHStack.begin()) && "top not a cleanup!");
618 // Check whether we need an EH cleanup. This is only true if we've
619 // generated a lazy EH cleanup block.
625 // Check the three conditions which might require a normal cleanup:
627 // - whether there are branch fix-ups through this cleanup
639 // end of the last cleanup, which points to the current scope. The
645 // If this is a normal cleanup, then having a prebranched
660 // cleanup, rewrite it so that it leads to the appropriate place.
665 // cleanup, just forward it to the next block, leaving the
671 // Otherwise, we need to make a new block. If the normal cleanup
687 // If we don't need the cleanup at all, we're done.
696 // Copy the cleanup emission data out. This uses either a stack
705 EHScopeStack::Cleanup *Fn;
709 Fn = reinterpret_cast<EHScopeStack::Cleanup *>(CleanupBufferStack.buffer);
713 Fn = reinterpret_cast<EHScopeStack::Cleanup *>(CleanupBufferHeap.get());
716 EHScopeStack::Cleanup::Flags cleanupFlags;
726 // If we have a fallthrough and no other need for the cleanup,
737 // the cleanup block and then try to clean up after ourselves.
746 // If there's a fallthrough, we need to store the cleanup
753 // because the cleanup is inactive.
755 assert(!IsActive && "source without fallthrough for active cleanup");
764 // III. Figure out where we're going and build the cleanup
774 // to the enclosing cleanup
793 // Clean up the possibly dead store to the cleanup dest slot.
821 createLoadInstBefore(getNormalCleanupDestSlot(), "cleanup.dest",
831 FallthroughDest = createBasicBlock("cleanup.cont");
851 // IV. Pop the cleanup and emit it.
857 // Append the prepared cleanup prologue from above.
879 // cleanup because the cleanup is inactive.
888 // cleanup, but we're not supposed to branch through to the next
889 // cleanup.
895 // cleanup and then through to the next.
922 // Emit the EH cleanup if required.
947 // We only actually emit the cleanup code if the cleanup is either
976 // Calculate the innermost active normal cleanup.
980 // If we're not in an active normal cleanup scope, or if the
981 // destination scope is within the innermost active normal cleanup
993 /// the current cleanup-protected scope. The target scope may not yet
1007 // Calculate the innermost active normal cleanup.
1011 // If we're not in an active normal cleanup scope, or if the
1012 // destination scope is within the innermost active normal cleanup
1020 // If we can't resolve the destination cleanup scope, just add this
1021 // to the current cleanup scope as a branch fixup.
1039 // Adjust BI to point to the first cleanup block.
1055 // If this is the last cleanup we're propagating through, tell it
1093 EHScopeStack::stable_iterator cleanup) {
1095 if (EHStack.find(cleanup)->hasEHBranches())
1100 i = EHStack.getInnermostEHScope(); i != cleanup; ) {
1101 assert(cleanup.strictlyEncloses(i));
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
1131 // location doesn't necessarily dominate the cleanup's code.
1137 // Calculate whether the cleanup was used:
1139 // - as a normal cleanup
1146 // - as an EH cleanup
1159 "cleanup.isactive");
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
1218 CreateTempAlloca(Builder.getInt32Ty(), "cleanup.dest.slot");