- All Superinterfaces:
Sourceable
- All Known Subinterfaces:
AssignStatement,AtomicLockAssignStatement,CallOrSpawnStatement,CivlParForSpawnStatement,DomainIteratorStatement,LoopBranchStatement,MallocStatement,NoopStatement,ParallelAssignStatement,ReturnStatement,UpdateStatement
The parent of all statements.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumDifferent kinds of statements. -
Method Summary
Modifier and TypeMethodDescriptionvoidcalculateConstantValue(dev.civl.sarl.IF.SymbolicUniverse universe) voidCalculate if this statement contains any dereference expressionbooleanchecks if the statement (including its guard) contains the constant $here.Returns all free (not bound) variables that are referenced in this statement.guard()booleanreturn true iff the statement has at least one dereferencesbooleanGet the string representation in the form of: source location id -> target location id e.g.Obtains the lowest scope of expression accessed by this statement.model()voidpurelyLocalAnalysisOfVariables(Scope funcScope) if an invalid input: '&'(var) is encountered, then var is considered as no purely local if a statement inside a function with fscope is accessing some variable that is declared in the scope vscope such that fscope.isDescendantOf(vscope), then that variable is not purely localbooleanReturns true if the statement has been reached at least once during the verification.voidreached()Mark this statement as reached.replaceWith(ConditionalExpression oldExpression, Expression newExpression) Return a new statement by copying this statement and modifying it as well as its guard by replacing a certain conditional expression with a expression, used when translating away conditional expression WITHOUT introducing temporary variables.voidreplaceWith(ConditionalExpression oldExpression, VariableExpression newExpression) Modify this statement including its guard by replacing a certain conditional expression with a variable expression, used when translating away conditional expression and a temporal variable is introduced.
For example,x = a ? b : cwill be translated intoif(a) v0 = b; else v0 = c; x = v0;
Another example,$when(a?b:c) x = k;will be translated intoif(a) v0 = b; else v0 = c; $when(v0) x = k;voidsetCIVLSource(CIVLSource source) voidsetGuard(Expression guard) voidvoidvoidsetSourceTemp(Location source) updates the source location of this statement, but never add this statement to the outgoing set of the source locationvoidvoidsetTargetTemp(Location target) updates the target location of this statement, but never add this statement to the incoming set of the target locationsource()Obtain the kind of the statement.The summary of the source code information of the statement.target()toStepString(Location.AtomicKind atomicKind, int atomCount, boolean atomicLockVarChanged) Obtain the set of variables whose addresses are referenced.variableAddressedOf(Scope scope) Obtain the set of variables visible from a certain scope that are possible to be written in the future.Methods inherited from interface dev.civl.mc.model.IF.Sourceable
getSource
-
Method Details
-
source
Location source()- Returns:
- The location that is the source of this statement.
-
target
Location target()- Returns:
- The location that is the target of this statement.
-
guard
Expression guard()- Returns:
- The boolean-valued guard expression for this statement.
-
model
Model model()- Returns:
- The model to which this statement belongs.
-
setSource
- Parameters:
source- the source to set
-
setTarget
- Parameters:
target- the target to set
-
setTargetTemp
updates the target location of this statement, but never add this statement to the incoming set of the target location- Parameters:
target- the target to set
-
setSourceTemp
updates the source location of this statement, but never add this statement to the outgoing set of the source location- Parameters:
source- the source to set
-
setGuard
- Parameters:
guard- the guard to set
-
setModel
- Parameters:
model- The Model to which this statement belongs.
-
statementScope
Scope statementScope()- Returns:
- The highest scope accessed by this statement. Null if no variables accessed.
-
hasDerefs
boolean hasDerefs()return true iff the statement has at least one dereferences- Returns:
- True of False
-
calculateDerefs
void calculateDerefs()Calculate if this statement contains any dereference expression -
purelyLocalAnalysisOfVariables
if an invalid input: '&'(var) is encountered, then var is considered as no purely local if a statement inside a function with fscope is accessing some variable that is declared in the scope vscope such that fscope.isDescendantOf(vscope), then that variable is not purely local- Parameters:
funcScope- the function scope of the statement
-
isPurelyLocal
boolean isPurelyLocal()- Returns:
- True iff the statement accesses only purely-local variables
-
replaceWith
Modify this statement including its guard by replacing a certain conditional expression with a variable expression, used when translating away conditional expression and a temporal variable is introduced.
For example,x = a ? b : cwill be translated intoif(a) v0 = b; else v0 = c; x = v0;
Another example,$when(a?b:c) x = k;will be translated intoif(a) v0 = b; else v0 = c; $when(v0) x = k;- Parameters:
oldExpression- The conditional expression to be cleared.newExpression- The variable expression of the temporal variable for the conditional expression.
-
replaceWith
Return a new statement by copying this statement and modifying it as well as its guard by replacing a certain conditional expression with a expression, used when translating away conditional expression WITHOUT introducing temporary variables. The original statement can't be modified, because it needs to be used twice to generate the if branch statement and the else branch statement.
For example,x = a ? b : cwill be translated intoif(a) x = b; else x = c;
Another example,$when(a?b:c) x = k;will be translated intoif(a) $when(b) x=k; else $when(c) x=k;- Parameters:
oldExpression- The conditional expression to be cleared.newExpression- The new expression to take place of the conditional expression. Usually, it is one of the choice expressions of the conditional expression.- Returns:
- A new statement without the conditional expression
-
variableAddressedOf
Obtain the set of variables visible from a certain scope that are possible to be written in the future.- Parameters:
scope- The given scope.- Returns:
-
variableAddressedOf
Obtain the set of variables whose addresses are referenced.- Returns:
-
statementKind
Statement.StatementKind statementKind()Obtain the kind of the statement.- Returns:
- The statement's kind.
-
toStepString
-
locationStepString
String locationStepString()Get the string representation in the form of: source location id -> target location id e.g. 3 -> 8- Returns:
-
summaryOfSource
String summaryOfSource()The summary of the source code information of the statement.- Returns:
-
lowestScope
Scope lowestScope()Obtains the lowest scope of expression accessed by this statement.- Returns:
- the lowest scope of expression accessed by this statement.
-
calculateConstantValue
void calculateConstantValue(dev.civl.sarl.IF.SymbolicUniverse universe) -
reached
void reached()Mark this statement as reached. -
reachable
boolean reachable()Returns true if the statement has been reached at least once during the verification.- Returns:
-
setCIVLSource
- Specified by:
setCIVLSourcein interfaceSourceable
-
containsHere
boolean containsHere()checks if the statement (including its guard) contains the constant $here. e.g. (a>0: s=$here) would return true;- Returns:
-
freeVariables
Returns all free (not bound) variables that are referenced in this statement.- Returns:
- the free variables referenced in this statement
-