Submitted by: Submitted by msingh40
Views: 10
Words: 250
Pages: 1
Category: Philosophy and Psychology
Date Submitted: 11/04/2015 06:09 PM
Algorithm :
Given : usagenode in ICFG
usagenode.label = nodenumber // assign label to given usage point.
p=path // it will be used to calculate number of paths traversed from usage point or from any node having label.
i=0;
n=usagenode.upedges; // to calculate number of upedges from usage point.
while(inext = NULL;
currentnode = label;
if(p==n)
{
label=label->prev; // jump to previos label
label->next = NULL;
currentnode=label;
}
trav(currentnode,n,label)
}
elseif(currentnode==Declnode)
{
Print Path;
label = label->prev;
label->next = NULL;
currentnode=label;
if(p==n)
{
label=label->prev; // jump to previos label
label->next = NULL;
currentnode=label;
}
trav(currentnode,n,label)
}
else
{
while(currentnode.inedge==1 && currentnode.outedge==1)
{
head[s]=join(currentnode); // where k will be the array of structures.
}
if(currentnode=usagenode)
{
headpath = usagenode;
headpath->next = NULL;
pathcont = headpath;
}
else
{
pathcont->next = currentnode;
pathcont = pathcont->next;
pathcont->next=NULL;
}
if(currentnode.inedge==1)
{
currentnode = currentnode.parent;
}
if(currentnode.inedge>1)
{
label.next = currentnode.number;
label = label->next;
label->next = NULL;
}
trav(currentnode,n,label);
}
}
while(currentnode.allinedge.flag==T && currentnode!=usagenode)
{
label=label->prev; // jump to previos label
label->next = NULL;
currentnode=label;
}
}
/* Join function */
join(currentnode)
{
s++;
head[s]=currentnode;
t=head[s];
t->next = NULL;
while(currentnode.inedge==1 && currentnode.outedge==1)
{
currentnode = currentnode.parent;
if(currentnode.inedge==1 && currentnode.outedge==1)
{
t->next =...