本文整理汇总了C++中ExpressionPtr::setCanonID方法的典型用法代码示例。如果您正苦于以下问题:C++ ExpressionPtr::setCanonID方法的具体用法?C++ ExpressionPtr::setCanonID怎么用?C++ ExpressionPtr::setCanonID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ExpressionPtr
的用法示例。
在下文中一共展示了ExpressionPtr::setCanonID方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getCanonical
ExpressionPtr AliasManager::getCanonical(ExpressionPtr e) {
unsigned val = (e->getCanonHash() % MaxBuckets) + 1;
BucketMapEntry &em = m_bucketMap[val];
ExpressionPtr c = em.find(e);
if (!c) {
add(em, e);
c = e;
e->setCanonPtr(ExpressionPtr());
} else {
e->setCanonID(c->getCanonID());
e->setCanonPtr(c);
}
return c;
}
示例2: visit
void ExprDict::visit(ExpressionPtr e) {
assert(m_canonIdMap.size() == m_canonTypeMap.size());
if (m_am.insertForDict(e)) {
// we've never seen e's structure before, so record it
record(e);
if (e->getCanonID() >= m_canonTypeMap.size()) {
m_canonTypeMap.resize(e->getCanonID() + 1);
m_canonIdMap.resize(e->getCanonID() + 1);
}
m_canonTypeMap[e->getCanonID()] =
TypePtrIdxPair(extractTypeAssertion(e), e->getCanonID());
m_canonIdMap[e->getCanonID()] = e->getCanonID();
} else if (e->isTypeAssertion()) {
TypePtrIdxPairVec types;
assert(isCanonicalStructure(e->getCanonID()));
getTypes(e->getCanonID(), types);
TypePtrIdxPair entry;
if (containsAssertion(e->getAssertedType(), types, entry)) {
e->setCanonID(entry.second);
} else {
// new type assertion seen, record it
int oldId = e->getCanonID();
assert(isCanonicalStructure(oldId));
record(e);
// insert it into the list
if (e->getCanonID() >= m_canonTypeMap.size()) {
m_canonTypeMap.resize(e->getCanonID() + 1);
m_canonIdMap.resize(e->getCanonID() + 1);
}
m_canonIdMap[e->getCanonID()] = oldId;
TypePtrIdxPair &head = m_canonTypeMap[oldId];
int oldSecond = head.second;
head.second = e->getCanonID();
m_canonTypeMap[e->getCanonID()] =
TypePtrIdxPair(e->getAssertedType(), oldSecond);
}
}
}
示例3: record
void Dictionary::record(ExpressionPtr e) {
e->setCanonID(m_idMap.size());
m_idMap.push_back(e);
}
示例4: canonicalizeNode
ExpressionPtr AliasManager::canonicalizeNode(ExpressionPtr e) {
e->setCanonPtr(ExpressionPtr());
e->setCanonID(0);
switch (e->getKindOf()) {
case Expression::KindOfObjectMethodExpression:
case Expression::KindOfDynamicFunctionCall:
case Expression::KindOfSimpleFunctionCall:
case Expression::KindOfNewObjectExpression:
add(m_bucketMap[0], e);
break;
case Expression::KindOfListAssignment:
add(m_bucketMap[0], e);
break;
case Expression::KindOfAssignmentExpression: {
AssignmentExpressionPtr ae = spc(AssignmentExpression,e);
if (e->getContext() & Expression::DeadStore) {
Construct::recomputeEffects();
return ae->getValue();
}
ExpressionPtr rep;
int interf = findInterf(ae->getVariable(), false, rep);
if (interf == SameAccess) {
switch (rep->getKindOf()) {
default:
break;
case Expression::KindOfAssignmentExpression:
{
AssignmentExpressionPtr a = spc(AssignmentExpression, rep);
ExpressionPtr value = a->getValue();
if (a->getValue()->getContext() & Expression::RefValue) {
break;
}
}
case Expression::KindOfUnaryOpExpression:
case Expression::KindOfBinaryOpExpression:
rep->setContext(Expression::DeadStore);
break;
}
}
add(m_bucketMap[0], e);
break;
}
case Expression::KindOfConstantExpression:
case Expression::KindOfSimpleVariable:
case Expression::KindOfDynamicVariable:
case Expression::KindOfArrayElementExpression:
case Expression::KindOfObjectPropertyExpression:
case Expression::KindOfStaticMemberExpression:
if (!(e->getContext() & (Expression::AssignmentLHS|
Expression::DeepAssignmentLHS|
Expression::OprLValue))) {
if (!(e->getContext() & (Expression::LValue|
Expression::RefValue|
Expression::RefParameter|
Expression::UnsetContext))) {
ExpressionPtr rep;
int interf = findInterf(e, true, rep);
if (interf == SameAccess) {
if (rep->getKindOf() == e->getKindOf()) {
e->setCanonID(rep->getCanonID());
e->setCanonPtr(rep);
return ExpressionPtr();
}
if (rep->getKindOf() == Expression::KindOfAssignmentExpression) {
ExpressionPtr rhs = spc(AssignmentExpression,rep)->getValue();
if (rhs->is(Expression::KindOfScalarExpression)) {
rhs = rhs->clone();
getCanonical(rhs);
return rhs;
}
e->setCanonPtr(rhs);
}
}
}
add(m_bucketMap[0], e);
} else {
getCanonical(e);
}
break;
case Expression::KindOfBinaryOpExpression: {
BinaryOpExpressionPtr bop = spc(BinaryOpExpression, e);
int rop = getOpForAssignmentOp(bop->getOp());
if (rop) {
ExpressionPtr lhs = bop->getExp1();
ExpressionPtr rep;
if (bop->getContext() & Expression::DeadStore) {
Construct::recomputeEffects();
ExpressionPtr rhs = bop->getExp2()->clone();
lhs = lhs->clone();
lhs->clearContext(Expression::LValue);
lhs->clearContext(Expression::NoLValueWrapper);
lhs->clearContext(Expression::OprLValue);
rep = ExpressionPtr
(new BinaryOpExpression(e->getLocation(),
//.........这里部分代码省略.........
示例5: add
void AliasManager::add(BucketMapEntry &em, ExpressionPtr e) {
em.add(e);
e->setCanonID(m_nextID++);
}