From 0969c50cb812efb9dba9577a58cad19c56c21642 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 21 Oct 2002 02:08:03 +0000 Subject: - 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 --- lib/Analysis/DataStructure/Local.cpp | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) (limited to 'lib/Analysis/DataStructure/Local.cpp') 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(CI.getOperand(0))) { - Args.push_back(getGlobalNode(*GV)); - Start = 1; - } + if (GlobalValue *GV = dyn_cast(CI.getOperand(0))) + Callee = getGlobalNode(*GV); + else + Callee = getLink(getValueNode(*CI.getOperand(0)), 0, + CI.getOperand(0)->getType()); + + std::vector 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... -- cgit v1.2.3-18-g5258