本文整理汇总了C++中Exp::isAddrOf方法的典型用法代码示例。如果您正苦于以下问题:C++ Exp::isAddrOf方法的具体用法?C++ Exp::isAddrOf怎么用?C++ Exp::isAddrOf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Exp
的用法示例。
在下文中一共展示了Exp::isAddrOf方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: solve
bool Constraints::solve(std::list<ConstraintMap>& solns) {
LOG << conSet.size() << " constraints:";
std::ostringstream os; conSet.print(os); LOG << os.str().c_str();
// Replace Ta[loc] = ptr(alpha) with
// Tloc = alpha
LocationSet::iterator cc;
for (cc = conSet.begin(); cc != conSet.end(); cc++) {
Exp* c = *cc;
if (!c->isEquality()) continue;
Exp* left = ((Binary*)c)->getSubExp1();
if (!left->isTypeOf()) continue;
Exp* leftSub = ((Unary*)left)->getSubExp1();
if (!leftSub->isAddrOf()) continue;
Exp* right = ((Binary*)c)->getSubExp2();
if (!right->isTypeVal()) continue;
Type* t = ((TypeVal*)right)->getType();
if (!t->isPointer()) continue;
// Don't modify a key in a map
Exp* clone = c->clone();
// left is typeof(addressof(something)) -> typeof(something)
left = ((Binary*)clone)->getSubExp1();
leftSub = ((Unary*)left)->getSubExp1();
Exp* something = ((Unary*)leftSub)->getSubExp1();
((Unary*)left)->setSubExp1ND(something);
((Unary*)leftSub)->setSubExp1ND(NULL);
delete leftSub;
// right is <alpha*> -> <alpha>
right = ((Binary*)clone)->getSubExp2();
t = ((TypeVal*)right)->getType();
((TypeVal*)right)->setType(((PointerType*)t)->getPointsTo()->clone());
delete t;
conSet.remove(c);
conSet.insert(clone);
delete c;
}
// Sort constraints into a few categories. Disjunctions go to a special
// list, always true is just ignored, and constraints of the form
// typeof(x) = y (where y is a type value) go to a map called fixed.
// Constraint terms of the form Tx = Ty go into a map of LocationSets
// called equates for fast lookup
for (cc = conSet.begin(); cc != conSet.end(); cc++) {
Exp* c = *cc;
if (c->isTrue()) continue;
if (c->isFalse()) {
if (VERBOSE || DEBUG_TA)
LOG << "Constraint failure: always false constraint\n";
return false;
}
if (c->isDisjunction()) {
disjunctions.push_back(c);
continue;
}
// Break up conjunctions into terms
Exp* rem = c, *term;
while ((term = nextConjunct(rem)) != NULL) {
assert(term->isEquality());
Exp* lhs = ((Binary*)term)->getSubExp1();
Exp* rhs = ((Binary*)term)->getSubExp2();
if (rhs->isTypeOf()) {
// Of the form typeof(x) = typeof(z)
// Insert into equates
equates.addEquate(lhs, rhs);
} else {
// Of the form typeof(x) = <typeval>
// Insert into fixed
assert(rhs->isTypeVal());
fixed[lhs] = rhs;
}
}
}
{LOG << "\n" << (unsigned)disjunctions.size() << " disjunctions: "; std::list<Exp*>::iterator dd;
for (dd = disjunctions.begin(); dd != disjunctions.end(); dd++) LOG << *dd << ",\n"; LOG << "\n";}
LOG << fixed.size() << " fixed: " << fixed.prints();
LOG << equates.size() << " equates: " << equates.prints();
// Substitute the fixed types into the disjunctions
substIntoDisjuncts(fixed);
// Substitute the fixed types into the equates. This may generate more
// fixed types
substIntoEquates(fixed);
LOG << "\nAfter substitute fixed into equates:\n";
{LOG << "\n" << (unsigned)disjunctions.size() << " disjunctions: "; std::list<Exp*>::iterator dd;
for (dd = disjunctions.begin(); dd != disjunctions.end(); dd++) LOG << *dd << ",\n"; LOG << "\n";}
LOG << fixed.size() << " fixed: " << fixed.prints();
LOG << equates.size() << " equates: " << equates.prints();
// Substitute again the fixed types into the disjunctions
// (since there may be more fixed types from the above)
substIntoDisjuncts(fixed);
LOG << "\nAfter second substitute fixed into disjunctions:\n";
{LOG << "\n" << (unsigned)disjunctions.size() << " disjunctions: "; std::list<Exp*>::iterator dd;
for (dd = disjunctions.begin(); dd != disjunctions.end(); dd++) LOG << *dd << ",\n"; LOG << "\n";}
LOG << fixed.size() << " fixed: " << fixed.prints();
LOG << equates.size() << " equates: " << equates.prints();
ConstraintMap soln;
//.........这里部分代码省略.........