diff --git a/lisa/lisa-program/src/main/java/it/unive/lisa/program/cfg/statement/logic/And.java b/lisa/lisa-program/src/main/java/it/unive/lisa/program/cfg/statement/logic/And.java index cbcfb3307..6f5a77c96 100644 --- a/lisa/lisa-program/src/main/java/it/unive/lisa/program/cfg/statement/logic/And.java +++ b/lisa/lisa-program/src/main/java/it/unive/lisa/program/cfg/statement/logic/And.java @@ -9,6 +9,7 @@ import it.unive.lisa.program.cfg.CodeLocation; import it.unive.lisa.program.cfg.statement.Expression; import it.unive.lisa.program.cfg.statement.Statement; +import it.unive.lisa.program.cfg.statement.evaluation.EvaluationOrder; import it.unive.lisa.symbolic.SymbolicExpression; import it.unive.lisa.symbolic.value.BinaryExpression; import it.unive.lisa.symbolic.value.operator.binary.LogicalAnd; @@ -40,6 +41,25 @@ public And( super(cfg, location, "&&", cfg.getDescriptor().getUnit().getProgram().getTypes().getBooleanType(), left, right); } + /** + * Builds the logical conjunction. + * + * @param cfg the {@link CFG} where this operation lies + * @param location the location where this literal is defined + * @param order the evaluation order of the sub-expressions + * @param left the left-hand side of this operation + * @param right the right-hand side of this operation + */ + public And( + CFG cfg, + CodeLocation location, + EvaluationOrder order, + Expression left, + Expression right) { + super(cfg, location, "&&", order, cfg.getDescriptor().getUnit().getProgram().getTypes().getBooleanType(), left, + right); + } + @Override protected int compareSameClassAndParams( Statement o) { diff --git a/lisa/lisa-program/src/main/java/it/unive/lisa/program/cfg/statement/logic/Not.java b/lisa/lisa-program/src/main/java/it/unive/lisa/program/cfg/statement/logic/Not.java index 0dbca2260..0d7322eb6 100644 --- a/lisa/lisa-program/src/main/java/it/unive/lisa/program/cfg/statement/logic/Not.java +++ b/lisa/lisa-program/src/main/java/it/unive/lisa/program/cfg/statement/logic/Not.java @@ -9,6 +9,7 @@ import it.unive.lisa.program.cfg.CodeLocation; import it.unive.lisa.program.cfg.statement.Expression; import it.unive.lisa.program.cfg.statement.Statement; +import it.unive.lisa.program.cfg.statement.evaluation.EvaluationOrder; import it.unive.lisa.symbolic.SymbolicExpression; import it.unive.lisa.symbolic.value.UnaryExpression; import it.unive.lisa.symbolic.value.operator.unary.LogicalNegation; @@ -38,6 +39,23 @@ public Not( super(cfg, location, "!", cfg.getDescriptor().getUnit().getProgram().getTypes().getBooleanType(), expression); } + /** + * Builds the logical negation. + * + * @param cfg the {@link CFG} where this operation lies + * @param location the location where this literal is defined + * @param order the evaluation order of the sub-expressions + * @param expression the operand of this operation + */ + public Not( + CFG cfg, + CodeLocation location, + EvaluationOrder order, + Expression expression) { + super(cfg, location, "!", order, cfg.getDescriptor().getUnit().getProgram().getTypes().getBooleanType(), + expression); + } + @Override protected int compareSameClassAndParams( Statement o) { diff --git a/lisa/lisa-program/src/main/java/it/unive/lisa/program/cfg/statement/logic/Or.java b/lisa/lisa-program/src/main/java/it/unive/lisa/program/cfg/statement/logic/Or.java index 7c6501d81..d3d33d0f5 100644 --- a/lisa/lisa-program/src/main/java/it/unive/lisa/program/cfg/statement/logic/Or.java +++ b/lisa/lisa-program/src/main/java/it/unive/lisa/program/cfg/statement/logic/Or.java @@ -9,6 +9,7 @@ import it.unive.lisa.program.cfg.CodeLocation; import it.unive.lisa.program.cfg.statement.Expression; import it.unive.lisa.program.cfg.statement.Statement; +import it.unive.lisa.program.cfg.statement.evaluation.EvaluationOrder; import it.unive.lisa.symbolic.SymbolicExpression; import it.unive.lisa.symbolic.value.BinaryExpression; import it.unive.lisa.symbolic.value.operator.binary.LogicalOr; @@ -40,6 +41,25 @@ public Or( super(cfg, location, "||", cfg.getDescriptor().getUnit().getProgram().getTypes().getBooleanType(), left, right); } + /** + * Builds the logical disjunction. + * + * @param cfg the {@link CFG} where this operation lies + * @param location the location where this literal is defined + * @param order the evaluation order of the sub-expressions + * @param left the left-hand side of this operation + * @param right the right-hand side of this operation + */ + public Or( + CFG cfg, + CodeLocation location, + EvaluationOrder order, + Expression left, + Expression right) { + super(cfg, location, "||", order, cfg.getDescriptor().getUnit().getProgram().getTypes().getBooleanType(), left, + right); + } + @Override protected int compareSameClassAndParams( Statement o) { diff --git a/lisa/lisa-program/src/main/java/it/unive/lisa/program/cfg/statement/numeric/Addition.java b/lisa/lisa-program/src/main/java/it/unive/lisa/program/cfg/statement/numeric/Addition.java index 0d4b9197d..29db5ca31 100644 --- a/lisa/lisa-program/src/main/java/it/unive/lisa/program/cfg/statement/numeric/Addition.java +++ b/lisa/lisa-program/src/main/java/it/unive/lisa/program/cfg/statement/numeric/Addition.java @@ -9,6 +9,7 @@ import it.unive.lisa.program.cfg.CodeLocation; import it.unive.lisa.program.cfg.statement.Expression; import it.unive.lisa.program.cfg.statement.Statement; +import it.unive.lisa.program.cfg.statement.evaluation.EvaluationOrder; import it.unive.lisa.symbolic.SymbolicExpression; import it.unive.lisa.symbolic.value.BinaryExpression; import it.unive.lisa.symbolic.value.operator.binary.NumericNonOverflowingAdd; @@ -41,6 +42,62 @@ public Addition( super(cfg, location, "+", left, right); } + /** + * Builds the addition. + * + * @param cfg the {@link CFG} where this operation lies + * @param location the location where this literal is defined + * @param staticType the static type of this operation + * @param left the left-hand side of this operation + * @param right the right-hand side of this operation + */ + public Addition( + CFG cfg, + CodeLocation location, + Type staticType, + Expression left, + Expression right) { + super(cfg, location, "+", staticType, left, right); + } + + /** + * Builds the addition. + * + * @param cfg the {@link CFG} where this operation lies + * @param location the location where this literal is defined + * @param order the evaluation order of the sub-expressions + * @param left the left-hand side of this operation + * @param right the right-hand side of this operation + */ + public Addition( + CFG cfg, + CodeLocation location, + EvaluationOrder order, + Expression left, + Expression right) { + super(cfg, location, "+", order, left, right); + } + + /** + * Builds the addition. + * + * @param cfg the {@link CFG} where this operation lies + * @param location the location where this literal is defined + * @param order the evaluation order of the sub-expressions + * @param staticType the static type of this operation + * @param left the left-hand side of this operation + * @param right the right-hand side of this operation + */ + public Addition( + CFG cfg, + CodeLocation location, + EvaluationOrder order, + Type staticType, + Expression left, + Expression right) { + super(cfg, location, "+", order, staticType, left, right); + } + @Override protected int compareSameClassAndParams( Statement o) { diff --git a/lisa/lisa-program/src/main/java/it/unive/lisa/program/cfg/statement/numeric/Division.java b/lisa/lisa-program/src/main/java/it/unive/lisa/program/cfg/statement/numeric/Division.java index d4ce61113..2d1ea6dee 100644 --- a/lisa/lisa-program/src/main/java/it/unive/lisa/program/cfg/statement/numeric/Division.java +++ b/lisa/lisa-program/src/main/java/it/unive/lisa/program/cfg/statement/numeric/Division.java @@ -9,6 +9,7 @@ import it.unive.lisa.program.cfg.CodeLocation; import it.unive.lisa.program.cfg.statement.Expression; import it.unive.lisa.program.cfg.statement.Statement; +import it.unive.lisa.program.cfg.statement.evaluation.EvaluationOrder; import it.unive.lisa.symbolic.SymbolicExpression; import it.unive.lisa.symbolic.value.BinaryExpression; import it.unive.lisa.symbolic.value.operator.binary.NumericNonOverflowingDiv; @@ -41,6 +42,62 @@ public Division( super(cfg, location, "/", left, right); } + /** + * Builds the division. + * + * @param cfg the {@link CFG} where this operation lies + * @param location the location where this literal is defined + * @param staticType the static type of this operation + * @param left the left-hand side of this operation + * @param right the right-hand side of this operation + */ + public Division( + CFG cfg, + CodeLocation location, + Type staticType, + Expression left, + Expression right) { + super(cfg, location, "/", staticType, left, right); + } + + /** + * Builds the division. + * + * @param cfg the {@link CFG} where this operation lies + * @param location the location where this literal is defined + * @param order the evaluation order of the sub-expressions + * @param left the left-hand side of this operation + * @param right the right-hand side of this operation + */ + public Division( + CFG cfg, + CodeLocation location, + EvaluationOrder order, + Expression left, + Expression right) { + super(cfg, location, "/", order, left, right); + } + + /** + * Builds the division. + * + * @param cfg the {@link CFG} where this operation lies + * @param location the location where this literal is defined + * @param order the evaluation order of the sub-expressions + * @param staticType the static type of this operation + * @param left the left-hand side of this operation + * @param right the right-hand side of this operation + */ + public Division( + CFG cfg, + CodeLocation location, + EvaluationOrder order, + Type staticType, + Expression left, + Expression right) { + super(cfg, location, "/", order, staticType, left, right); + } + @Override protected int compareSameClassAndParams( Statement o) { diff --git a/lisa/lisa-program/src/main/java/it/unive/lisa/program/cfg/statement/numeric/Modulo.java b/lisa/lisa-program/src/main/java/it/unive/lisa/program/cfg/statement/numeric/Modulo.java index 75006f4bc..9a61aa4d4 100644 --- a/lisa/lisa-program/src/main/java/it/unive/lisa/program/cfg/statement/numeric/Modulo.java +++ b/lisa/lisa-program/src/main/java/it/unive/lisa/program/cfg/statement/numeric/Modulo.java @@ -9,6 +9,7 @@ import it.unive.lisa.program.cfg.CodeLocation; import it.unive.lisa.program.cfg.statement.Expression; import it.unive.lisa.program.cfg.statement.Statement; +import it.unive.lisa.program.cfg.statement.evaluation.EvaluationOrder; import it.unive.lisa.symbolic.SymbolicExpression; import it.unive.lisa.symbolic.value.BinaryExpression; import it.unive.lisa.symbolic.value.operator.binary.NumericNonOverflowingMod; @@ -42,6 +43,62 @@ public Modulo( super(cfg, location, "%", left, right); } + /** + * Builds the modulo. + * + * @param cfg the {@link CFG} where this operation lies + * @param location the location where this literal is defined + * @param staticType the static type of this operation + * @param left the left-hand side of this operation + * @param right the right-hand side of this operation + */ + public Modulo( + CFG cfg, + CodeLocation location, + Type staticType, + Expression left, + Expression right) { + super(cfg, location, "%", staticType, left, right); + } + + /** + * Builds the modulo. + * + * @param cfg the {@link CFG} where this operation lies + * @param location the location where this literal is defined + * @param order the evaluation order of the sub-expressions + * @param left the left-hand side of this operation + * @param right the right-hand side of this operation + */ + public Modulo( + CFG cfg, + CodeLocation location, + EvaluationOrder order, + Expression left, + Expression right) { + super(cfg, location, "%", order, left, right); + } + + /** + * Builds the modulo. + * + * @param cfg the {@link CFG} where this operation lies + * @param location the location where this literal is defined + * @param order the evaluation order of the sub-expressions + * @param staticType the static type of this operation + * @param left the left-hand side of this operation + * @param right the right-hand side of this operation + */ + public Modulo( + CFG cfg, + CodeLocation location, + EvaluationOrder order, + Type staticType, + Expression left, + Expression right) { + super(cfg, location, "%", order, staticType, left, right); + } + @Override protected int compareSameClassAndParams( Statement o) { diff --git a/lisa/lisa-program/src/main/java/it/unive/lisa/program/cfg/statement/numeric/Multiplication.java b/lisa/lisa-program/src/main/java/it/unive/lisa/program/cfg/statement/numeric/Multiplication.java index 3842afb9a..fc98ad8f2 100644 --- a/lisa/lisa-program/src/main/java/it/unive/lisa/program/cfg/statement/numeric/Multiplication.java +++ b/lisa/lisa-program/src/main/java/it/unive/lisa/program/cfg/statement/numeric/Multiplication.java @@ -9,6 +9,7 @@ import it.unive.lisa.program.cfg.CodeLocation; import it.unive.lisa.program.cfg.statement.Expression; import it.unive.lisa.program.cfg.statement.Statement; +import it.unive.lisa.program.cfg.statement.evaluation.EvaluationOrder; import it.unive.lisa.symbolic.SymbolicExpression; import it.unive.lisa.symbolic.value.BinaryExpression; import it.unive.lisa.symbolic.value.operator.binary.NumericNonOverflowingMul; @@ -41,6 +42,62 @@ public Multiplication( super(cfg, location, "*", left, right); } + /** + * Builds the multiplication. + * + * @param cfg the {@link CFG} where this operation lies + * @param location the location where this literal is defined + * @param staticType the static type of this operation + * @param left the left-hand side of this operation + * @param right the right-hand side of this operation + */ + public Multiplication( + CFG cfg, + CodeLocation location, + Type staticType, + Expression left, + Expression right) { + super(cfg, location, "*", staticType, left, right); + } + + /** + * Builds the multiplication. + * + * @param cfg the {@link CFG} where this operation lies + * @param location the location where this literal is defined + * @param order the evaluation order of the sub-expressions + * @param left the left-hand side of this operation + * @param right the right-hand side of this operation + */ + public Multiplication( + CFG cfg, + CodeLocation location, + EvaluationOrder order, + Expression left, + Expression right) { + super(cfg, location, "*", order, left, right); + } + + /** + * Builds the multiplication. + * + * @param cfg the {@link CFG} where this operation lies + * @param location the location where this literal is defined + * @param order the evaluation order of the sub-expressions + * @param staticType the static type of this operation + * @param left the left-hand side of this operation + * @param right the right-hand side of this operation + */ + public Multiplication( + CFG cfg, + CodeLocation location, + EvaluationOrder order, + Type staticType, + Expression left, + Expression right) { + super(cfg, location, "*", order, staticType, left, right); + } + @Override protected int compareSameClassAndParams( Statement o) { diff --git a/lisa/lisa-program/src/main/java/it/unive/lisa/program/cfg/statement/numeric/Negation.java b/lisa/lisa-program/src/main/java/it/unive/lisa/program/cfg/statement/numeric/Negation.java index 66ecaadac..ea0fef6a6 100644 --- a/lisa/lisa-program/src/main/java/it/unive/lisa/program/cfg/statement/numeric/Negation.java +++ b/lisa/lisa-program/src/main/java/it/unive/lisa/program/cfg/statement/numeric/Negation.java @@ -9,6 +9,7 @@ import it.unive.lisa.program.cfg.CodeLocation; import it.unive.lisa.program.cfg.statement.Expression; import it.unive.lisa.program.cfg.statement.Statement; +import it.unive.lisa.program.cfg.statement.evaluation.EvaluationOrder; import it.unive.lisa.symbolic.SymbolicExpression; import it.unive.lisa.symbolic.value.UnaryExpression; import it.unive.lisa.symbolic.value.operator.unary.NumericNegation; @@ -38,6 +39,56 @@ public Negation( super(cfg, location, "-", expression); } + /** + * Builds the numerical negation. + * + * @param cfg the {@link CFG} where this operation lies + * @param location the location where this literal is defined + * @param staticType the static type of this operation + * @param expression the operand of this operation + */ + public Negation( + CFG cfg, + CodeLocation location, + Type staticType, + Expression expression) { + super(cfg, location, "-", staticType, expression); + } + + /** + * Builds the numerical negation. + * + * @param cfg the {@link CFG} where this operation lies + * @param location the location where this literal is defined + * @param order the evaluation order of the sub-expressions + * @param expression the operand of this operation + */ + public Negation( + CFG cfg, + CodeLocation location, + EvaluationOrder order, + Expression expression) { + super(cfg, location, "-", order, expression); + } + + /** + * Builds the numerical negation. + * + * @param cfg the {@link CFG} where this operation lies + * @param location the location where this literal is defined + * @param order the evaluation order of the sub-expressions + * @param staticType the static type of this operation + * @param expression the operand of this operation + */ + public Negation( + CFG cfg, + CodeLocation location, + EvaluationOrder order, + Type staticType, + Expression expression) { + super(cfg, location, "-", order, staticType, expression); + } + @Override protected int compareSameClassAndParams( Statement o) { diff --git a/lisa/lisa-program/src/main/java/it/unive/lisa/program/cfg/statement/numeric/Remainder.java b/lisa/lisa-program/src/main/java/it/unive/lisa/program/cfg/statement/numeric/Remainder.java index 5f8a4fbef..e1ed6bf23 100644 --- a/lisa/lisa-program/src/main/java/it/unive/lisa/program/cfg/statement/numeric/Remainder.java +++ b/lisa/lisa-program/src/main/java/it/unive/lisa/program/cfg/statement/numeric/Remainder.java @@ -9,6 +9,7 @@ import it.unive.lisa.program.cfg.CodeLocation; import it.unive.lisa.program.cfg.statement.Expression; import it.unive.lisa.program.cfg.statement.Statement; +import it.unive.lisa.program.cfg.statement.evaluation.EvaluationOrder; import it.unive.lisa.symbolic.SymbolicExpression; import it.unive.lisa.symbolic.value.BinaryExpression; import it.unive.lisa.symbolic.value.operator.binary.NumericNonOverflowingRem; @@ -42,6 +43,62 @@ public Remainder( super(cfg, location, "%", left, right); } + /** + * Builds the remainder. + * + * @param cfg the {@link CFG} where this operation lies + * @param location the location where this literal is defined + * @param staticType the static type of this operation + * @param left the left-hand side of this operation + * @param right the right-hand side of this operation + */ + public Remainder( + CFG cfg, + CodeLocation location, + Type staticType, + Expression left, + Expression right) { + super(cfg, location, "%", staticType, left, right); + } + + /** + * Builds the remainder. + * + * @param cfg the {@link CFG} where this operation lies + * @param location the location where this literal is defined + * @param order the evaluation order of the sub-expressions + * @param left the left-hand side of this operation + * @param right the right-hand side of this operation + */ + public Remainder( + CFG cfg, + CodeLocation location, + EvaluationOrder order, + Expression left, + Expression right) { + super(cfg, location, "%", order, left, right); + } + + /** + * Builds the remainder. + * + * @param cfg the {@link CFG} where this operation lies + * @param location the location where this literal is defined + * @param order the evaluation order of the sub-expressions + * @param staticType the static type of this operation + * @param left the left-hand side of this operation + * @param right the right-hand side of this operation + */ + public Remainder( + CFG cfg, + CodeLocation location, + EvaluationOrder order, + Type staticType, + Expression left, + Expression right) { + super(cfg, location, "%", order, staticType, left, right); + } + @Override protected int compareSameClassAndParams( Statement o) { diff --git a/lisa/lisa-program/src/main/java/it/unive/lisa/program/cfg/statement/numeric/Subtraction.java b/lisa/lisa-program/src/main/java/it/unive/lisa/program/cfg/statement/numeric/Subtraction.java index d3e55ecbb..47e698225 100644 --- a/lisa/lisa-program/src/main/java/it/unive/lisa/program/cfg/statement/numeric/Subtraction.java +++ b/lisa/lisa-program/src/main/java/it/unive/lisa/program/cfg/statement/numeric/Subtraction.java @@ -9,6 +9,7 @@ import it.unive.lisa.program.cfg.CodeLocation; import it.unive.lisa.program.cfg.statement.Expression; import it.unive.lisa.program.cfg.statement.Statement; +import it.unive.lisa.program.cfg.statement.evaluation.EvaluationOrder; import it.unive.lisa.symbolic.SymbolicExpression; import it.unive.lisa.symbolic.value.BinaryExpression; import it.unive.lisa.symbolic.value.operator.binary.NumericNonOverflowingSub; @@ -41,6 +42,62 @@ public Subtraction( super(cfg, location, "-", left, right); } + /** + * Builds the subtraction. + * + * @param cfg the {@link CFG} where this operation lies + * @param location the location where this literal is defined + * @param staticType the static type of this operation + * @param left the left-hand side of this operation + * @param right the right-hand side of this operation + */ + public Subtraction( + CFG cfg, + CodeLocation location, + Type staticType, + Expression left, + Expression right) { + super(cfg, location, "-", staticType, left, right); + } + + /** + * * Builds the subtraction. + * + * @param cfg the {@link CFG} where this operation lies + * @param location the location where this literal is defined + * @param order the evaluation order of the sub-expressions + * @param left the left-hand side of this operation + * @param right the right-hand side of this operation + */ + public Subtraction( + CFG cfg, + CodeLocation location, + EvaluationOrder order, + Expression left, + Expression right) { + super(cfg, location, "-", order, left, right); + } + + /** + * * Builds the subtraction. + * + * @param cfg the {@link CFG} where this operation lies + * @param location the location where this literal is defined + * @param order the evaluation order of the sub-expressions + * @param staticType the static type of this operation + * @param left the left-hand side of this operation + * @param right the right-hand side of this operation + */ + public Subtraction( + CFG cfg, + CodeLocation location, + EvaluationOrder order, + Type staticType, + Expression left, + Expression right) { + super(cfg, location, "-", order, staticType, left, right); + } + @Override protected int compareSameClassAndParams( Statement o) {