77 constrTypes constrType;
87 std::map<varID, std::map<varID, affineInequality> > vars2Value;
113 std::set<varID> vars;
124 std::set<varID> modifiedVars;
135 std::string annotName;
137 std::set<varID> varsToInclude;
139 n(n), state(state), annotName(annotName), annotVal(annotVal), varsToInclude(varsToInclude) {}
141 n(n), state(state), annotName(annotName), annotVal(annotVal) {}
143 n(n), state(state), annotName(
""), annotVal(NULL) {}
144 bool operator==(
const NodeDesc& that)
const {
return n==that.n && &state==&(that.state) && annotName==that.annotName && annotVal==that.annotVal && varsToInclude==that.varsToInclude; }
145 bool operator<(
const NodeDesc& that)
const {
147 (n==that.n && &state< &(that.state)) ||
148 (n==that.n && &state==&(that.state) && annotName<that.annotName) ||
149 (n==that.n && &state==&(that.state) && annotName==that.annotName && annotVal<that.annotVal) ||
150 (n==that.n && &state==&(that.state) && annotName==that.annotName && annotVal==that.annotVal && varsToInclude<that.varsToInclude);
160 bool initialized=
true, std::string indent=
"");
165 bool initialized=
true, std::string indent=
"");
170 bool initialized=
true, std::string indent=
"");
185 std::string indent=
"");
190 std::string indent=
"");
200 void initCG(
const Function& func,
const std::set<NodeDesc>& nodes,
bool initialized, std::string indent=
"");
206 void initialize(std::string indent=
"");
219 std::string DivLattices2Str(std::string indent=
"");
227 bool addVar(
const varID& scalar, std::string indent=
"");
232 bool removeVar(
const varID& scalar, std::string indent=
"");
235 const varIDSet& getVars()
const;
238 varIDSet& getVarsMod();
250 bool copyFrom(
ConstrGraph &that, std::string indent=
"");
264 bool diffConstraints(
ConstrGraph &that, std::string indent=
"");
269 bool copyConstraints(
ConstrGraph &that, std::string indent=
"");
280 void eraseConstraints(
bool noBottomCheck=
false, std::string indent=
"");
288 bool eraseVarConstr(
const varID& eraseVar,
bool noConsistencyCheck=
false, std::string indent=
"");
295 bool eraseVarConstrNoDiv(
const varID& eraseVar,
bool noConsistencyCheck=
false, std::string indent=
"");
302 bool eraseVarConstrNoDivVars(
const varID& eraseVar,
bool noConsistencyCheck=
false, std::string indent=
"");
312 bool replaceVar(
const varID& origVar,
const varID& newVar,
bool noConsistencyCheck=
false, std::string indent=
"");
317 bool annotInterestingVar(
const varID& var,
const std::set<std::pair<std::string, void*> >& noCopyAnnots,
const std::set<varID>& noCopyVars,
318 const std::string& annotName,
void* annotVal, std::string indent=
"");
332 bool copyAnnotVars(std::string srcAnnotName,
void* srcAnnotVal,
333 std::string tgtAnnotName,
void* tgtAnnotVal,
334 const std::set<std::pair<std::string, void*> >& noCopyAnnots,
335 const std::set<varID>& noCopyVars, std::string indent=
"");
348 bool mergeAnnotVars(
const std::string& finalAnnotName,
void* finalAnnotVal,
349 const std::string& remAnnotName,
void* remAnnotVal,
350 const std::set<std::pair<std::string, void*> >& noCopyAnnots,
351 const std::set<varID>& noCopyVars, std::string indent=
"");
357 bool unionXYsubMap(std::map<varID, affineInequality>& subMap,
const varID& y,
const affineInequality& ineq, std::string indent=
"");
368 bool mergeAnnotVarsSubMap(std::map<varID, affineInequality>& subMap,
369 std::string finalAnnotName,
void* finalAnnotVal,
370 std::string remAnnotName,
void* remAnnotVal,
371 const std::set<std::pair<std::string, void*> >& noCopyAnnots,
372 const std::set<varID>& noCopyVars, std::string indent=
"");
377 bool mergeAnnotVarsSet(std::set<varID> varsSet,
378 std::string finalAnnotName,
void* finalAnnotVal,
379 std::string remAnnotName,
void* remAnnotVal,
380 const std::set<std::pair<std::string, void*> >& noCopyAnnots,
381 const std::set<varID>& noCopyVars, std::string indent=
"");
388 static bool varHasAnnot(
const varID& var,
const std::set<std::pair<std::string, void*> >& annots, std::string indent=
"");
393 static bool varHasAnnot(
const varID& var, std::string annotName,
void* annotVal, std::string indent=
"");
404 void remapVars(
const std::map<varID, varID>&,
const Function &) {
412 void incorporateVars(
Lattice*) {
433 return meetUpdate(exprState,
" ");
439 ConstrGraph* getProjection(
const varIDSet& focusVars, std::string indent=
"");
446 std::string annotName,
const varIDSet& noAnnot, std::string indent=
"");
453 std::string annotName,
const varIDSet& noAnnot, std::string indent=
"");
459 bool removeVarAnnot(std::string annotName,
void* annot, std::string indent=
"");
464 bool replaceVarAnnot(std::string oldAnnotName,
void* oldAnnot,
465 std::string newAnnotName,
void* newAnnot, std::string indent=
"");
471 bool addVarAnnot(std::string tgtAnnotName,
void* tgtAnnotVal, std::string newAnnotName,
void* newAnnotVal, std::string indent=
"");
480 bool negate(std::string indent=
"");
486 bool assign(
varID x,
varID y,
int a,
int b,
int c, std::string indent=
"");
490 bool assignBot(
varID var, std::string indent=
"");
495 bool assignTop(
varID var, std::string indent=
"");
515 bool assertCond(
const varID& x,
const varID& y,
int a,
int b,
int c, std::string indent=
"");
521 bool assertEq(
const varID& x,
const varID& y,
int a=1,
int b=1,
int c=0, std::string indent=
"");
526 affineInequality::signs getVarSign(
const varID& var, std::string indent=
"");
529 bool isEqZero(
const varID& var, std::string indent=
"");
532 bool eqVars(
const varID& v1,
const varID& v2,
int a=1,
int b=1,
int c=0, std::string indent=
"");
533 bool eqVars(
const varID& v1,
const varID& v2, std::string indent=
"")
534 {
return eqVars(v1, v2, 1, 1, 0, indent); }
538 bool isEqVars(
const varID& v1,
const varID& v2,
int& a,
int& b,
int& c, std::string indent=
"");
542 std::map<varID, affineInequality> getEqVars(
varID var, std::string indent=
"");
545 bool lteVars(
const varID& v1,
const varID& v2,
int a=1,
int b=1,
int c=0, std::string indent=
"");
548 bool ltVars(
const varID& v1,
const varID& v2,
int a=1,
int b=1,
int c=0, std::string indent=
"");
555 std::map<varID, std::map<varID, affineInequality> >::const_iterator curX;
556 std::map<varID, affineInequality>::const_iterator curY;
560 const std::map<
varID, std::map<varID, affineInequality> >
::iterator& curX);
570 void operator ++ (
int);
572 bool operator==(
const leIterator& otherIt)
const;
573 bool operator!=(
const leIterator& otherIt)
const;
584 std::map<varID, std::map<varID, affineInequality> >::const_iterator curX;
585 std::map<varID, affineInequality>::const_iterator curY;
595 const std::map<
varID, std::map<varID, affineInequality> >
::iterator& curX,
596 const std::map<varID, affineInequality>::iterator& curY);
608 const varID& getX()
const;
613 void operator ++ (
int);
615 bool operator==(
const geIterator& otherIt)
const;
616 bool operator!=(
const geIterator& otherIt)
const;
626 bool widenUpdate(
InfiniteLattice* that) {
return widenUpdate(that,
""); }
631 bool widenUpdateLimitToThat(
InfiniteLattice* that, std::string indent=
"");
634 bool widenUpdate_ex(
InfiniteLattice* that_arg,
bool limitToThat, std::string indent=
"");
641 bool meetUpdate(
Lattice* that, std::string indent=
"");
642 bool meetUpdate(
Lattice* that) {
return meetUpdate(that,
""); }
647 bool meetUpdateLimitToThat(
InfiniteLattice* that, std::string indent=
"");
650 bool meetUpdate_ex(
Lattice* that_arg,
bool limitToThat, std::string indent=
"");
653 bool orUpd(
LogicalCond& that, std::string indent=
"");
655 {
return orUpd(that,
""); }
658 bool andUpd(
LogicalCond& that, std::string indent=
"");
660 {
return andUpd(that,
""); }
662 bool andUpd(
ConstrGraph* that, std::string indent=
"");
664 {
return andUpd(that,
""); }
670 bool OrAndWidenUpdate(
ConstrGraph* that,
bool meet,
bool OR,
bool limitToThat, std::string indent=
"");
676 void OrAndWidenUpdate_XinThisNotThat(
677 bool OR,
bool limitToThat,
678 std::map<
varID, std::map<varID, affineInequality> >
::iterator& itThisX,
bool& modified,
679 std::string indent=
"");
687 void OrAndWidenUpdate_XinThatNotThis(
688 bool OR,
bool limitToThat,
690 std::map<
varID, std::map<varID, affineInequality> >
::iterator& itThatX,
691 std::map<
varID, std::map<varID, affineInequality> >& additionsToThis,
692 bool& modified, std::string indent=
"");
697 void OrAndWidenUpdate_YinThisNotThat(
698 bool OR,
bool limitToThat,
699 std::map<
varID, std::map<varID, affineInequality> >
::iterator& itThisX,
700 std::map<varID, affineInequality>::iterator& itThisY,
701 bool& modified, std::string indent=
"");
709 void OrAndWidenUpdate_YinThatNotThis(
710 bool OR,
bool limitToThat,
711 std::map<
varID, std::map<varID, affineInequality> >
::iterator& itThatX,
712 std::map<varID, affineInequality>::iterator& itThatY,
713 std::map<varID, affineInequality>& additionsToThis,
714 bool& modified, std::string indent=
"");
718 bool transitiveClosure(std::string indent=
"");
720 bool transitiveClosureDiv(std::string indent=
"");
721 void transitiveClosureY(
const varID& x,
const varID& y,
bool& modified,
int& numSteps,
int& numInfers,
bool& iterModified, std::string indent=
"");
722 void transitiveClosureZ(
const varID& x,
const varID& y,
const varID& z,
bool& modified,
int& numSteps,
int& numInfers,
bool& iterModified, std::string indent=
"");
743 bool localTransClosure(
const varID& tgtVar, std::string indent=
"");
750 bool checkSelfConsistency(std::string indent=
"");
784 bool containsVar(
const varID& var, std::string indent=
"");
797 bool setVal(
varID x,
varID y,
int a,
int b,
int c,
798 std::string indent=
"");
808 bool setToUninitialized_KeepState(std::string indent=
"");
812 bool setToBottom(std::string indent=
"");
817 bool setToConstrKnown(constrTypes ct,
bool eraseCurConstr=
true, std::string indent=
"");
823 bool setToInconsistent(std::string indent=
"");
828 bool setToTop(
bool onlyIfNotInit=
false, std::string indent=
"");
834 std::pair<levels, constrTypes> getLevel(
bool noConsistencyCheck=
false, std::string indent=
"");
839 bool isSelfConsistent(
bool noConsistencyCheck=
false, std::string indent=
"");
844 bool hasConsistentConstraints(
bool noConsistencyCheck=
false, std::string indent=
"");
850 bool isMaximalState(
bool noConsistencyCheck=
false, std::string indent=
"");
858 std::string str(std::string indent=
"");
859 void varSetStatusToStream(
const std::set<varID>& vars, std::ostringstream& outs,
bool &needEndl, std::string indent=
"");
870 std::string str(std::string indent,
bool useIsBottom);
874 std::string toDOT(std::string graphName);
878 std::string toDOT(std::string graphName, std::set<varID>& focusVars);
884 bool operator == (
Lattice* that);
891 bool mustOutsideRange(
varID x,
int b,
int c,
varID y, std::string indent=
"");
895 bool mayTrue(std::string indent=
"");
896 bool mayTrue() {
return mayTrue(
""); }
904 void beginTransaction(std::string indent=
"");
905 void endTransaction(std::string indent=
"");