aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/Analysis/DataStructure/DSGraph.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-01-30 23:51:02 +0000
committerChris Lattner <sabre@nondot.org>2005-01-30 23:51:02 +0000
commita9548d9fd99beea7d5e4dc6619cb5569b54620c0 (patch)
tree9f87a41c58c91a4329843364d64c54d788e5171e /include/llvm/Analysis/DataStructure/DSGraph.h
parent7b2a5270b7613a12fb0b3c12ccdef26367fb8339 (diff)
* Make some methods more const correct.
* Change the FunctionCalls and AuxFunctionCalls vectors into std::lists. This makes many operations on these lists much more natural, and avoids *exteremely* expensive copying of DSCallSites (e.g. moving nodes around between lists, erasing a node from not the end of the vector, etc). With a profile build of analyze, this speeds up BU DS from 25.14s to 12.59s on 176.gcc. I expect that it would help TD even more, but I don't have data for it. This effectively eliminates removeIdenticalCalls and children from the profile, going from 6.53 to 0.27s. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19939 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Analysis/DataStructure/DSGraph.h')
-rw-r--r--include/llvm/Analysis/DataStructure/DSGraph.h31
1 files changed, 21 insertions, 10 deletions
diff --git a/include/llvm/Analysis/DataStructure/DSGraph.h b/include/llvm/Analysis/DataStructure/DSGraph.h
index bc5f8242c1..49c71f0b3d 100644
--- a/include/llvm/Analysis/DataStructure/DSGraph.h
+++ b/include/llvm/Analysis/DataStructure/DSGraph.h
@@ -17,6 +17,7 @@
#include "llvm/Analysis/DataStructure/DSNode.h"
#include "llvm/ADT/hash_map"
+#include <list>
namespace llvm {
@@ -136,19 +137,19 @@ private:
//
ReturnNodesTy ReturnNodes;
- // FunctionCalls - This vector maintains a single entry for each call
+ // FunctionCalls - This list maintains a single entry for each call
// instruction in the current graph. The first entry in the vector is the
// scalar that holds the return value for the call, the second is the function
// scalar being invoked, and the rest are pointer arguments to the function.
// This vector is built by the Local graph and is never modified after that.
//
- std::vector<DSCallSite> FunctionCalls;
+ std::list<DSCallSite> FunctionCalls;
// AuxFunctionCalls - This vector contains call sites that have been processed
// by some mechanism. In pratice, the BU Analysis uses this vector to hold
// the _unresolved_ call sites, because it cannot modify FunctionCalls.
//
- std::vector<DSCallSite> AuxFunctionCalls;
+ std::list<DSCallSite> AuxFunctionCalls;
// InlinedGlobals - This set records which globals have been inlined from
// other graphs (callers or callees, depending on the pass) into this one.
@@ -222,20 +223,30 @@ public:
/// getFunctionCalls - Return the list of call sites in the original local
/// graph...
///
- const std::vector<DSCallSite> &getFunctionCalls() const {
- return FunctionCalls;
- }
+ const std::list<DSCallSite> &getFunctionCalls() const { return FunctionCalls;}
+ std::list<DSCallSite> &getFunctionCalls() { return FunctionCalls;}
/// getAuxFunctionCalls - Get the call sites as modified by whatever passes
/// have been run.
///
- std::vector<DSCallSite> &getAuxFunctionCalls() {
- return AuxFunctionCalls;
- }
- const std::vector<DSCallSite> &getAuxFunctionCalls() const {
+ std::list<DSCallSite> &getAuxFunctionCalls() { return AuxFunctionCalls; }
+ const std::list<DSCallSite> &getAuxFunctionCalls() const {
return AuxFunctionCalls;
}
+ // Function Call iteration
+ typedef std::list<DSCallSite>::const_iterator fc_iterator;
+ fc_iterator fc_begin() const { return FunctionCalls.begin(); }
+ fc_iterator fc_end() const { return FunctionCalls.end(); }
+
+
+ // Aux Function Call iteration
+ typedef std::list<DSCallSite>::const_iterator afc_iterator;
+ afc_iterator afc_begin() const { return AuxFunctionCalls.begin(); }
+ afc_iterator afc_end() const { return AuxFunctionCalls.end(); }
+
+
+
/// getInlinedGlobals - Get the set of globals that are have been inlined
/// (from callees in BU or from callers in TD) into the current graph.
///