org.apache.sysds.parser

## Class StatementBlock

- java.lang.Object
- - org.apache.sysds.parser.LiveVariableAnalysis
  - - org.apache.sysds.parser.StatementBlock

- All Implemented Interfaces:
    ParseInfo
  Direct Known Subclasses:
    ForStatementBlock, FunctionStatementBlock, IfStatementBlock, WhileStatementBlock

      public class StatementBlock
      extends LiveVariableAnalysis
      implements ParseInfo

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `StatementBlock()`
    `StatementBlock(StatementBlock sb)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addStatement(Statement s)`
    `void` | `addStatementBlock(StatementBlock s)`
    `VariableSet` | `analyze(VariableSet loPassed)`
    `int` | `getBeginColumn()`
    `int` | `getBeginLine()`
    `HashMap<String,ConstIdentifier>` | `getConstIn()`
    `HashMap<String,ConstIdentifier>` | `getConstOut()`
    `DMLProgram` | `getDMLProg()`
    `int` | `getEndColumn()`
    `int` | `getEndLine()`
    `String` | `getFilename()`
    `ArrayList<Hop>` | `getHops()`
    `ArrayList<String>` | `getInputstoSB()`
    `ArrayList<Lop>` | `getLops()`
    `String` | `getName()`
    `int` | `getNumStatements()`
    `ArrayList<String>` | `getOutputNamesofSB()`
    `ArrayList<DataIdentifier>` | `getOutputsofSB()`
    `long` | `getSBID()`
    `Statement` | `getStatement(int i)`
    `ArrayList<Statement>` | `getStatements()`
    `String` | `getText()`
    `ArrayList<String>` | `getUpdateInPlaceVars()`
    `VariableSet` | `initializebackwardLV(VariableSet loPassed)`
    `VariableSet` | `initializeforwardLV(VariableSet activeIn)` For each statement: gen rule: for each variable read in current statement but not updated in any PRIOR statement, add to gen Handles case where variable both read and updated in same statement (i = i + 1, i needs to be added to gen) kill rule: for each variable updated in current statement but not read in this or any PRIOR statement, add to kill.
    `boolean` | `isMergeableFunctionCallBlock(DMLProgram dmlProg)`
    `boolean` | `isNondeterministic()`
    `boolean` | `isRewritableFunctionCall(Statement stmt, DMLProgram dmlProg)`
    `boolean` | `isSplitDag()`
    `boolean` | `mergeable()`
    `static ArrayList<StatementBlock>` | `mergeFunctionCalls(List<StatementBlock> body, DMLProgram dmlProg)`
    `static ArrayList<StatementBlock>` | `mergeStatementBlocks(List<StatementBlock> sb)`
    `String` | `printBlockErrorLocation()`
    `String` | `printErrorLocation()`
    `String` | `printWarningLocation()`
    `void` | `raiseValidateError(String msg, boolean conditional)`
    `void` | `raiseValidateError(String msg, boolean conditional, String errorCode)`
    `boolean` | `requiresRecompilation()`
    `ArrayList<Statement>` | `rewriteFunctionCallStatements(DMLProgram dmlProg, ArrayList<Statement> statements)`
    `static Expression` | `rHoistFunctionCallsFromExpressions(Expression expr, boolean root, ArrayList<Statement> tmp, DMLProgram prog)`
    `static List<StatementBlock>` | `rHoistFunctionCallsFromExpressions(StatementBlock current, DMLProgram prog)`
    `static List<Statement>` | `rHoistFunctionCallsFromExpressions(Statement stmt, DMLProgram prog)`
    `void` | `setBeginColumn(int passed)`
    `void` | `setBeginLine(int passed)`
    `void` | `setDMLProg(DMLProgram dmlProg)`
    `void` | `setEndColumn(int passed)`
    `void` | `setEndLine(int passed)`
    `void` | `setFilename(String fname)`
    `void` | `setHops(ArrayList<Hop> hops)`
    `void` | `setLops(ArrayList<Lop> lops)`
    `void` | `setNondeterministic(boolean flag)`
    `void` | `setParseInfo(ParseInfo parseInfo)` Set parse information.
    `void` | `setSplitDag(boolean flag)`
    `void` | `setStatementFormatType(AssignmentStatement s, boolean conditionalValidate)`
    `void` | `setStatementFormatType(OutputStatement s, boolean conditionalValidate)`
    `void` | `setStatements(ArrayList<Statement> s)`
    `void` | `setText(String text)`
    `void` | `setUpdateInPlaceVars(ArrayList<String> vars)`
    `String` | `toString()`
    `boolean` | `updateRecompilationFlag()`
    `VariableSet` | `validate(DMLProgram dmlProg, VariableSet ids, HashMap<String,ConstIdentifier> constVars, boolean conditional)`

    - ### Methods inherited from class org.apache.sysds.parser.LiveVariableAnalysis

      `getGen, getKill, getWarn, liveIn, liveOut, setGen, setKill, setLiveIn, setLiveOut, setReadVariables, setUpdatedVariables, updateLiveVariablesOut, variablesRead, variablesUpdated`

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

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

    - ### Methods inherited from interface org.apache.sysds.parser.ParseInfo

      `ctxAndFilenameToParseInfo`

