Commit 5d757ac9 authored by Custom2043's avatar Custom2043

hmm

parent f3822f33
......@@ -111,7 +111,7 @@ public class AndInfo extends HigherInfo {
}
@Override
public HigherInfo accessArray(OperationList index, HigherInfo refInfos) {
return new AndInfo(this.info1.accessArray(index, null), this.info2.accessArray(index, null));
public HigherInfo toLoop(LoopValue value) {
return new AndInfo(this.info1.toLoop(value), this.info2.toLoop(value));
}
}
......@@ -89,8 +89,8 @@ public class FieldInfo extends HigherInfo {
}
@Override
public HigherInfo accessArray(OperationList index, HigherInfo refInfos) {
return new FieldInfo(this.var, this.info.accessArray(index, null));
public HigherInfo toLoop(LoopValue value) {
return new FieldInfo(this.var, this.info.toLoop(value));
}
@Override
......
......@@ -28,8 +28,6 @@ public abstract class HigherInfo {
public abstract HigherInfo access(Variable v);
public abstract HigherInfo accessArray(OperationList index, HigherInfo refInfos);
public abstract HigherInfo apply(OperationList refExp, OperationList argExp, OperationEnum opType, HigherInfo arg,
HigherInfo refInfos);
......@@ -52,6 +50,8 @@ public abstract class HigherInfo {
public abstract boolean isFalse(HigherInfo refInfos);
public abstract HigherInfo normalize();
public abstract HigherInfo toLoop(LoopValue value);
public abstract HigherInfo inverse();
......
......@@ -117,7 +117,7 @@ public class IfInfo extends HigherInfo {
}
@Override
public HigherInfo accessArray(OperationList index, HigherInfo refInfos) {
return new IfInfo(this.condition, this.then.accessArray(index, null), this.els.accessArray(index, null));
public HigherInfo toLoop(LoopValue value) {
return new IfInfo(this.condition, this.then.toLoop(value), this.els.toLoop(value));
}
}
package inflow;
public class LoopInflow extends BasicInflow {
public LoopInflow(BasicInflow p) {
super(p);
}
public HigherInfo updateInfos() {
return ((BasicInflow) this.getParentInflow()).currentInfos;
}
}
package inflow;
public class LoopValue implements Value {
public final LoopInflow loop;
public final WhileInflow loop;
public LoopValue(LoopInflow l) {
public LoopValue(WhileInflow l) {
this.loop = l;
}
}
......@@ -90,7 +90,7 @@ public class NoInfo extends HigherInfo {
}
@Override
public HigherInfo accessArray(OperationList index, HigherInfo refInfos) {
public HigherInfo toLoop(LoopValue value) {
return this;
}
}
......@@ -109,9 +109,9 @@ public class OrInfo extends HigherInfo {
public HigherInfo access(Variable v) {
return new OrInfo(this.info1.access(v), this.info2.access(v));
}
@Override
public HigherInfo accessArray(OperationList index, HigherInfo refInfos) {
return new OrInfo(this.info1.accessArray(index, null), this.info2.accessArray(index, null));
public HigherInfo toLoop(LoopValue value) {
return new OrInfo(this.info1.toLoop(value), this.info2.toLoop(value));
}
}
......@@ -124,7 +124,7 @@ public class ValueInfo extends HigherInfo {
}
@Override
public HigherInfo accessArray(OperationList index, HigherInfo refInfos) {
return NoInfo.instance;
public HigherInfo toLoop(LoopValue value) {
return new ValueInfo(this.value, info.toLoop(this.value, value));
}
}
package inflow;
public class WhileInflow extends BasicInflow {
public final LoopValue value = new LoopValue(this);
public WhileInflow(BasicInflow p) {
super(p);
}
......
package info;
import compiler.Variable;
import inflow.*;
public class BooleanValueInfo extends Info {
......@@ -111,4 +112,9 @@ public class BooleanValueInfo extends Info {
public boolean use(VariableValue value) {
return false;
}
@Override
public Info toLoop(Value assignedTo, LoopValue value) {
return this;
}
}
......@@ -100,6 +100,16 @@ public class Calcul {
public OperationList applySup0() {
return this.applyInf0().apply(new MethodUse(OperationEnum.BOOL_NOT));
}
@Override
public Calcul toLoop(Value assignedTo, LoopValue value) {
if (this.isConstant())
return this;
LinkedList<Value> values = new LinkedList<>();
values.add(assignedTo);
if (this.calc1.getMult(values))
}
}
class Ligne {
......@@ -120,6 +130,13 @@ class Ligne {
this.elements = e;
}
public int getMult(LinkedList<Value> values) {
for (Element e : this.elements)
if (e.var.equals(values))
return e.multiplicateur;
return 0;
}
public Ligne add(Ligne c) {
return new Ligne(Stream.concat(this.elements.stream(), c.elements.stream())
.collect(Collectors.toCollection(LinkedList::new))).normalize();
......
package info;
import compiler.Variable;
import inflow.*;
public abstract class Info {
......@@ -25,6 +26,8 @@ public abstract class Info {
return this.knowing1(caller, thisExp, otherExp, opType, refInfos);
}
public abstract Info toLoop(Value assignedTo, LoopValue value);
public abstract HigherInfo knowing0(OperationList resultExp, OperationList refExp, OperationEnum opType,
HigherInfo refInfos);
......
package info;
import compiler.UnitCompiler;
import compiler.Variable;
import inflow.*;
public class IntRangeInfo extends Info {
......@@ -264,4 +265,13 @@ public class IntRangeInfo extends Info {
return this.min.getValues().stream().anyMatch(v -> v.possessedBy.equals(value.possessedBy))
|| this.max.getValues().stream().anyMatch(v -> v.possessedBy.equals(value.possessedBy));
}
@Override
public Info toLoop(Value assignedTo, LoopValue value) {
Calcul newMin = this.min.isConstant() ? this.min : null;
Calcul newMax = this.max.isConstant() ? this.max : null;
if (this.min.equals(new Calcul(new Ligne())))
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment