Home | History | Annotate | Download | only in CodeGen

Lines Matching refs:cleanup

13 // A "cleanup" is a piece of code which needs to be executed whenever
124 EHCleanupScope &cleanup = cast<EHCleanupScope>(*find(si));
125 if (cleanup.isActive()) return si;
126 si = cleanup.getEnclosingNormalCleanup();
135 EHCleanupScope *cleanup = dyn_cast<EHCleanupScope>(&*find(si));
136 if (cleanup && !cleanup->isActive()) {
137 si = cleanup->getEnclosingEHScope();
150 assert(((Size % sizeof(void*)) == 0) && "cleanup type is misaligned");
175 EHCleanupScope &Cleanup = cast<EHCleanupScope>(*begin());
176 InnermostNormalCleanup = Cleanup.getEnclosingNormalCleanup();
177 InnermostEHScope = Cleanup.getEnclosingEHScope();
178 StartOfData += Cleanup.getAllocatedSize();
180 // Destroy the cleanup.
181 Cleanup.~EHCleanupScope();
228 /// fixups than the fixup depth on the innermost normal cleanup, or
229 /// else fixups that we try to add to that cleanup will end up in the
234 // normal cleanup; otherwise there really shouldn't be any fixups.
247 // Create a variable to decide whether the cleanup needs to be run.
249 = CreateTempAlloca(Builder.getInt1Ty(), "cleanup.cond");
258 // Set that as the active flag in the cleanup.
259 EHCleanupScope &cleanup = cast<EHCleanupScope>(*EHStack.begin());
260 assert(cleanup.getActiveFlag() == 0 && "cleanup already has active flag?");
261 cleanup.setActiveFlag(active);
263 if (cleanup.isNormalCleanup()) cleanup.setTestFlagInNormalCleanup();
264 if (cleanup.isEHCleanup()) cleanup.setTestFlagInEHCleanup();
267 void EHScopeStack::Cleanup::anchor() {}
270 /// outermost normal cleanup; resolve them all by adding cases to the
284 // appropriate cleanup entry. This is required in the specific
288 // i.e. where there's an unresolved fixup inside a single cleanup
307 /// Transitions the terminator of the given exit-block of a cleanup to
308 /// be a cleanup switch.
319 new llvm::LoadInst(CGF.getNormalCleanupDestSlot(), "cleanup.dest", Term);
367 /// Pops cleanup blocks until the given savepoint is reached.
375 // cleanup, we're going to emit another normal cleanup which
389 Entry = CGF.createBasicBlock("cleanup");
395 /// Attempts to reduce a cleanup's entry block to a fallthrough. This
397 /// simplified/optimized for the tighter constraints on cleanup blocks.
409 // If we were previously inserting at the end of the cleanup entry
419 // are phis in the cleanup.
435 EHScopeStack::Cleanup *Fn,
436 EHScopeStack::Cleanup::Flags flags,
441 // If there's an active flag, load it and skip the cleanup if it's
445 ContBB = CGF.createBasicBlock("cleanup.done");
446 llvm::BasicBlock *CleanupBB = CGF.createBasicBlock("cleanup.action");
448 = CGF.Builder.CreateLoad(ActiveFlag, "cleanup.is_active");
453 // Ask the cleanup to emit itself.
455 assert(CGF.HaveInsertPoint() && "cleanup ended with no insertion point?");
468 // Exit is the exit block of a cleanup, so it always terminates in
483 /// We don't need a normal entry block for the given cleanup.
488 /// exact ways in which we form branches to cleanup entries.
509 // The switch operand is a load from the cleanup-dest alloca.
526 /// Pops a cleanup block. If the block includes a normal cleanup, the
527 /// current insertion point is threaded through the cleanup, as are
528 /// any branch fixups on the cleanup.
530 assert(!EHStack.empty() && "cleanup stack is empty!");
531 assert(isa<EHCleanupScope>(*EHStack.begin()) && "top not a cleanup!");
542 // Check whether we need an EH cleanup. This is only true if we've
543 // generated a lazy EH cleanup block.
549 // Check the three conditions which might require a normal cleanup:
551 // - whether there are branch fix-ups through this cleanup
563 // end of the last cleanup, which points to the current scope. The
569 // If this is a normal cleanup, then having a prebranched
584 // cleanup, rewrite it so that it leads to the appropriate place.
589 // cleanup, just forward it to the next block, leaving the
595 // Otherwise, we need to make a new block. If the normal cleanup
611 // If we don't need the cleanup at all, we're done.
620 // Copy the cleanup emission data out. Note that SmallVector
628 EHScopeStack::Cleanup *Fn =
629 reinterpret_cast<EHScopeStack::Cleanup*>(CleanupBuffer.data());
631 EHScopeStack::Cleanup::Flags cleanupFlags;
641 // If we have a fallthrough and no other need for the cleanup,
652 // the cleanup block and then try to clean up after ourselves.
661 // If there's a fallthrough, we need to store the cleanup
668 // because the cleanup is inactive.
670 assert(!IsActive && "source without fallthrough for active cleanup");
679 // III. Figure out where we're going and build the cleanup
689 // to the enclosing cleanup
708 // TODO: clean up the possibly dead stores to the cleanup dest slot.
728 new llvm::LoadInst(getNormalCleanupDestSlot(), "cleanup.dest");
737 FallthroughDest = createBasicBlock("cleanup.cont");
757 // IV. Pop the cleanup and emit it.
763 // Append the prepared cleanup prologue from above.
785 // cleanup because the cleanup is inactive.
794 // cleanup, but we're not supposed to branch through to the next
795 // cleanup.
801 // cleanup and then through to the next.
828 // Emit the EH cleanup if required.
852 // Calculate the innermost active normal cleanup.
856 // If we're not in an active normal cleanup scope, or if the
857 // destination scope is within the innermost active normal cleanup
869 cleanup-protected scope. The target scope may not yet
883 // Calculate the innermost active normal cleanup.
887 // If we're not in an active normal cleanup scope, or if the
888 // destination scope is within the innermost active normal cleanup
896 // If we can't resolve the destination cleanup scope, just add this
897 // to the current cleanup scope as a branch fixup.
915 // Adjust BI to point to the first cleanup block.
931 // If this is the last cleanup we're propagating through, tell it
969 EHScopeStack::stable_iterator cleanup) {
971 if (EHStack.find(cleanup)->hasEHBranches())
976 i = EHStack.getInnermostEHScope(); i != cleanup; ) {
977 assert(cleanup.strictlyEncloses(i));
994 /// The given cleanup block is changing activation state. Configure a
995 /// cleanup variable if necessary.
1005 // We always need the flag if we're activating the cleanup in a
1007 // location doesn't necessarily dominate the cleanup's code.
1013 // Calculate whether the cleanup was used:
1015 // - as a normal cleanup
1022 // - as an EH cleanup
1034 var = CGF.CreateTempAlloca(CGF.Builder.getInt1Ty(), "cleanup.isactive");
1055 /// Activate a cleanup that was created in an inactivated state.
1067 /// Deactive a cleanup that was created in an active state.
1076 // If it's a normal cleanup, we need to pretend that the
1093 CreateTempAlloca(Builder.getInt32Ty(), "cleanup.dest.slot");