[llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp TopDownClosure.cpp
Chris Lattner
lattner at cs.uiuc.edu
Mon Oct 21 10:05:01 PDT 2002
Changes in directory llvm/lib/Analysis/DataStructure:
DataStructure.cpp updated: 1.32 -> 1.33
TopDownClosure.cpp updated: 1.13 -> 1.14
---
Log message:
As it turns out, we don't need a fully generic mapping copy ctor, we just need
something that maps through a std::map. Since this simplified the client and
implementation code, do so now.
---
Diffs of the changes:
Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp
diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.32 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.33
--- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.32 Mon Oct 21 08:31:48 2002
+++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Mon Oct 21 10:04:17 2002
@@ -361,18 +361,6 @@
return *Inst->getParent()->getParent();
}
-template <typename CopyFunctor>
-DSCallSite::DSCallSite(const DSCallSite &FromCall, CopyFunctor nodeCopier)
- : Inst(FromCall.Inst) {
-
- RetVal = nodeCopier(&FromCall.RetVal);
- Callee = nodeCopier(&FromCall.Callee);
-
- CallArgs.reserve(FromCall.CallArgs.size());
- for (unsigned j = 0, ej = FromCall.CallArgs.size(); j != ej; ++j)
- CallArgs.push_back(nodeCopier(&FromCall.CallArgs[j]));
-}
-
//===----------------------------------------------------------------------===//
// DSGraph Implementation
@@ -402,11 +390,6 @@
void DSGraph::dump() const { print(std::cerr); }
-static DSNodeHandle copyHelper(const DSNodeHandle* fromNode,
- std::map<const DSNode*, DSNode*> *NodeMap) {
- return DSNodeHandle((*NodeMap)[fromNode->getNode()], fromNode->getOffset());
-}
-
// Helper function used to clone a function list.
//
static void CopyFunctionCallsList(const vector<DSCallSite>& fromCalls,
@@ -415,8 +398,7 @@
unsigned FC = toCalls.size(); // FirstCall
toCalls.reserve(FC+fromCalls.size());
for (unsigned i = 0, ei = fromCalls.size(); i != ei; ++i)
- toCalls.push_back(DSCallSite(fromCalls[i],
- std::bind2nd(std::ptr_fun(©Helper), &NodeMap)));
+ toCalls.push_back(DSCallSite(fromCalls[i], NodeMap));
}
/// remapLinks - Change all of the Links in the current node according to the
Index: llvm/lib/Analysis/DataStructure/TopDownClosure.cpp
diff -u llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.13 llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.14
--- llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.13 Mon Oct 21 08:31:48 2002
+++ llvm/lib/Analysis/DataStructure/TopDownClosure.cpp Mon Oct 21 10:04:18 2002
@@ -57,8 +57,8 @@
// TD ...Merge the formal arg scalar with the actual arg node
DSNodeHandle &NodeForFormal = Graph.getNodeForValue(AI);
- if (NodeForFormal.getNode())
- NodeForFormal.mergeWith(CallSite.getPtrArg(i));
+ assert(NodeForFormal.getNode() && "Pointer argument has no dest node!");
+ NodeForFormal.mergeWith(CallSite.getPtrArg(i));
}
// Merge returned node in the caller with the "return" node in callee
@@ -67,12 +67,6 @@
}
-static DSNodeHandle copyHelper(const DSNodeHandle* fromNode,
- std::map<const DSNode*, DSNode*> *NodeMap) {
- return DSNodeHandle((*NodeMap)[fromNode->getNode()], fromNode->getOffset());
-}
-
-
DSGraph &TDDataStructures::calculateGraph(Function &F) {
// Make sure this graph has not already been calculated, or that we don't get
// into an infinite loop with mutually recursive functions.
@@ -103,12 +97,9 @@
DEBUG(std::cerr << "\t [TD] Inlining caller #" << c << " '"
<< Caller.getName() << "' into callee: " << F.getName() << "\n");
- if (&Caller == &F) {
- // Self-recursive call: this can happen after a cycle of calls is inlined.
- ResolveCallSite(*Graph, CallSite);
- } else {
- // Recursively compute the graph for the Caller. That should
- // be fully resolved except if there is mutual recursion...
+ if (&Caller != &F) {
+ // Recursively compute the graph for the Caller. It should be fully
+ // resolved except if there is mutual recursion...
//
DSGraph &CG = calculateGraph(Caller); // Graph to inline
@@ -133,10 +124,9 @@
// Make a temporary copy of the call site, and transform the argument node
// pointers.
- DSCallSite TmpCallSite(CallSite, std::bind2nd(std::ptr_fun(©Helper),
- &OldNodeMap));
- ResolveCallSite(*Graph, CallSite);
+ //
}
+ ResolveCallSite(*Graph, CallSite);
}
// Recompute the Incomplete markers and eliminate unreachable nodes.
More information about the llvm-commits
mailing list