org.apache.sysds.hops.rewrite

## Class StatementBlockRewriteRule

- java.lang.Object
- - org.apache.sysds.hops.rewrite.StatementBlockRewriteRule

- Direct Known Subclasses:
    MarkForLineageReuse, RewriteCompressedReblock, RewriteForLoopVectorization, RewriteHoistLoopInvariantOperations, RewriteInjectSparkLoopCheckpointing, RewriteMarkLoopVariablesUpdateInPlace, RewriteMergeBlockSequence, RewriteRemoveEmptyBasicBlocks, RewriteRemoveForLoopEmptySequence, RewriteRemoveUnnecessaryBranches, RewriteSplitDagDataDependentOperators, RewriteSplitDagUnknownCSVRead

      public abstract class StatementBlockRewriteRule
      extends Object

  Base class for all hop rewrites in order to enable generic application of all rules.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `StatementBlockRewriteRule()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static String` | `createCutVarName(boolean fun)`
    `abstract boolean` | `createsSplitDag()` Indicates if the rewrite potentially splits dags, which is used for phase ordering of rewrites.
    `abstract List<StatementBlock>` | `rewriteStatementBlock(StatementBlock sb, ProgramRewriteStatus state)` Handle an arbitrary statement block.
    `abstract List<StatementBlock>` | `rewriteStatementBlocks(List<StatementBlock> sbs, ProgramRewriteStatus state)` Handle a list of statement blocks.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### StatementBlockRewriteRule

          public StatementBlockRewriteRule()

  - ### Method Detail

    - #### createCutVarName

          public static String createCutVarName(boolean fun)

    - #### createsSplitDag

          public abstract boolean createsSplitDag()

      Indicates if the rewrite potentially splits dags, which is used for phase ordering of rewrites.
      Returns:
        true if dag splits are possible.

    - #### rewriteStatementBlock

          public abstract List<StatementBlock> rewriteStatementBlock(StatementBlock sb,
                                                                     ProgramRewriteStatus state)

      Handle an arbitrary statement block. Specific type constraints have to be ensured within the individual rewrites. If a rewrite does not apply to individual blocks, it should simply return the input block.
      Parameters:
        `sb` - statement block
        `state` - program rewrite status
      Returns:
        list of statement blocks

    - #### rewriteStatementBlocks

          public abstract List<StatementBlock> rewriteStatementBlocks(List<StatementBlock> sbs,
                                                                      ProgramRewriteStatus state)

      Handle a list of statement blocks. Specific type constraints have to be ensured within the individual rewrites. If a rewrite does not require sequence access, it should simply return the input list of statement blocks.
      Parameters:
        `sbs` - list of statement blocks
        `state` - program rewrite status
      Returns:
        list of statement blocks

Copyright © 2021 The Apache Software Foundation. All rights reserved.