Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected void flowThrough(Lattice in, Unit s, List<Lattice> fallOut,
- List<Lattice> branchOuts) {
- Lattice thenB = fallOut.isEmpty() ? null : fallOut.get(0);
- Lattice elseB = branchOuts.isEmpty() ? null : branchOuts.get(0);
- if (thenB == null) {
- return;
- }
- in.copy(thenB);
- if (elseB != null) {
- in.copy(elseB);
- }
- if (s instanceof JIfStmt) {
- JIfStmt ifstmt = (JIfStmt) s;
- if (ifstmt.getCondition() instanceof JEqExpr) {
- JEqExpr eq = (JEqExpr) ifstmt.getCondition();
- JimpleLocal var = null;
- AState a = null;
- if (eq.getOp1() instanceof JimpleLocal
- && eq.getOp2() instanceof JimpleLocal) {
- var = (JimpleLocal) eq.getOp1();
- JimpleLocal var2 = (JimpleLocal) eq.getOp2();
- thenB.remove(var2);
- elseB.remove(var2);
- thenB.add(var2, a);
- elseB.add(var2, AState.complement(a));
- } else {
- if (eq.getOp1() instanceof JimpleLocal) {
- var = (JimpleLocal) eq.getOp1();
- }
- else if (eq.getOp1() instanceof IntConstant) {
- a = AState.toDivZeroElem((IntConstant) eq.getOp1());
- }
- if (eq.getOp2() instanceof IntConstant) {
- a = AState.toDivZeroElem((IntConstant) eq.getOp2());
- } else if (eq.getOp2Box() instanceof JimpleLocal) {
- var = (JimpleLocal) eq.getOp2();
- }
- }
- thenB.remove(var);
- elseB.remove(var);
- thenB.add(var, a);
- elseB.add(var, AState.complement(a));
- }
- else if (ifstmt.getCondition() instanceof JNeExpr) {
- JNeExpr eq = (JNeExpr) ifstmt.getCondition();
- JimpleLocal var = null;
- AState a = null;
- } else if (ifstmt.getCondition() instanceof JGtExpr) {
- JGtExpr eq = (JGtExpr) ifstmt.getCondition();
- JimpleLocal var = null;
- AState a = null;
- } else if (ifstmt.getCondition() instanceof JGeExpr) {
- JGeExpr eq = (JGeExpr) ifstmt.getCondition();
- JimpleLocal var = null;
- AState a = null;
- } else if (ifstmt.getCondition() instanceof JLtExpr) {
- JLtExpr eq = (JLtExpr) ifstmt.getCondition();
- JimpleLocal var = null;
- AState a = null;
- } else if (ifstmt.getCondition() instanceof JLeExpr) {
- JLeExpr eq = (JLeExpr) ifstmt.getCondition();
- JimpleLocal var = null;
- AState a = null;
- }
- }
- }
Add Comment
Please, Sign In to add comment