Skip to content
Snippets Groups Projects
Commit 0f98e40a authored by Anders Nilsson's avatar Anders Nilsson
Browse files

Create static shedule based on no analysis at all.

parent 37d295ca
No related branches found
No related tags found
No related merge requests found
......@@ -25,24 +25,40 @@ aspect SSR {
}
aspect SDF {
syn boolean Instance.isSDF() = true;
}
aspect StaticSchedule {
syn LinkedList ASTNode.genStaticSchedule(LinkedList l) = l;
eq Start.genStaticSchedule(LinkedList l) = getSpecification().genStaticSchedule(l);
eq Specification.genStaticSchedule(LinkedList l) {
public Instance Instance.next;
public Instance Instance.prev;
syn LinkedList<Instance> ASTNode.genStaticSchedule(LinkedList<Instance> l) = l;
eq Start.genStaticSchedule(LinkedList<Instance> l) = getSpecification().genStaticSchedule(l);
eq Specification.genStaticSchedule(LinkedList<Instance> l) {
for (int i=0; i<getNumElement(); i++) {
l = getElement(i).genStaticSchedule(l);
}
return l;
}
eq XDF.genStaticSchedule(LinkedList l) {
eq XDF.genStaticSchedule(LinkedList<Instance> l) {
for (int i=0; i<getNumElement(); i++) {
l = getElement(i).genStaticSchedule(l);
}
return l;
}
eq Connection.genStaticSchedule(LinkedList l) {
eq Connection.genStaticSchedule(LinkedList<Instance> l) {
Instance src = getSource();
System.out.println(src);
Instance dest = getDest();
if (src.isSDF() && dest.isSDF()) {
src.next = dest;
dest.prev = src;
}
if (src.prev == null) {
l.add(src);
}
// System.out.println(src.name());
return l;
// Instance dest = getDest();
}
......@@ -54,7 +70,18 @@ aspect ActorLookup {
String Connection.source() {
for (Attribute a : getAttributes()) {
if (a instanceof src) {
return a.getAttrValue().getLITERAL();
return fix(a.getAttrValue().getLITERAL());
}
}
return "";
}
syn Instance Connection.getDest() = root().getInstance(dest());
String Connection.dest() {
for (Attribute a : getAttributes()) {
if (a instanceof dst) {
return fix(a.getAttrValue().getLITERAL());
}
}
return "";
......@@ -77,6 +104,7 @@ aspect misc {
return null;
}
eq Instance.getInstance(String s) {
// System.out.println(name()+" == "+s);
if (name().equals(s)) {
return this;
} else {
......@@ -91,11 +119,18 @@ aspect misc {
for (int i=0; i<getNumAttribute(); i++) {
Attribute a = getAttribute(i);
if (a instanceof id) {
return a.getAttrValue().getLITERAL();
return fix(a.getAttrValue().getLITERAL());
}
}
return "";
}
static String ASTNode.fix(String s) {
if (s.indexOf('"') == 0) {
return s.substring(1,s.length()-1);
}
return s;
}
}
......
import xdfAST.Start;
import xdfAST.Instance;
import java.util.LinkedList;
public class SSRAnalysis extends Parser {
public static void main(String args[]) {
Start ast = parse(args);
ast.genSSR(System.out);
LinkedList<Instance> l = ast.genStaticSchedule(new LinkedList<Instance>());
for (Instance i: l){
do {
System.out.print(i.name()+" -> ");
i = i.next;
} while (i != null);
System.out.println();
}
}
}
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment