diff options
author | Chris Lattner <sabre@nondot.org> | 2002-10-21 02:08:03 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-10-21 02:08:03 +0000 |
commit | 0969c50cb812efb9dba9577a58cad19c56c21642 (patch) | |
tree | 493b6c4071ffb22df02fd983b540583dced770dd /lib/Analysis/DataStructure/Local.cpp | |
parent | 0c8d73b74c04ef03c6ba2fb21ff48f9c23daf643 (diff) |
- 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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4240 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/DataStructure/Local.cpp')
-rw-r--r-- | lib/Analysis/DataStructure/Local.cpp | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/lib/Analysis/DataStructure/Local.cpp b/lib/Analysis/DataStructure/Local.cpp index 7a749a1a79..0e17d7232f 100644 --- a/lib/Analysis/DataStructure/Local.cpp +++ b/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... |