ROSE
0.9.6a
|
#include <iostream>
#include <fstream>
#include <string>
#include <err.h>
#include <SgGraphTemplate.h>
#include <graphProcessing.h>
#include <staticCFG.h>
#include <yices_c.h>
Go to the source code of this file.
Classes | |
class | visitorTraversalFunc |
struct | Vertex2 |
struct | Edge2 |
class | visitorTraversal |
class | visitorTraversal2 |
Typedefs | |
typedef myGraph | CFGforT |
typedef boost::adjacency_list < boost::vecS, boost::vecS, boost::bidirectionalS, Vertex2, Edge2 > | newGraph |
typedef newGraph::vertex_descriptor | VertexID2 |
typedef newGraph::edge_descriptor | EdgeID2 |
typedef boost::graph_traits < newGraph >::vertex_iterator | vertex_iterator |
typedef boost::graph_traits < newGraph > ::out_edge_iterator | out_edge_iterator |
typedef boost::graph_traits < newGraph >::in_edge_iterator | in_edge_iterator |
typedef boost::graph_traits < newGraph >::edge_iterator | edge_iterator |
Functions | |
yices_expr | mainParse (vector< SgGraphNode * > expr, yices_context &ctx) |
string | getGraphNodeType (SgGraphNode *sn) |
void | propagateFunctionCall (std::vector< SgGraphNode * > path, int i, int pathnum) |
These should be unsatisfiable under integer logic int main (argc, argv) { int x = argc[0]; int y = argc[1]; if (x > 0 && y < 0) {. More... | |
long | getIndex (SgGraphNode *n) |
int | getSource (int &edge, newGraph *&g) |
int | getTarget (int &edge, newGraph *&g) |
void | printCFGNode2 (int &cf, VertexID2 v, newGraph *&g, std::ofstream &o) |
void | printCFGEdge2 (int &cf, newGraph *&cfg, std::ofstream &o) |
void | printHotness2 (newGraph *&g) |
string | getType (SgNode *n) |
yices_expr | evalFunction (std::vector< SgGraphNode * > path, yices_context &ctx, bool mainFlag) |
std::vector< int > | breakTriple (std::vector< SgGraphNode * > expr) |
string | isAtom (SgNode *) |
bool | isLogicalSplit (SgNode *) |
string | getLogicalSplit (SgNode *) |
string | getBinaryLogicOp (SgNode *) |
bool | isBinaryLogicOp (SgNode *) |
bool | isBinaryOp (SgNode *) |
string | getBinaryOp (SgNode *) |
std::vector< SgGraphNode * > | getSlice (std::vector< SgGraphNode * > vv, int i) |
int | yicesCheck (int argc, char **argv) |
Variables | |
int | FORLOOPS |
bool | inconsistent |
int | qst |
bool | unknown_flag |
std::map< SgInitializedName *, yices_var_decl > | unknowns |
std::map< yices_var_decl, SgInitializedName * > | IName |
std::vector< yices_var_decl > | unknownvdeclis |
bool | usingNots |
std::map< SgInitializedName *, std::vector< int > > | notMap |
std::map< std::vector < SgGraphNode * >, std::set < int > > | calledMap |
std::set< SgNode * > | unknownFunctions |
std::map< SgNode *, std::vector< std::vector < SgGraphNode * > > > | FuncPathMap |
bool | forFlag |
int | nvars |
std::map< SgName, string > | nameOf |
bool | noAssert |
std::map< SgNode *, int > | forsts |
std::map< int, std::vector < SgGraphNode * > > | intvecmap |
std::map< std::vector < SgGraphNode * >, int > | vecintmap |
std::vector< std::vector < SgGraphNode * > > | paths |
std::map< SgName, yices_expr > | getExpr |
newGraph * | nGraph |
SgIncidenceDirectedGraph * | openg |
myGraph * | openorig |
StaticCFG::CFG * | opencfg |
int | rounds |
int | pathnum |
std::set< std::pair< VertexID2, VertexID2 > > | knownEdges |
std::map< SgGraphNode *, VertexID2 > | graphVertex |
std::map< int, EdgeID2 > | intedgemap |
std::map< EdgeID2, int > | edgeintmap |
std::map< VertexID2, int > | intmap |
std::vector< VertexID > | exprs |
int | ipaths |
std::set< std::vector < SgGraphNode * > > | globalPaths |
StaticCFG::CFG * | cfg |
Definition at line 19 of file yicesParserLib.h.
typedef boost::adjacency_list< boost::vecS, boost::vecS, boost::bidirectionalS, Vertex2, Edge2> newGraph |
Definition at line 101 of file yicesParserLib.h.
typedef newGraph::vertex_descriptor VertexID2 |
Definition at line 103 of file yicesParserLib.h.
typedef newGraph::edge_descriptor EdgeID2 |
Definition at line 104 of file yicesParserLib.h.
typedef boost::graph_traits<newGraph>::vertex_iterator vertex_iterator |
Definition at line 106 of file yicesParserLib.h.
typedef boost::graph_traits<newGraph>::out_edge_iterator out_edge_iterator |
Definition at line 107 of file yicesParserLib.h.
typedef boost::graph_traits<newGraph>::in_edge_iterator in_edge_iterator |
Definition at line 108 of file yicesParserLib.h.
typedef boost::graph_traits<newGraph>::edge_iterator edge_iterator |
Definition at line 109 of file yicesParserLib.h.
yices_expr mainParse | ( | vector< SgGraphNode * > | expr, |
yices_context & | ctx | ||
) |
Definition at line 1507 of file yicesParserLib.h.
References breakTriple(), evalFunction(), SgFunctionParameterList::get_args(), SgFunctionDeclaration::get_args(), SgVariableSymbol::get_declaration(), SgFunctionDeclaration::get_orig_return_type(), SgFunctionDeclaration::get_parameterList(), SgInitializedName::get_qualified_name(), SgFunctionDeclaration::get_qualified_name(), SgGraphNode::get_SgNode(), SgVarRefExp::get_symbol(), SgInitializedName::get_type(), SgVarRefExp::get_type(), SgBoolValExp::get_value(), SgShortVal::get_value(), SgIntVal::get_value(), SgLongIntVal::get_value(), SgLongLongIntVal::get_value(), SgFloatVal::get_value(), SgDoubleVal::get_value(), SgLongDoubleVal::get_value(), SgFunctionCallExp::getAssociatedFunctionDeclaration(), getBinaryLogicOp(), getBinaryOp(), getExpr, getGraphNodeType(), getLogicalSplit(), SgName::getString(), getType(), IName, isAtom(), isBinaryLogicOp(), isBinaryOp(), isLogicalSplit(), isSgAssignOp(), isSgBoolValExp(), isSgDoubleVal(), isSgExprListExp(), isSgExprStatement(), isSgFloatVal(), isSgFunctionCallExp(), isSgInitializedName(), isSgIntVal(), isSgLongDoubleVal(), isSgLongIntVal(), isSgLongLongIntVal(), isSgNotOp(), isSgPlusPlusOp(), isSgReturnStmt(), isSgShortVal(), isSgVariableDeclaration(), isSgVarRefExp(), nameOf, notMap, nvars, rounds, unknown_flag, unknownFunctions, unknowns, unknownvdeclis, and usingNots.
Referenced by evalFunction().
string getGraphNodeType | ( | SgGraphNode * | sn) |
Definition at line 1499 of file yicesParserLib.h.
References opencfg, StaticCFG::CFG::toCFGNode(), and VirtualCFG::CFGNode::toString().
Referenced by visitorTraversal::analyzePath(), and mainParse().
void propagateFunctionCall | ( | std::vector< SgGraphNode * > | path, |
int | i, | ||
int | pathnum | ||
) |
These should be unsatisfiable under integer logic int main (argc, argv) { int x = argc[0]; int y = argc[1]; if (x > 0 && y < 0) {.
if (x == y) { } else if (y > x) { } else if (x*y > 0) { } else { } } else { } return 0;
Therefore there should only be 2 satisfiable paths, the primary if statement being false or the primary if statement being true and everything else false
This should translate to
(set-logic QF_LIA) (declare-fun x () Int) (declare-fun y () Int) (assert (> (x 0))) (assert (< (y 0))) (assert (= (x y))) (check-sat) (pop 1) (push 1) (assert (> (y x))) (check-sat) (pop 1) (push 1) (assert (> (* (x y) ) 0)) (check-sat) (pop 1) (check-sat) (pop 2) (check-sat)
Definition at line 167 of file yicesParserLib.h.
References calledMap, FuncPathMap, SgFunctionDeclaration::get_definition(), SgFunctionDeclaration::get_qualified_name(), SgFunctionCallExp::getAssociatedFunctionDeclaration(), isSgFunctionCallExp(), pathnum, and paths.
Referenced by visitorTraversal::analyzePath().
long getIndex | ( | SgGraphNode * | n) |
Definition at line 290 of file yicesParserLib.h.
References SgGraphNode::get_index().
int getSource | ( | int & | edge, |
newGraph *& | g | ||
) |
Definition at line 316 of file yicesParserLib.h.
References intedgemap, and intmap.
Referenced by SgGraphTraversal< CFG >::printCFGEdge(), printCFGEdge2(), and SgGraphTraversal< CFG >::unzipPath().
int getTarget | ( | int & | edge, |
newGraph *& | g | ||
) |
Definition at line 325 of file yicesParserLib.h.
References intedgemap, and intmap.
Referenced by SgGraphTraversal< CFG >::bfsTraversePath(), SgGraphTraversal< CFG >::computeOrder(), SgGraphTraversal< CFG >::computeSubGraphs(), SgGraphTraversal< CFG >::findClosuresAndMarkersAndEnumerate(), SgGraphTraversal< CFG >::printCFGEdge(), printCFGEdge2(), SgGraphTraversal< CFG >::unzipPath(), and SgGraphTraversal< CFG >::zipPath().
Definition at line 332 of file yicesParserLib.h.
Referenced by printHotness2().
void printCFGEdge2 | ( | int & | cf, |
newGraph *& | cfg, | ||
std::ofstream & | o | ||
) |
Definition at line 350 of file yicesParserLib.h.
References getSource(), and getTarget().
Referenced by printHotness2().
void printHotness2 | ( | newGraph *& | g) |
Definition at line 357 of file yicesParserLib.h.
References edgeintmap, intedgemap, intmap, printCFGEdge2(), and printCFGNode2().
string getType | ( | SgNode * | n) |
Definition at line 390 of file yicesParserLib.h.
References isSgTypeBool(), isSgTypeDouble(), isSgTypeFloat(), isSgTypeInt(), isSgTypeLong(), isSgTypeLongDouble(), isSgTypeLongLong(), and isSgTypeShort().
Referenced by evalFunction(), and mainParse().
yices_expr evalFunction | ( | std::vector< SgGraphNode * > | path, |
yices_context & | ctx, | ||
bool | mainFlag | ||
) |
isSgWhileStmt(path[i]->get_SgNode())) {
}
Definition at line 653 of file yicesParserLib.h.
References SgIncidenceDirectedGraph::computeEdgeSetOut(), VirtualCFG::CFGEdge::condition(), VirtualBinCFG::eckFalse, VirtualBinCFG::eckTrue, forFlag, FORLOOPS, getExpr, VirtualCFG::CFGNode::getIndex(), SgName::getString(), getType(), inconsistent, VirtualCFG::CFGNode::inEdges(), ipaths, isSgBasicBlock(), isSgExprStatement(), isSgForInitStatement(), isSgForStatement(), isSgIfStmt(), isSgInitializedName(), isSgReturnStmt(), isSgWhileStmt(), mainParse(), nameOf, nvars, opencfg, openg, StaticCFG::CFG::toCFGNode(), unknown_flag, unknowns, and usingNots.
Referenced by visitorTraversal::analyzePath(), and mainParse().
std::vector<int> breakTriple | ( | std::vector< SgGraphNode * > | expr) |
Definition at line 1443 of file yicesParserLib.h.
Referenced by mainParse().
string isAtom | ( | SgNode * | n) |
Definition at line 2290 of file yicesParserLib.h.
References isSgBoolValExp(), isSgDoubleVal(), isSgFloatVal(), isSgIntVal(), isSgLongDoubleVal(), isSgLongIntVal(), isSgLongLongIntVal(), and isSgShortVal().
Referenced by mainParse().
bool isLogicalSplit | ( | SgNode * | n) |
Definition at line 2318 of file yicesParserLib.h.
References isSgAndOp(), isSgNotOp(), and isSgOrOp().
Referenced by mainParse().
std::string getLogicalSplit | ( | SgNode * | n) |
Definition at line 2325 of file yicesParserLib.h.
References isSgAndOp(), isSgNotOp(), and isSgOrOp().
Referenced by mainParse().
std::string getBinaryLogicOp | ( | SgNode * | n) |
Definition at line 2341 of file yicesParserLib.h.
References isSgEqualityOp(), isSgGreaterThanOp(), isSgLessThanOp(), and isSgNotEqualOp().
Referenced by mainParse().
bool isBinaryLogicOp | ( | SgNode * | n) |
Definition at line 2362 of file yicesParserLib.h.
References isSgEqualityOp(), isSgGreaterThanOp(), isSgLessThanOp(), and isSgNotEqualOp().
Referenced by mainParse().
bool isBinaryOp | ( | SgNode * | n) |
Definition at line 2371 of file yicesParserLib.h.
References isSgAddOp(), isSgDivideOp(), isSgMultiplyOp(), and isSgSubtractOp().
Referenced by mainParse().
std::string getBinaryOp | ( | SgNode * | n) |
Definition at line 2380 of file yicesParserLib.h.
References isSgAddOp(), isSgDivideOp(), isSgMultiplyOp(), and isSgSubtractOp().
Referenced by mainParse().
std::vector<SgGraphNode*> getSlice | ( | std::vector< SgGraphNode * > | vv, |
int | i | ||
) |
Definition at line 1471 of file yicesParserLib.h.
int yicesCheck | ( | int | argc, |
char ** | argv | ||
) |
Definition at line 2443 of file yicesParserLib.h.
References visitorTraversal::cfg, cfg, SgGraphTraversal< CFG >::constructPathAnalyzer(), SageInterface::findMain(), FORLOOPS, frontend(), FuncPathMap, visitorTraversal::g, SgFunctionDefinition::get_declaration(), SgFunctionDeclaration::get_definition(), SgLocatedNode::get_file_info(), Sg_File_Info::get_filenameString(), SgFunctionDeclaration::get_name(), StaticCFG::InterproceduralCFG::getGraph(), StaticCFG::CFG::getGraph(), instantiateGraph(), ipaths, isSgFunctionDefinition(), visitorTraversalFunc::orig, visitorTraversal::orig, visitorTraversal::pathnumber, qst, SageInterface::querySubTree(), SgName::str(), StringUtility::stripPathFromFileName(), visitorTraversalFunc::tltnodes, visitorTraversal::tltnodes, V_SgFunctionDeclaration, V_SgFunctionDefinition, and visitorTraversalFunc::vpaths.
int FORLOOPS |
Definition at line 14 of file yicesParserLib.h.
Referenced by evalFunction(), and yicesCheck().
bool inconsistent |
Definition at line 15 of file yicesParserLib.h.
Referenced by visitorTraversal::analyzePath(), and evalFunction().
int qst |
Definition at line 17 of file yicesParserLib.h.
Referenced by visitorTraversal::analyzePath(), and yicesCheck().
bool unknown_flag |
Definition at line 20 of file yicesParserLib.h.
Referenced by evalFunction(), and mainParse().
std::map<SgInitializedName*, yices_var_decl> unknowns |
Definition at line 21 of file yicesParserLib.h.
Referenced by visitorTraversal::analyzePath(), evalFunction(), and mainParse().
std::map<yices_var_decl, SgInitializedName*> IName |
Definition at line 22 of file yicesParserLib.h.
Referenced by visitorTraversal::analyzePath(), and mainParse().
std::vector<yices_var_decl> unknownvdeclis |
Definition at line 23 of file yicesParserLib.h.
Referenced by visitorTraversal::analyzePath(), and mainParse().
bool usingNots |
Definition at line 24 of file yicesParserLib.h.
Referenced by visitorTraversal::analyzePath(), evalFunction(), and mainParse().
std::map<SgInitializedName*, std::vector<int> > notMap |
Definition at line 25 of file yicesParserLib.h.
Referenced by visitorTraversal::analyzePath(), and mainParse().
std::map<std::vector<SgGraphNode*>, std::set<int> > calledMap |
Definition at line 28 of file yicesParserLib.h.
Referenced by visitorTraversal::analyzePath(), and propagateFunctionCall().
std::set<SgNode*> unknownFunctions |
Definition at line 29 of file yicesParserLib.h.
Referenced by visitorTraversal::analyzePath(), and mainParse().
std::map<SgNode*, std::vector<std::vector<SgGraphNode*> > > FuncPathMap |
Definition at line 67 of file yicesParserLib.h.
Referenced by propagateFunctionCall(), and yicesCheck().
bool forFlag |
Definition at line 69 of file yicesParserLib.h.
Referenced by visitorTraversal::analyzePath(), and evalFunction().
int nvars |
Definition at line 71 of file yicesParserLib.h.
Referenced by evalFunction(), and mainParse().
std::map<SgName, string> nameOf |
Definition at line 72 of file yicesParserLib.h.
Referenced by visitorTraversal::analyzePath(), evalFunction(), and mainParse().
bool noAssert |
Definition at line 73 of file yicesParserLib.h.
Referenced by visitorTraversal::analyzePath().
std::map<SgNode*, int> forsts |
Definition at line 74 of file yicesParserLib.h.
std::map<int, std::vector<SgGraphNode*> > intvecmap |
Definition at line 76 of file yicesParserLib.h.
std::map<std::vector<SgGraphNode*>, int> vecintmap |
Definition at line 77 of file yicesParserLib.h.
std::vector<std::vector<SgGraphNode*> > paths |
Definition at line 81 of file yicesParserLib.h.
Referenced by visitorTraversal::analyzePath(), visitorTraversal2::analyzePath(), SgGraphTraversal< CFG >::bfsTraversePath(), VirtualCFG::makeClosure(), propagateFunctionCall(), and SgGraphTraversal< CFG >::uTraversePath().
std::map<SgName, yices_expr> getExpr |
Definition at line 253 of file yicesParserLib.h.
Referenced by visitorTraversal::analyzePath(), evalFunction(), and mainParse().
newGraph* nGraph |
Definition at line 283 of file yicesParserLib.h.
SgIncidenceDirectedGraph* openg |
Definition at line 284 of file yicesParserLib.h.
Referenced by visitorTraversal::analyzePath(), and evalFunction().
myGraph* openorig |
Definition at line 285 of file yicesParserLib.h.
Referenced by visitorTraversal::analyzePath().
StaticCFG::CFG* opencfg |
Definition at line 286 of file yicesParserLib.h.
Referenced by visitorTraversal::analyzePath(), evalFunction(), and getGraphNodeType().
int rounds |
Definition at line 298 of file yicesParserLib.h.
Referenced by visitorTraversal::analyzePath(), SgGraphTraversal< CFG >::evaluatePaths(), SgGraphTraversal< CFG >::evaluatePathsPar(), and mainParse().
int pathnum |
Definition at line 299 of file yicesParserLib.h.
Referenced by visitorTraversal::analyzePath(), propagateFunctionCall(), and SgGraphTraversal< CFG >::uTraversePath().
Definition at line 301 of file yicesParserLib.h.
std::map<SgGraphNode*, VertexID2> graphVertex |
Definition at line 302 of file yicesParserLib.h.
std::map<int, EdgeID2> intedgemap |
Definition at line 311 of file yicesParserLib.h.
Referenced by SgGraphTraversal< CFG >::findClosuresAndMarkersAndEnumerate(), SgGraphTraversal< CFG >::getSource(), getSource(), SgGraphTraversal< CFG >::getTarget(), getTarget(), and printHotness2().
std::map<EdgeID2, int> edgeintmap |
Definition at line 312 of file yicesParserLib.h.
Referenced by SgGraphTraversal< CFG >::findClosuresAndMarkersAndEnumerate(), SgGraphTraversal< CFG >::getInEdges(), SgGraphTraversal< CFG >::getOutEdges(), SgGraphTraversal< CFG >::printHotness(), printHotness2(), and SgGraphTraversal< CFG >::printPathDot().
std::map<VertexID2, int> intmap |
Definition at line 313 of file yicesParserLib.h.
Referenced by getSource(), getTarget(), and printHotness2().
std::vector<VertexID> exprs |
Definition at line 423 of file yicesParserLib.h.
Referenced by SgAsmArmInstruction::get_successors(), SgAsmPowerpcInstruction::get_successors(), and modifies_ip().
int ipaths |
Definition at line 425 of file yicesParserLib.h.
Referenced by evalFunction(), and yicesCheck().
std::set<std::vector<SgGraphNode*> > globalPaths |
Definition at line 430 of file yicesParserLib.h.
StaticCFG::CFG* cfg |
Definition at line 1440 of file yicesParserLib.h.
Referenced by visitorTraversal::analyzePath(), SDG::ProgramDependenceGraph::ProgramDependenceGraph(), and yicesCheck().