Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding support for vector operands (Patch 2) #74

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions lib/MemoryModel/PAGBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,27 @@ void PAGBuilder::visitStoreInst(StoreInst &inst) {
NodeID src = getValueNode(inst.getValueOperand());

pag->addStoreEdge(src, dst);
} else {
// if this is a vector operand, process the individual operands.
if(isa<VectorType>(inst.getValueOperand()->getType()) && dyn_cast<ConstantVector>(inst.getValueOperand())) {
ConstantVector *CVExpr = dyn_cast<ConstantVector>(inst.getValueOperand());
bool dstCreated = false;
NodeID vdst;
// iterate for each element in the vector
for(unsigned vindex = 0; vindex < CVExpr->getNumOperands(); ++vindex) {
if(CVExpr->getOperand(vindex)->getType()->isPointerTy()) {
NodeID vsrc = getValueNode(CVExpr->getOperand(vindex));
// create dst node only if its required. i.e., if any of the element
// of the vector's value is a pointer type.
if(!dstCreated) {
vdst = getValueNode(inst.getPointerOperand());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we also consider whether the PointerOperand is a ConstantVector or not?

dstCreated = true;
}
pag->addStoreEdge(vsrc, vdst);
}

}
}
}

}
Expand Down