18 void updateModified(
bool latModified) { modified = latModified || modified; }
25 return sgn ? getLattice(SgExpr2Var(sgn)) : NULL;
27 LatticeType *getLattice(
varID var) {
28 return dynamic_cast<LatticeType *
>(prodLat->getVarLattice(var));
35 resLat = getLattice(sgn);
37 if(isSgCompoundAssignOp(sgn)) {
38 if(resLat==NULL && arg1Lat != NULL)
43 return (arg1Lat && arg2Lat && resLat);
46 bool getLattices(
const SgUnaryOp *sgn, LatticeType* &arg1Lat, LatticeType* &arg2Lat, LatticeType* &resLat) {
48 resLat = getLattice(sgn);
51 if(isSgMinusMinusOp(sgn) || isSgPlusPlusOp(sgn)) {
52 arg2Lat =
new LatticeType(1);
57 return (arg1Lat && arg2Lat && resLat);
67 const std::vector<Lattice*>& lattices = prodLat->getLattices();
68 for(std::vector<Lattice*>::const_iterator it = lattices.begin(); it!=lattices.end(); it++)
69 (
dynamic_cast<LatticeType *
>(*it))->
initialize();
74 LatticeType *lhsLat, *rhsLat, *resLat;
78 if(resLat) Dbg::dbg <<
"resLat=\n "<<resLat->str(
" ")<<
"\n";
79 if(lhsLat) Dbg::dbg <<
"lhsLat=\n "<<lhsLat->str(
" ")<<
"\n";
80 if(rhsLat) Dbg::dbg <<
"rhsLat=\n "<<rhsLat->str(
" ")<<
"\n";
85 { resLat->copy(rhsLat); modified =
true; }
87 { lhsLat->copy(rhsLat); modified =
true; }
92 LatticeType* asgnLat = getLattice(sgn->
get_operand());
93 LatticeType* resLat = getLattice(sgn);
96 if(asgnLat) Dbg::dbg <<
"asgnLat= "<<asgnLat->str(
" ")<<
"\n";
97 if(resLat) Dbg::dbg <<
"resLat= "<<resLat->str(
" ")<<
"\n";
101 if(resLat) { resLat->copy(asgnLat); modified =
true; }
109 LatticeType *res = getLattice(sgn);
111 if (inits.size() > 0) {
112 res->copy(getLattice(inits[0]));
114 for (
size_t i = 1; i < inits.size(); ++i)
115 res->meetUpdate(getLattice(inits[i]));
129 LatticeType* varLat = getLattice(initName);
132 LatticeType* initLat = getLattice(initName->get_initializer());
135 varLat->copy(initLat);
142 LatticeType *lhs, *rhs, *res;
146 res->meetUpdate(rhs);
152 LatticeType *lhs, *rhs, *res;
155 updateModified(lhs->meetUpdate(rhs));
165 LatticeType *lhsLat, *rhsLat, *resLat;
169 resLat->copy(rhsLat);
179 *resLat = getLattice(sgn);
183 resLat->copy(condLat);
184 resLat->meetUpdate(trueLat);
185 resLat->meetUpdate(falseLat);
198 LatticeType *res = getLattice(sgn);
bool getLattices(const SgBinaryOp *sgn, LatticeType *&arg1Lat, LatticeType *&arg2Lat, LatticeType *&resLat)
create three lattices from a binary operation: lhs, rhs, and result lattices