summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/DataStructure/Local.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-10-21 02:08:03 +0000
committerChris Lattner <sabre@nondot.org>2002-10-21 02:08:03 +0000
commit5c3ce31e1f5bbcd904ebca86593d18e094971853 (patch)
tree8dae99dcdf88da2ad500c77ee0395c7ad4902c80 /llvm/lib/Analysis/DataStructure/Local.cpp
parentfaa756ecee9eb76aca8551aefd068c64e7e0c544 (diff)
downloadbcm5719-llvm-5c3ce31e1f5bbcd904ebca86593d18e094971853.tar.gz
bcm5719-llvm-5c3ce31e1f5bbcd904ebca86593d18e094971853.zip
- Make DSCallSite not inherit from std::vector. Renamed methods slightly.
Make copy ctor have two versions to avoid dealing with conditional template argument. DSCallSite ctor now takes all arguments instead of taking one and being populated later. llvm-svn: 4240
Diffstat (limited to 'llvm/lib/Analysis/DataStructure/Local.cpp')
-rw-r--r--llvm/lib/Analysis/DataStructure/Local.cpp31
1 files changed, 17 insertions, 14 deletions
diff --git a/llvm/lib/Analysis/DataStructure/Local.cpp b/llvm/lib/Analysis/DataStructure/Local.cpp
index 7a749a1a795..0e17d7232fd 100644
--- a/llvm/lib/Analysis/DataStructure/Local.cpp
+++ b/llvm/lib/Analysis/DataStructure/Local.cpp
@@ -257,6 +257,7 @@ DSNodeHandle &GraphBuilder::getLink(const DSNodeHandle &node,
/// object, pointing the scalar to it.
///
void GraphBuilder::handleAlloc(AllocationInst &AI, DSNode::NodeTy NodeType) {
+ //DSNode *New = createNode(NodeType, Type::VoidTy);
DSNode *New = createNode(NodeType, AI.getAllocatedType());
// Make the scalar point to the new node...
@@ -354,28 +355,30 @@ void GraphBuilder::visitReturnInst(ReturnInst &RI) {
}
void GraphBuilder::visitCallInst(CallInst &CI) {
- // Add a new function call entry...
- FunctionCalls.push_back(CI);
- DSCallSite &Args = FunctionCalls.back();
-
// Set up the return value...
+ DSNodeHandle RetVal;
if (isPointerType(CI.getType()))
- Args.push_back(getLink(getValueNode(CI), 0, CI.getType()));
- else
- Args.push_back(DSNodeHandle());
+ RetVal = getLink(getValueNode(CI), 0, CI.getType());
- unsigned Start = 0;
+ DSNodeHandle Callee;
// Special case for a direct call, avoid creating spurious scalar node...
- if (GlobalValue *GV = dyn_cast<GlobalValue>(CI.getOperand(0))) {
- Args.push_back(getGlobalNode(*GV));
- Start = 1;
- }
+ if (GlobalValue *GV = dyn_cast<GlobalValue>(CI.getOperand(0)))
+ Callee = getGlobalNode(*GV);
+ else
+ Callee = getLink(getValueNode(*CI.getOperand(0)), 0,
+ CI.getOperand(0)->getType());
+
+ std::vector<DSNodeHandle> Args;
+ Args.reserve(CI.getNumOperands()-1);
- // Pass the arguments in...
- for (unsigned i = Start, e = CI.getNumOperands(); i != e; ++i)
+ // Calculate the arguments vector...
+ for (unsigned i = 1, e = CI.getNumOperands(); i != e; ++i)
if (isPointerType(CI.getOperand(i)->getType()))
Args.push_back(getLink(getValueNode(*CI.getOperand(i)), 0,
CI.getOperand(i)->getType()));
+
+ // Add a new function call entry...
+ FunctionCalls.push_back(DSCallSite(CI, RetVal, Callee, Args));
}
/// Handle casts...
OpenPOWER on IntegriCloud