本文整理汇总了C++中Address::Expand方法的典型用法代码示例。如果您正苦于以下问题:C++ Address::Expand方法的具体用法?C++ Address::Expand怎么用?C++ Address::Expand使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Address
的用法示例。
在下文中一共展示了Address::Expand方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
// Resolves the sccs in the dependence graph
void RangeBasedPointerAnalysis::resolveSCCs
(std::map<int,std::pair<RangedPointer*, int> > sccs)
{
std::deque<RangedPointer*> dq;
for(auto i : RangedPointers) i.second->color = 0;
for(auto i : sccs)
{
//std::cout << i.first << "/" << scc << "\n";
// if the scc has more then one pointer than there is a loop
//if(i.second.second > 1)
{
dq.clear();
SCC_DFS_visit(i.second.first, &dq);
while(!dq.empty())
{
RangedPointer* rp = dq.front();
dq.pop_front();
//std::cout << rp << "\n";
std::deque<Address*> ad;
std::set<Address*> fn;
std::pair<RangedPointer*, Range> p =
std::pair<RangedPointer*, Range>(rp, Range(Expr(*SI, 0)));
for(auto j = rp->addr_begin(), je = rp->addr_end(); j != je; j++)
{
ad.push_front(*j);
(*j)->expanded.insert(p);
}
while(!ad.empty())
{
//std::cout << "ad: " << ad.size() << "\n";
Address* addr = ad.front();
ad.pop_front();
if(addr->getBase()->scc == rp->scc)
{
//std::cout << "expand\n";
addr->Expand(ad, fn);
}
else
{
//std::cout << "insert\n";
fn.insert(addr);
}
}
}
}
}
}
示例2: while
/// \brief Resolves the strongly connected components from the graph
void OffsetBasedAliasAnalysis::resolveSCCs
(std::map<int,std::pair<OffsetPointer*, int> > sccs) {
std::deque<OffsetPointer*> dq;
for(auto i : offset_pointers) i.second->color = 0;
for(auto i : sccs) {
dq.clear();
DFS_visit_t_scc(i.second.first, &dq);
while(!dq.empty()) {
OffsetPointer* rp = dq.front();
dq.pop_front();
std::deque<Address*> ad;
std::set<Address*> fn;
//it expanded itself
std::pair<OffsetPointer*, Offset> p =
std::pair<OffsetPointer*, Offset>(rp, Offset());
for(auto j = rp->addr_begin(), je = rp->addr_end(); j != je; j++) {
ad.push_front(*j);
(*j)->expanded.insert(p);
}
while(!ad.empty()) {
Address* addr = ad.front();
ad.pop_front();
if
(
(addr->getBase()->scc == rp->scc)
and
(
(addr->getBase()->getPointerType() == OffsetPointer::Phi)
or
(addr->getBase()->getPointerType() == OffsetPointer::Cont)
)
) {
// if its in the same scc we must expand
addr->Expand(ad, fn);
} else {
// if its not from the same scc there's nothing more to be done
fn.insert(addr);
}
}
}
}
}
示例3: resolveWholeGraph
/// \brief Resolves the whole graph
void OffsetBasedAliasAnalysis::resolveWholeGraph() {
std::deque<OffsetPointer*> dq;
for(auto i : offset_pointers) i.second->color = 0;
for(auto i : offset_pointers) {
if(i.second->getPointerType() != OffsetPointer::Cont
and i.second->color == 0) {
DFS_visit_t(i.second, &dq);
}
}
while(!dq.empty()) {
OffsetPointer* rp = dq.front();
dq.pop_front();
std::deque<Address*> ad;
std::set<Address*> fn;
for(auto j = rp->addr_begin(), je = rp->addr_end(); j != je; j++)
ad.push_front(*j);
while(!ad.empty()) {
Address* addr = ad.front();
ad.pop_front();
if(addr->getBase() == addr->getAddressee()) {
//if the base is the very addressee, then we have a meaningless loop
delete addr;
} else if(addr->getBase()->getPointerType() == OffsetPointer::Phi
or addr->getBase()->getPointerType() == OffsetPointer::Cont) {
//if its a phi or a continuous pointer there must be expansion
addr->Expand(ad, fn);
} else {
//if its not a phi or a continuous pointer there's nothing more to
// be done
fn.insert(addr);
}
}
}
}
示例4: resolveWholeGraph
// Resolves the whole graph
void RangeBasedPointerAnalysis::resolveWholeGraph()
{
std::deque<RangedPointer*> dq;
for(auto i : RangedPointers) i.second->color = 0;
for(auto i : RangedPointers)
{
if(i.second->getPointerType() != RangedPointer::Cont
and i.second->color == 0)
{
DFS_visit(i.second, &dq);
}
}
/*std::cout << "Expanded sizes:\n";
for(auto i : RangedPointers)
{
for(auto j : i.second->Addresses)
{
std::cout << j->expanded.size();
if(j->expanded.find(i.second) != j->expanded.end())
std::cout << "SIM ";
else
std::cout << "NAO ";
}
std::cout << "\n";
}
int n;
std::cin >> n;
*/
while(!dq.empty())
{
RangedPointer* rp = dq.front();
dq.pop_front();
std::deque<Address*> ad;
std::set<Address*> fn;
for(auto j = rp->addr_begin(), je = rp->addr_end(); j != je; j++)
ad.push_front(*j);
while(!ad.empty())
{
Address* addr = ad.front();
ad.pop_front();
if(addr->getBase() == addr->getAddressee())
{
delete addr;
}
else if(addr->getBase()->getPointerType() == RangedPointer::Phi
or addr->getBase()->getPointerType() == RangedPointer::Cont)
{
//std::cout << "expand ";
addr->Expand(ad, fn);
}
else
{
//std::cout << "insert\n";
fn.insert(addr);
}
}
}
}