Simplify saveOrigFunctionCalls

llvm-svn: 2967
This commit is contained in:
Chris Lattner 2002-07-18 16:23:02 +00:00
parent 94c8e5da41
commit 8211ada36a
1 changed files with 5 additions and 10 deletions

View File

@ -197,11 +197,12 @@ class DSGraph {
// call, the second is the function scalar being invoked, and the rest are // call, the second is the function scalar being invoked, and the rest are
// pointer arguments to the function. // pointer arguments to the function.
// //
std::vector<std::vector<DSNodeHandle> > FunctionCalls;
// OrigFunctionCalls - This vector retains a copy of the original function // OrigFunctionCalls - This vector retains a copy of the original function
// calls of the current graph. This is needed to support top-down inlining // calls of the current graph. This is needed to support top-down inlining
// after bottom-up inlining is complete, since the latter deletes call nodes. // after bottom-up inlining is complete, since the latter deletes call nodes.
// //
std::vector<std::vector<DSNodeHandle> > FunctionCalls;
std::vector<std::vector<DSNodeHandle> > OrigFunctionCalls; std::vector<std::vector<DSNodeHandle> > OrigFunctionCalls;
// PendingCallers - This vector records all unresolved callers of the // PendingCallers - This vector records all unresolved callers of the
@ -224,17 +225,11 @@ private:
// clone all the call nodes and save the copies in OrigFunctionCalls // clone all the call nodes and save the copies in OrigFunctionCalls
void saveOrigFunctionCalls() { void saveOrigFunctionCalls() {
assert(OrigFunctionCalls.size() == 0 && "Do this only once!"); assert(OrigFunctionCalls.size() == 0 && "Do this only once!");
OrigFunctionCalls.reserve(FunctionCalls.size()); OrigFunctionCalls = FunctionCalls;
for (unsigned i = 0, ei = FunctionCalls.size(); i != ei; ++i) {
OrigFunctionCalls.push_back(std::vector<DSNodeHandle>());
OrigFunctionCalls[i].reserve(FunctionCalls[i].size());
for (unsigned j = 0, ej = FunctionCalls[i].size(); j != ej; ++j)
OrigFunctionCalls[i].push_back(FunctionCalls[i][j]);
}
} }
// get the saved copies of the original function call nodes // get the saved copies of the original function call nodes
std::vector<std::vector<DSNodeHandle> >& getOrigFunctionCalls() { std::vector<std::vector<DSNodeHandle> > &getOrigFunctionCalls() {
return OrigFunctionCalls; return OrigFunctionCalls;
} }
@ -411,7 +406,7 @@ public:
~TDDataStructures() { releaseMemory(); } ~TDDataStructures() { releaseMemory(); }
virtual const char *getPassName() const { virtual const char *getPassName() const {
return "Top-downData Structure Analysis Closure"; return "Top-down Data Structure Analysis Closure";
} }
virtual bool run(Module &M); virtual bool run(Module &M);