Class ReachingConditionStructurer


  • public final class ReachingConditionStructurer
    extends Object
    Reaching-condition control-flow structurer: the DREAM-style ("No More Gotos") replacement for schema-based structural analysis.
    • Constructor Detail

      • ReachingConditionStructurer

        public ReachingConditionStructurer​(RegionRecoveryBridge bridge,
                                           ControlFlowContext context)
        Creates a structurer.
        Parameters:
        bridge - the host recovery this stage calls back into for block contents
        context - the enclosing loop and switch context breaks and continues resolve against
    • Method Detail

      • setSuppressBoundaryTerminalAbsorption

        public void setSuppressBoundaryTerminalAbsorption​(boolean suppress)
        Tells the structurer to leave a boundary terminal past the stops to the host's continuation recovery instead of pulling it into the region.
        Parameters:
        suppress - true to decline the absorption
      • setBoundaryDuplicableTails

        public void setBoundaryDuplicableTails​(Set<IRBlock> tails)
        Names the stop blocks this offer may inline once at the region's convergence onto them.
        Parameters:
        tails - the admitted tails, or null for none
      • tryStructureRegion

        public List<Statement> tryStructureRegion​(IRBlock entry,
                                                  Set<IRBlock> stopBlocks)
        Structures the single-entry region rooted at entry and bounded by stopBlocks, or returns null when the region is outside this stage's scope so the caller falls back to legacy recovery.
        Parameters:
        entry - the region's single entry block
        stopBlocks - blocks that bound the region; flow into one of them ends it
        Returns:
        the structured statements, or null when the region is declined
      • probeRegionExits

        public Set<IRBlock> probeRegionExits​(IRBlock entry,
                                             Set<IRBlock> stopBlocks)
        Side-effect-free preflight.
        Parameters:
        entry - the region's single entry block
        stopBlocks - blocks that bound the region
        Returns:
        the stops the region's flow exits into, or null when the region is declined
      • probeRegionExits

        public Set<IRBlock> probeRegionExits​(IRBlock entry,
                                             Set<IRBlock> stopBlocks,
                                             boolean allowTryNodes)
        As above; with allowTryNodes the probe models each try in the region as an opaque node.
        Parameters:
        entry - the region's single entry block
        stopBlocks - blocks that bound the region
        allowTryNodes - model each try as one opaque node instead of declining the region
        Returns:
        the stops the region's flow exits into, or null when the region is declined
      • lastRegionContinuesInto

        public boolean lastRegionContinuesInto​(IRBlock bound)
        Whether the most recently probed region flows into bound through a back edge - the region is an enclosing loop's body tail whose continuation is the loop header itself.
        Parameters:
        bound - the candidate continuation block
        Returns:
        true when some region block reaches it over a back edge
      • tryStructureRegion

        public List<Statement> tryStructureRegion​(IRBlock entry,
                                                  Set<IRBlock> stopBlocks,
                                                  boolean allowTryNodes)
        As tryStructureRegion(IRBlock, Set); with allowTryNodes each try in the region becomes an opaque composite node.
        Parameters:
        entry - the region's single entry block
        stopBlocks - blocks that bound the region
        allowTryNodes - structure each try as one opaque node instead of declining the region
        Returns:
        the structured statements, or null when the region is declined