Class IRRegionStmt

  • All Implemented Interfaces:
    ASTNode, Statement

    public final class IRRegionStmt
    extends Object
    implements Statement
    A fallback statement preserving raw IR blocks of an irreducible region, emitted as labeled blocks with breaks.
    • Constructor Detail

      • IRRegionStmt

        public IRRegionStmt​(List<IRBlock> blocks,
                            Map<IRBlock,​String> blockLabels,
                            SourceLocation location)
        Creates a region over the given blocks, generating labels when none are supplied.
        Parameters:
        blocks - the region's IR blocks
        blockLabels - emission labels per block, or null to generate defaults
        location - source location, or null for unknown
        Throws:
        NullPointerException - if blocks is null
      • IRRegionStmt

        public IRRegionStmt​(List<IRBlock> blocks)
        Creates a region with generated labels and an unknown location.
        Parameters:
        blocks - the region's IR blocks
        Throws:
        NullPointerException - if blocks is null
    • Method Detail

      • getBlocks

        public List<IRBlock> getBlocks()
        Returns:
        the blocks
      • getBlockLabels

        public Map<IRBlock,​String> getBlockLabels()
        Returns:
        the block labels
      • getReason

        public String getReason()
        Returns:
        the reason
      • setReason

        public void setReason​(String reason)
        Sets the description of why this region is irreducible.
        Parameters:
        reason - the description, or null for none
      • getLocation

        public SourceLocation getLocation()
        Description copied from interface: ASTNode
        Gets the source location of this node.
        Specified by:
        getLocation in interface ASTNode
        Returns:
        the location
      • getParent

        public ASTNode getParent()
        Description copied from interface: ASTNode
        Gets the parent node in the AST tree.
        Specified by:
        getParent in interface ASTNode
        Returns:
        the parent
      • setParent

        public void setParent​(ASTNode parent)
        Sets the enclosing AST node.
        Specified by:
        setParent in interface ASTNode
        Parameters:
        parent - the new parent node
      • getEntryBlock

        public IRBlock getEntryBlock()
        Returns:
        the first block of this region, or null if empty
      • getLabelFor

        public String getLabelFor​(IRBlock block)
        Looks up the emission label of a block.
        Parameters:
        block - the block to look up
        Returns:
        its label, or null if the block is not in this region
      • getBlockCount

        public int getBlockCount()
        Returns:
        the number of blocks in this region
      • accept

        public <T> T accept​(SourceVisitor<T> visitor)
        Description copied from interface: ASTNode
        Accepts a visitor for this node.
        Specified by:
        accept in interface ASTNode
        Type Parameters:
        T - the return type of the visitor
        Parameters:
        visitor - the visitor to accept
        Returns:
        the result from the visitor