// the default interesting filter bool defaultFilter (CFGNode cfgn) { SgNode * node = cfgn.getNode(); assert (node != NULL) ; //Keep the last index for initialized names. This way the definition of the variable doesn't //propagate to its assign initializer. if (isSgInitializedName(node)) { return (cfgn == node->cfgForEnd()); } else return (cfgn.isInteresting()); }
// the default interesting filter bool defaultFilter (CFGNode cfgn) { SgNode * node = cfgn.getNode(); assert (node != NULL) ; //Keep the last index for initialized names. This way the definition of the variable doesn't //propagate to its assign initializer. // if (isSgInitializedName(node)) // { // return (cfgn == node->cfgForEnd()); // } // else // return (cfgn.isInteresting()); switch(node->variantT()) { //Keep the last index for initialized names. This way the definition of the variable doesn't //propagate to its assign initializer. case V_SgInitializedName: return (cfgn == node->cfgForEnd()); // filter out this node type // abstract memory object cannot be created for these nodes case V_SgExprListExp: case V_SgNullStatement: case V_SgExprStatement: case V_SgFunctionRefExp: return false; case V_SgFunctionCallExp: return cfgn.getIndex()==2 || cfgn.getIndex()==3; case V_SgFunctionParameterList: return true; //return cfgn.getIndex()==1;*/ case V_SgFunctionDefinition: return cfgn.getIndex()==3; case V_SgReturnStmt: return cfgn.getIndex()==1; // Filter out intermediate dot expressions. We only care about the complete ones. case V_SgDotExp: //cout << "defaultFilter() node="<<cfgUtils::SgNode2Str(node)<<" node->get_parent()="<<cfgUtils::SgNode2Str(node->get_parent())<<" interesting="<<(!isSgDotExp(node->get_parent()))<<endl; return !isSgDotExp(node->get_parent()); /*case V_SgCastExp: return false;*/ default: return cfgn.isInteresting(); } }
bool gfilter (CFGNode cfgn) { SgNode *node = cfgn.getNode(); switch (node->variantT()) { //Keep the last index for initialized names. This way the def of the variable doesn't propagate to its assign //initializer. case V_SgInitializedName: return (cfgn == node->cfgForEnd()); #if 0 //For function calls, we only keep the last node. The function is actually called after all its parameters //are evaluated. // case V_SgFunctionCallExp: // return (cfgn == node->cfgForEnd()); // //For basic blocks and other "container" nodes, keep the node that appears before the contents are executed case V_SgBasicBlock: case V_SgExprStatement: case V_SgCommaOpExp: return (cfgn == node->cfgForBeginning()); // // case V_SgTryStmt: // return (cfgn == node->cfgForBeginning()); // // //We only want the middle appearance of the teritatry operator - after its conditional expression // //and before the true and false bodies. This makes it behave as an if statement for data flow // //purposes // case V_SgConditionalExp: // return (cfgn.getIndex() == 1); // // //Make these binary operators appear after their operands, because they are evaluated after their operands // case V_SgAndOp: // case V_SgOrOp: // return (cfgn == node->cfgForEnd()); #endif default: return cfgn.isInteresting(); } }