Package 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
-
-
Field Summary
Fields Modifier and Type Field Description static double
DEFAULT_LOOP_REPETITIONS
-
Constructor Summary
Constructors Constructor Description StatementBlock()
StatementBlock(StatementBlock sb)
-
Method Summary
-
Methods inherited from class org.apache.sysds.parser.LiveVariableAnalysis
getGen, getKill, getWarn, liveIn, liveOut, setGen, setKill, setLiveIn, setLiveOut, setReadVariables, setUpdatedVariables, updateLiveVariablesOut, variablesRead, variablesUpdated
-
-
-
-
Field Detail
-
DEFAULT_LOOP_REPETITIONS
public static final double DEFAULT_LOOP_REPETITIONS
- See Also:
- Constant Field Values
-
-
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)
-
mergeable
public boolean mergeable()
-
setSplitDag
public void setSplitDag(boolean flag)
-
isSplitDag
public boolean isSplitDag()
-
getLoopDepRatio
public double getLoopDepRatio()
-
setLoopDepRatio
public void setLoopDepRatio(double dep)
-
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)
-
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 classLiveVariableAnalysis
-
initializebackwardLV
public VariableSet initializebackwardLV(VariableSet loPassed)
- Specified by:
initializebackwardLV
in classLiveVariableAnalysis
-
getConstIn
public HashMap<String,ConstIdentifier> getConstIn()
-
getConstOut
public HashMap<String,ConstIdentifier> getConstOut()
-
analyze
public VariableSet analyze(VariableSet loPassed)
- Specified by:
analyze
in classLiveVariableAnalysis
-
hasHops
public boolean hasHops()
-
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 interfaceParseInfo
-
setBeginLine
public void setBeginLine(int passed)
- Specified by:
setBeginLine
in interfaceParseInfo
-
setBeginColumn
public void setBeginColumn(int passed)
- Specified by:
setBeginColumn
in interfaceParseInfo
-
setEndLine
public void setEndLine(int passed)
- Specified by:
setEndLine
in interfaceParseInfo
-
setEndColumn
public void setEndColumn(int passed)
- Specified by:
setEndColumn
in interfaceParseInfo
-
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 interfaceParseInfo
-
getBeginLine
public int getBeginLine()
- Specified by:
getBeginLine
in interfaceParseInfo
-
getBeginColumn
public int getBeginColumn()
- Specified by:
getBeginColumn
in interfaceParseInfo
-
getEndLine
public int getEndLine()
- Specified by:
getEndLine
in interfaceParseInfo
-
getEndColumn
public int getEndColumn()
- Specified by:
getEndColumn
in interfaceParseInfo
-
printErrorLocation
public String printErrorLocation()
-
printBlockErrorLocation
public String printBlockErrorLocation()
-
printWarningLocation
public String printWarningLocation()
-
updateRecompilationFlag
public boolean updateRecompilationFlag()
-
requiresRecompilation
public boolean requiresRecompilation()
-
setNondeterministic
public void setNondeterministic(boolean flag)
-
isNondeterministic
public boolean isNondeterministic()
-
setRecompileOnce
public void setRecompileOnce(boolean flag)
-
isRecompileOnce
public boolean isRecompileOnce()
-
-