override public string ToString() { string StatementString = NodeASTSubTree.getText(); CommonAST ASTChild = (CommonAST)NodeASTSubTree.getFirstChild(); while (ASTChild != null) { StatementString += " " + ASTChild.getText(); ASTChild = (CommonAST)ASTChild.getNextSibling(); } return(StatementString); }
private Bdd Lift(CFGNodeStmtProcCall procCallNode, CFGNodeProcedure exitNode) { int i = 0; int id; Bdd[] bddArrayFormalsNot = new Bdd[2 * exitNode.LocalVariables.Length - exitNode.FormalParameters.Length]; //Bdd[] bddArrayFormals = new Bdd[2 * exitNode.FormalParameters.Length]; Bdd[] bddArrayForSubstitution = new Bdd[2 * exitNode.FormalParameters.Length]; Bdd tempBdd, tempBddAnd, tempBddXnor, tempBddReplace; Bdd var, exp, identity; CommonAST walkerVar = exitNode.GetAST().getFirstChild() as CommonAST; CommonAST walkerExp = procCallNode.GetAST().getFirstChild().getFirstChild() as CommonAST; foreach (string varName in exitNode.LocalVariables.VariablesToId.Keys) { exitNode.LocalVariables.VariablesToId.TryGetValue(varName, out id); if (exitNode.FormalParameters.VariablesToId.ContainsKey(varName) == false) { bddArrayFormalsNot[i++] = m_BddManager.GetBddVariableWithID(id); bddArrayFormalsNot[i++] = m_BddManager.GetBddVariableWithID(id + 2); } else { bddArrayFormalsNot[i++] = m_BddManager.GetBddVariableWithID(id + 2); } } PathEdges tempPath; m_PathEdges.TryGetValue(exitNode, out tempPath); tempBdd = tempPath.GetJointPaths(m_BddManager); tempBdd = tempBdd.Exists(bddArrayFormalsNot); i = 0; while (walkerVar.Type == BoolParserTokenTypes.ID) { exitNode.LocalVariables.VariablesToId.TryGetValue(walkerVar.getText(), out id); exp = HelperFunctions.ExprToBdd(walkerExp, m_BddManager, procCallNode.ProcOf.LocalVariables.VariablesToId, ProgramCFG.GlobalVariables.VariablesToId); var = m_BddManager.GetBddVariableWithID(id); bddArrayForSubstitution[i++] = var; bddArrayForSubstitution[i++] = exp; /* * tempBddXnor = m_BddManager.LogicalXnor(exp, var); * tempBddAnd = m_BddManager.LogicalAnd(tempBddXnor, tempBdd); * * tempBdd.FreeBdd(); * exp.FreeBdd(); * tempBdd = tempBddAnd; */ walkerExp = walkerExp.getNextSibling() as CommonAST; walkerVar = walkerVar.getNextSibling() as CommonAST; } i = 0; /* * foreach (int bddId in exitNode.FormalParameters.VariablesToId.Values) * { * bddArrayFormals[i++] = m_BddManager.GetBddVariableWithID(bddId); * bddArrayFormals[i++] = m_BddManager.GetBddVariableWithID(bddId + 2); * }*/ tempBddReplace = tempBdd.Replace(bddArrayForSubstitution); tempBdd.FreeBdd(); tempBdd = tempBddReplace; identity = HelperFunctions.BuildIdentityTransfer(m_BddManager, procCallNode.ProcOf.LocalVariables.VariablesToId, null); tempBddAnd = m_BddManager.LogicalAnd(tempBdd, identity); tempBdd.FreeBdd(); identity.FreeBdd(); tempBdd = tempBddAnd; return(tempBdd); }