Skip to content

Commit

Permalink
remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
cmnrd committed Dec 19, 2022
1 parent 4c6860b commit 889bc9c
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 48 deletions.
24 changes: 3 additions & 21 deletions org.lflang/src/org/lflang/ast/AfterDelayTransformation.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import org.lflang.lf.TypeParm;
import org.lflang.lf.VarRef;
import org.lflang.lf.WidthSpec;
import org.lflang.lf.WidthTerm;

public class AfterDelayTransformation implements ITransformation {

Expand Down Expand Up @@ -101,8 +100,7 @@ private void insertGeneratedDelays(List<Reactor> reactors) {
Type type = ((Port) connection.getRightPorts().get(0).getVariable()).getType();
Reactor delayClass = getDelayClass(type);
String generic = targetTypes.supportsGenerics() ? targetTypes.getTargetType(InferredType.fromAST(type)) : "";
Instantiation delayInstance = getDelayInstance(delayClass, connection, generic,
!generator.generateAfterDelaysWithVariableWidth());
Instantiation delayInstance = getDelayInstance(delayClass, connection, generic);

// Stage the new connections for insertion into the tree.
List<Connection> connections = ASTUtils.convertToEmptyListIfNull(newConnections.get(parent));
Expand Down Expand Up @@ -198,13 +196,9 @@ private static List<Connection> rerouteViaDelay(Connection connection,
* @param connection The connection to create a delay instantiation foe
* @param generic A string that denotes the appropriate type parameter,
* which should be null or empty if the target does not support generics.
* @param defineWidthFromConnection If this is true and if the connection
* is a wide connection, then instantiate a bank of delays where the width
* is given by ports involved in the connection. Otherwise, the width will
* be unspecified indicating a variable length.
*/
private static Instantiation getDelayInstance(Reactor delayClass,
Connection connection, String generic, Boolean defineWidthFromConnection) {
Connection connection, String generic) {
Expression delay = connection.getDelay();
Instantiation delayInstance = factory.createInstantiation();
delayInstance.setReactorClass(delayClass);
Expand All @@ -215,19 +209,7 @@ private static Instantiation getDelayInstance(Reactor delayClass,
}
if (ASTUtils.hasMultipleConnections(connection)) {
WidthSpec widthSpec = factory.createWidthSpec();
if (defineWidthFromConnection) {
// Add all left ports of the connection to the WidthSpec of the generated delay instance.
// This allows the code generator to later infer the width from the involved ports.
// We only consider the left ports here, as they could be part of a broadcast. In this case, we want
// to delay the ports first, and then broadcast the output of the delays.
for (VarRef port : connection.getLeftPorts()) {
WidthTerm term = factory.createWidthTerm();
term.setPort(EcoreUtil.copy(port));
widthSpec.getTerms().add(term);
}
} else {
widthSpec.setOfVariableLength(true);
}
widthSpec.setOfVariableLength(true);
delayInstance.setWidthSpec(widthSpec);
}
Assignment assignment = factory.createAssignment();
Expand Down
19 changes: 0 additions & 19 deletions org.lflang/src/org/lflang/generator/IDelayBodyGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,4 @@ public interface IDelayBodyGenerator {
*/
String generateDelayGeneric();

/**
* Indicates whether delay banks generated from after delays should have a variable length
* width.
* <p>
* If this is true, any delay reactors that are inserted for after delays on multiport
* connections
* will have an unspecified variable length width. The code generator is then responsible for
* inferring the
* correct width of the delay bank, which is only possible if the precise connection width is
* known at compile time.
* <p>
* If this is false, the width specification of the generated bank will list all the ports
* listed on the right
* side of the connection. This gives the code generator the information needed to infer the
* correct width at
* runtime.
*/
boolean generateAfterDelaysWithVariableWidth();

}
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,4 @@ public String generateDelayGeneric() {
throw new UnsupportedOperationException("TODO: auto-generated method stub");
}

@Override
public boolean generateAfterDelaysWithVariableWidth() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,4 @@ class CppDelayBodyGenerator : IDelayBodyGenerator {

override fun generateDelayGeneric() = "T"

override fun generateAfterDelaysWithVariableWidth() = false

}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,4 @@ class TSDelayBodyGenerator : IDelayBodyGenerator {
override fun generateDelayGeneric(): String {
return "T extends Present"
}

override fun generateAfterDelaysWithVariableWidth() = false
}

0 comments on commit 889bc9c

Please sign in to comment.