- - ### Constructor Detail

    - #### StatementBlock

          public StatementBlock()

    - #### StatementBlock

          public StatementBlock(StatementBlock sb)

  - ### Method Detail

    - #### setDMLProg

          public void setDMLProg(DMLProgram dmlProg)

    - #### getDMLProg

          public DMLProgram getDMLProg()

    - #### getSBID

          public long getSBID()

    - #### getName

          public String getName()

    - #### addStatement

          public void addStatement(Statement s)

    - #### addStatementBlock

          public void addStatementBlock(StatementBlock s)

    - #### getNumStatements

          public int getNumStatements()

    - #### getStatement

          public Statement getStatement(int i)

    - #### getStatements

          public ArrayList<Statement> getStatements()

    - #### setStatements

          public void setStatements(ArrayList<Statement> s)

    - #### getHops

          public ArrayList<Hop> getHops()

    - #### getLops

          public ArrayList<Lop> getLops()

    - #### setHops

          public void setHops(ArrayList<Hop> hops)

    - #### setLops

          public void setLops(ArrayList<Lop> lops)

    - #### mergeable

          public boolean mergeable()

    - #### setSplitDag

          public void setSplitDag(boolean flag)

    - #### isSplitDag

          public boolean isSplitDag()

    - #### isMergeableFunctionCallBlock

          public boolean isMergeableFunctionCallBlock(DMLProgram dmlProg)

    - #### isRewritableFunctionCall

          public boolean isRewritableFunctionCall(Statement stmt,
                                                  DMLProgram dmlProg)

    - #### mergeFunctionCalls

          public static ArrayList<StatementBlock> mergeFunctionCalls(List<StatementBlock> body,
                                                                     DMLProgram dmlProg)

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### getInputstoSB

          public ArrayList<String> getInputstoSB()

    - #### getOutputNamesofSB

          public ArrayList<String> getOutputNamesofSB()

    - #### getOutputsofSB

          public ArrayList<DataIdentifier> getOutputsofSB()

    - #### mergeStatementBlocks

          public static ArrayList<StatementBlock> mergeStatementBlocks(List<StatementBlock> sb)

    - #### rHoistFunctionCallsFromExpressions

          public static List<StatementBlock> rHoistFunctionCallsFromExpressions(StatementBlock current,
                                                                                DMLProgram prog)

    - #### rHoistFunctionCallsFromExpressions

          public static List<Statement> rHoistFunctionCallsFromExpressions(Statement stmt,
                                                                           DMLProgram prog)

    - #### rHoistFunctionCallsFromExpressions

          public static Expression rHoistFunctionCallsFromExpressions(Expression expr,
                                                                      boolean root,
                                                                      ArrayList<Statement> tmp,
                                                                      DMLProgram prog)

    - #### rewriteFunctionCallStatements

          public ArrayList<Statement> rewriteFunctionCallStatements(DMLProgram dmlProg,
                                                                    ArrayList<Statement> statements)

    - #### validate

          public VariableSet validate(DMLProgram dmlProg,
                                      VariableSet ids,
                                      HashMap<String,ConstIdentifier> constVars,
                                      boolean conditional)

    - #### setStatementFormatType

          public void setStatementFormatType(OutputStatement s,
                                             boolean conditionalValidate)

    - #### setStatementFormatType

          public void setStatementFormatType(AssignmentStatement s,
                                             boolean conditionalValidate)

    - #### initializeforwardLV

          public VariableSet initializeforwardLV(VariableSet activeIn)

      For each statement: gen rule: for each variable read in current statement but not updated in any PRIOR statement, add to gen Handles case where variable both read and updated in same statement (i = i + 1, i needs to be added to gen) kill rule: for each variable updated in current statement but not read in this or any PRIOR statement, add to kill.
      Specified by:
        `initializeforwardLV` in class `LiveVariableAnalysis`

    - #### initializebackwardLV

          public VariableSet initializebackwardLV(VariableSet loPassed)

      Specified by:
        `initializebackwardLV` in class `LiveVariableAnalysis`

    - #### getConstIn

          public HashMap<String,ConstIdentifier> getConstIn()

    - #### getConstOut

          public HashMap<String,ConstIdentifier> getConstOut()

    - #### analyze

          public VariableSet analyze(VariableSet loPassed)

      Specified by:
        `analyze` in class `LiveVariableAnalysis`

    - #### raiseValidateError

          public void raiseValidateError(String msg,
                                         boolean conditional)

    - #### raiseValidateError

          public void raiseValidateError(String msg,
                                         boolean conditional,
                                         String errorCode)

    - #### setFilename

          public void setFilename(String fname)

      Specified by:
        `setFilename` in interface `ParseInfo`

    - #### setBeginLine

          public void setBeginLine(int passed)

      Specified by:
        `setBeginLine` in interface `ParseInfo`

    - #### setBeginColumn

          public void setBeginColumn(int passed)

      Specified by:
        `setBeginColumn` in interface `ParseInfo`

    - #### setEndLine

          public void setEndLine(int passed)

      Specified by:
        `setEndLine` in interface `ParseInfo`

    - #### setEndColumn

          public void setEndColumn(int passed)

      Specified by:
        `setEndColumn` in interface `ParseInfo`

    - #### setText

          public void setText(String text)

      Specified by:
        `setText` in interface `ParseInfo`

    - #### setParseInfo

          public void setParseInfo(ParseInfo parseInfo)

      Set parse information.
      Parameters:
        `parseInfo` - parse information, such as beginning line position, beginning column position, ending line position, ending column position, text, and filename the DML filename (if it exists)

    - #### getFilename

          public String getFilename()

      Specified by:
        `getFilename` in interface `ParseInfo`

    - #### getBeginLine

          public int getBeginLine()

      Specified by:
        `getBeginLine` in interface `ParseInfo`

    - #### getBeginColumn

          public int getBeginColumn()

      Specified by:
        `getBeginColumn` in interface `ParseInfo`

    - #### getEndLine

          public int getEndLine()

      Specified by:
        `getEndLine` in interface `ParseInfo`

    - #### getEndColumn

          public int getEndColumn()

      Specified by:
        `getEndColumn` in interface `ParseInfo`

    - #### getText

          public String getText()

      Specified by:
        `getText` in interface `ParseInfo`

    - #### printErrorLocation

          public String printErrorLocation()

    - #### printBlockErrorLocation

          public String printBlockErrorLocation()

    - #### printWarningLocation

          public String printWarningLocation()

    - #### updateRecompilationFlag

          public boolean updateRecompilationFlag()

    - #### requiresRecompilation

          public boolean requiresRecompilation()

    - #### getUpdateInPlaceVars

          public ArrayList<String> getUpdateInPlaceVars()

    - #### setUpdateInPlaceVars

          public void setUpdateInPlaceVars(ArrayList<String> vars)

    - #### setNondeterministic

          public void setNondeterministic(boolean flag)

    - #### isNondeterministic

          public boolean isNondeterministic()

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