aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/Analysis/DataStructure
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/Analysis/DataStructure')
-rw-r--r--include/llvm/Analysis/DataStructure/DSGraph.h21
-rw-r--r--include/llvm/Analysis/DataStructure/DSNode.h6
-rw-r--r--include/llvm/Analysis/DataStructure/DSSupport.h2
-rw-r--r--include/llvm/Analysis/DataStructure/DataStructure.h2
4 files changed, 25 insertions, 6 deletions
diff --git a/include/llvm/Analysis/DataStructure/DSGraph.h b/include/llvm/Analysis/DataStructure/DSGraph.h
index fae11f4abe..4226cf1e46 100644
--- a/include/llvm/Analysis/DataStructure/DSGraph.h
+++ b/include/llvm/Analysis/DataStructure/DSGraph.h
@@ -62,12 +62,19 @@ private:
//
GlobalSetTy InlinedGlobals;
+ /// TD - This is the target data object for the machine this graph is
+ /// constructed for.
+ const TargetData &TD;
+
void operator=(const DSGraph &); // DO NOT IMPLEMENT
public:
// Create a new, empty, DSGraph.
- DSGraph() : GlobalsGraph(0), PrintAuxCalls(false) {}
- DSGraph(Function &F, DSGraph *GlobalsGraph); // Compute the local DSGraph
+ DSGraph(const TargetData &td)
+ : GlobalsGraph(0), PrintAuxCalls(false), TD(td) {}
+
+ // Compute the local DSGraph
+ DSGraph(const TargetData &td, Function &F, DSGraph *GlobalsGraph);
// Copy ctor - If you want to capture the node mapping between the source and
// destination graph, you may optionally do this by specifying a map to record
@@ -84,9 +91,13 @@ public:
DSGraph *getGlobalsGraph() const { return GlobalsGraph; }
void setGlobalsGraph(DSGraph *G) { GlobalsGraph = G; }
- // setPrintAuxCalls - If you call this method, the auxillary call vector will
- // be printed instead of the standard call vector to the dot file.
- //
+ /// getTargetData - Return the TargetData object for the current target.
+ ///
+ const TargetData &getTargetData() const { return TD; }
+
+ /// setPrintAuxCalls - If you call this method, the auxillary call vector will
+ /// be printed instead of the standard call vector to the dot file.
+ ///
void setPrintAuxCalls() { PrintAuxCalls = true; }
bool shouldPrintAuxCalls() const { return PrintAuxCalls; }
diff --git a/include/llvm/Analysis/DataStructure/DSNode.h b/include/llvm/Analysis/DataStructure/DSNode.h
index 0bbc0f7198..ba5328b2b8 100644
--- a/include/llvm/Analysis/DataStructure/DSNode.h
+++ b/include/llvm/Analysis/DataStructure/DSNode.h
@@ -18,6 +18,7 @@
template<typename BaseType>
class DSNodeIterator; // Data structure graph traversal iterator
+class TargetData;
//===----------------------------------------------------------------------===//
/// DSNode - Data structure node class
@@ -134,6 +135,11 @@ public:
DSGraph *getParentGraph() const { return ParentGraph; }
void setParentGraph(DSGraph *G) { ParentGraph = G; }
+
+ /// getTargetData - Get the target data object used to construct this node.
+ ///
+ const TargetData &getTargetData() const;
+
/// getForwardNode - This method returns the node that this node is forwarded
/// to, if any.
DSNode *getForwardNode() const { return ForwardNH.getNode(); }
diff --git a/include/llvm/Analysis/DataStructure/DSSupport.h b/include/llvm/Analysis/DataStructure/DSSupport.h
index 3ebe15dbfe..e5662ff0a4 100644
--- a/include/llvm/Analysis/DataStructure/DSSupport.h
+++ b/include/llvm/Analysis/DataStructure/DSSupport.h
@@ -28,7 +28,7 @@ class DSNode; // Each node in the graph
class DSGraph; // A graph for a function
namespace DS { // FIXME: After the paper, this should get cleaned up
- enum { PointerShift = 3, // 64bit ptrs = 3, 32 bit ptrs = 2
+ enum { PointerShift = 2, // 64bit ptrs = 3, 32 bit ptrs = 2
PointerSize = 1 << PointerShift
};
diff --git a/include/llvm/Analysis/DataStructure/DataStructure.h b/include/llvm/Analysis/DataStructure/DataStructure.h
index f32d41f26e..afea126c07 100644
--- a/include/llvm/Analysis/DataStructure/DataStructure.h
+++ b/include/llvm/Analysis/DataStructure/DataStructure.h
@@ -15,6 +15,7 @@
#define LLVM_ANALYSIS_DATA_STRUCTURE_H
#include "llvm/Pass.h"
+#include "llvm/Target/TargetData.h"
#include "Support/hash_set"
class Type;
@@ -69,6 +70,7 @@ public:
// getAnalysisUsage - This obviously provides a data structure graph.
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll();
+ AU.addRequired<TargetData>();
}
};