NodePair np=flattenBlockStatementNode(bn.get(i));
FlatNode np_begin=np.getBegin();
FlatNode np_end=np.getEnd();
- if(bn.getLabel()!=null) {
- // interim implementation to have the labeled statement
- state.fn2labelMap.put(np_begin, bn.getLabel());
- }
if (begin==null) {
begin=np_begin;
}
FlatSetFieldNode fsfn=new FlatSetFieldNode(dst_tmp, fan.getField(), src_tmp);
fsfn.setNumLine(en.getNumLine());
+ addMapNode2FlatNodeSet(an,fsfn);
last.addNext(fsfn);
last=fsfn;
if (pre) {
last.addNext(fon2);
last=fon2;
}
+ addMapNode2FlatNodeSet(an,last);
return new NodePair(first, last);
} else if (an.getDest().kind()==Kind.NameNode) {
//We could be assigning a field or variable
FlatSetFieldNode fsfn=new FlatSetFieldNode(dst_tmp, fan.getField(), src_tmp);
fsfn.setNumLine(en.getNumLine());
+ addMapNode2FlatNodeSet(an,fsfn);
last.addNext(fsfn);
last=fsfn;
if (pre) {
fsfn=new FlatSetFieldNode(getTempforVar(nn.getVar()), nn.getField(), src_tmp);
fsfn.setNumLine(nn.getNumLine());
}
+ addMapNode2FlatNodeSet(an,fsfn);
if (first==null) {
first=fsfn;
} else {
FlatOpNode fon=new FlatOpNode(getTempforVar(nn.getVar()), src_tmp, null, new Operation(Operation.ASSIGN));
fon.setNumLine(an.getNumLine());
+ addMapNode2FlatNodeSet(an,fon);
last.addNext(fon);
last=fon;
}
private NodePair flattenLoopNode(LoopNode ln) {
+
HashSet oldbs=breakset;
HashSet oldcs=continueset;
breakset=new HashSet();
fcb.setNumLine(ln.getNumLine());
fcb.setTrueProb(State.TRUEPROB);
fcb.setLoop();
+ fcb.setLoopEntrance(condition.getBegin());
FlatNop nopend=new FlatNop();
FlatBackEdge backedge=new FlatBackEdge();
}
breakset=oldbs;
continueset=oldcs;
+ if(ln.getLabel()!=null){
+ state.fn2labelMap.put(condition.getBegin(), ln.getLabel());
+ }
return new NodePair(begin,nopend);
} else if (ln.getType()==LoopNode.WHILELOOP) {
TempDescriptor cond_temp=TempDescriptor.tempFactory("condition", new TypeDescriptor(TypeDescriptor.BOOLEAN));
fcb.setNumLine(ln.getNumLine());
fcb.setTrueProb(State.TRUEPROB);
fcb.setLoop();
+ fcb.setLoopEntrance(begin);
FlatNop nopend=new FlatNop();
FlatBackEdge backedge=new FlatBackEdge();
}
breakset=oldbs;
continueset=oldcs;
+ if(ln.getLabel()!=null){
+ state.fn2labelMap.put(begin, ln.getLabel());
+ }
return new NodePair(begin,nopend);
} else if (ln.getType()==LoopNode.DOWHILELOOP) {
TempDescriptor cond_temp=TempDescriptor.tempFactory("condition", new TypeDescriptor(TypeDescriptor.BOOLEAN));
fcb.setNumLine(ln.getNumLine());
fcb.setTrueProb(State.TRUEPROB);
fcb.setLoop();
+ fcb.setLoopEntrance(begin);
FlatNop nopend=new FlatNop();
FlatBackEdge backedge=new FlatBackEdge();
}
breakset=oldbs;
continueset=oldcs;
+ if(ln.getLabel()!=null){
+ state.fn2labelMap.put(begin, ln.getLabel());
+ }
return new NodePair(begin,nopend);
} else throw new Error();
}
return new NodePair(fgrn, fgrn);
}
+ private NodePair flattenGenDefReachNode(GenDefReachNode gdrn) {
+ FlatGenDefReachNode fgdrn = new FlatGenDefReachNode(gdrn.getOutputName() );
+ return new NodePair(fgdrn, fgdrn);
+ }
+
private NodePair flattenSESENode(SESENode sn) {
if( sn.isStart() ) {
FlatSESEEnterNode fsen=new FlatSESEEnterNode(sn);
case Kind.GenReachNode:
return flattenGenReachNode((GenReachNode)bsn);
+ case Kind.GenDefReachNode:
+ return flattenGenDefReachNode((GenDefReachNode)bsn);
+
case Kind.ContinueBreakNode:
return flattenContinueBreakNode((ContinueBreakNode)bsn);
}