Class IRRegionStmt
- java.lang.Object
-
- com.tonic.analysis.source.ast.stmt.IRRegionStmt
-
-
Constructor Summary
Constructors Constructor Description IRRegionStmt(List<IRBlock> blocks)Creates a region with generated labels and an unknown location.IRRegionStmt(List<IRBlock> blocks, Map<IRBlock,String> blockLabels, SourceLocation location)Creates a region over the given blocks, generating labels when none are supplied.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> Taccept(SourceVisitor<T> visitor)Accepts a visitor for this node.intgetBlockCount()Map<IRBlock,String>getBlockLabels()List<IRBlock>getBlocks()IRBlockgetEntryBlock()StringgetLabelFor(IRBlock block)Looks up the emission label of a block.SourceLocationgetLocation()Gets the source location of this node.ASTNodegetParent()Gets the parent node in the AST tree.StringgetReason()voidsetLocation(SourceLocation location)Sets this statement's source location.voidsetParent(ASTNode parent)Sets the enclosing AST node.voidsetReason(String reason)Sets the description of why this region is irreducible.StringtoString()-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.tonic.analysis.source.ast.ASTNode
deepClone, findAll, findAll, findAncestor, findFirst, findFirst, getChildren, getRoot, isDescendantOf, remove, replaceWith, stream, stream, walk
-
-
-
-
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 blocksblockLabels- emission labels per block, or null to generate defaultslocation- 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
-
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:ASTNodeGets the source location of this node.- Specified by:
getLocationin interfaceASTNode- Returns:
- the location
-
getParent
public ASTNode getParent()
Description copied from interface:ASTNodeGets the parent node in the AST tree.
-
setParent
public void setParent(ASTNode parent)
Sets the enclosing AST 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:ASTNodeAccepts a visitor for this node.
-
setLocation
public void setLocation(SourceLocation location)
Description copied from interface:StatementSets this statement's source location.- Specified by:
setLocationin interfaceStatement- Parameters:
location- the provenance to stamp, or null forSourceLocation.UNKNOWN
-
-