//this function return true if the var occurs in term, else the
//function returns false
bool VarSeenInTerm(const ASTNode& var, const ASTNode& term);
+ void SetofVarsSeenInTerm(const ASTNode& term, ASTNodeSet& symbols);
void VarSeenInTerm(Symbols* term, SymbolPtrSet& visited, ASTNodeSet& found, vector<Symbols*>& av);
#include "../../AST/NodeFactory/NodeFactory.h"
#include "../../simplifier/simplifier.h"
#include "ConstantBitP_Utility.h"
+#include <iostream>
+#include <fstream>
#ifdef WITHCBITP
#include "ConstantBitP_TransferFunctions.h"
dispatchToMaximallyPrecise(const Kind k, vector<FixedBits*>& children,
FixedBits& output, const ASTNode n);
- const bool debug_cBitProp_messages = true;
- const bool output_mult_like = true;
+ const bool debug_cBitProp_messages = false;
+ const bool output_mult_like = false;
+ const bool debug_print_graph_after = false;
////////////////////
// Put anything that's entirely fixed into a from->to map.
ASTNodeMap
- getAllFixed(NodeToFixedBitsMap* fixedMap)
+ ConstantBitPropagation::getAllFixed()
{
NodeToFixedBitsMap::NodeToFixedBitsMapType::iterator it;
void
ConstantBitPropagation::setNodeToTrue(const ASTNode& top)
{
+ assert(!topFixed);
+ topFixed = true;
+
FixedBits & topFB = *getCurrentFixedBits(top);
topFB.setFixed(0, true);
topFB.setValue(0, true);
}
#endif
+ topFixed = false;
}
// Both way propagation. Initialising the top to "true".
status = NO_CHANGE;
//Determine what must always be true.
- ASTNodeMap fromTo = getAllFixed(fixedMap);
+ ASTNodeMap fromTo = getAllFixed();
if (debug_cBitProp_messages)
{
result = nf->CreateNode(AND, result, toConjoin); // conjoin the new conditions.
}
+
+ if (debug_print_graph_after)
+ {
+ ofstream file;
+ file.open("afterCbitp.gdl");
+ PrintingHackfixedMap = fixedMap;
+ printer::GDL_Print(file,top,&toString);
+ file.close();
+ }
+
+
assert(BVTypeCheck(result));
assert(status != CONFLICT); // conflict should have been seen earlier.
return result;