// If the bits are totally fixed, then return a new matching ASTNode. ASTNode bitsToNode(const ASTNode& node, const FixedBits& bits) { ASTNode result; STPMgr & beev = *node.GetSTPMgr(); assert (bits.isTotallyFixed()); assert (!node.isConstant()); // Peformance. Shouldn't waste time calling it on constants. if (node.GetType() == BOOLEAN_TYPE) { if (bits.getValue(0)) { result = beev.CreateNode(TRUE); } else { result = beev.CreateNode(FALSE); } } else if (node.GetType() == BITVECTOR_TYPE) { result = beev.CreateBVConst(bits.GetBVConst(), node.GetValueWidth()); } else FatalError("sadf234s"); assert(result.isConstant()); return result; }
FixedBits* ConstantBitPropagation::getUpdatedFixedBits(const ASTNode& n) { FixedBits* output = getCurrentFixedBits(n); const Kind k = n.GetKind(); if (n.isConstant()) { assert(output->isTotallyFixed()); return output; } if (SYMBOL == k) return output; // No transfer functions for these. vector<FixedBits*> children; const int numberOfChildren = n.GetChildren().size(); children.reserve(numberOfChildren); for (int i = 0; i < numberOfChildren; i++) { children.push_back(getCurrentFixedBits(n.GetChildren()[i])); } assert(status != CONFLICT); status = dispatchToTransferFunctions(k, children, *output, n, msm); //result = dispatchToMaximallyPrecise(k, children, *output, n,msm); assert(((unsigned)output->getWidth()) == n.GetValueWidth() || output->getWidth() ==1); return output; }