Changes in directory llvm-poolalloc/include/dsa:
DSGraph.h updated: 1.112 -> 1.113 DSGraphTraits.h updated: 1.25 -> 1.26 DSNode.h updated: 1.60 -> 1.61 DataStructure.h updated: 1.98 -> 1.99 --- Log message: Merged from release_19 branch. This adds correct compilation of DSA, pool inference, and configure script fixes to mainline. --- Diffs of the changes: (+113 -11) DSGraph.h | 103 ++++++++++++++++++++++++++++++++++++++++++++++++++++---- DSGraphTraits.h | 2 - DSNode.h | 11 ++++- DataStructure.h | 8 +++- 4 files changed, 113 insertions(+), 11 deletions(-) Index: llvm-poolalloc/include/dsa/DSGraph.h diff -u llvm-poolalloc/include/dsa/DSGraph.h:1.112 llvm-poolalloc/include/dsa/DSGraph.h:1.113 --- llvm-poolalloc/include/dsa/DSGraph.h:1.112 Wed Dec 6 19:30:30 2006 +++ llvm-poolalloc/include/dsa/DSGraph.h Wed Dec 13 23:51:06 2006 @@ -15,13 +15,18 @@ #ifndef LLVM_ANALYSIS_DSGRAPH_H #define LLVM_ANALYSIS_DSGRAPH_H -#include "llvm/Analysis/DataStructure/DSNode.h" +#include "dsa/DSNode.h" #include "llvm/ADT/hash_map" #include "llvm/ADT/EquivalenceClasses.h" -#include <list> +#include "poolalloc/Config/config.h" +#include <list> +#include <map> +#include <iostream> namespace llvm { + //typedef map<const DSNode *, Value*> PoolDescriptorMapType; + class GlobalValue; //===----------------------------------------------------------------------===// @@ -170,6 +175,62 @@ }; +#ifdef LLVA_KERNEL +class MetaPool; +class MetaPoolHandle { + MetaPool *Rep; + Instruction * Creator; +public: + MetaPoolHandle(MetaPool *mp, Instruction * Maker = 0); + + MetaPool *getMetaPool() { + return Rep; + } + void setMetaPool(MetaPool *v) { + Rep = v; + } + ~MetaPoolHandle() { + //do nothing for now + } + const std::string &getName(); + Value *getMetaPoolValue(); + void merge(MetaPoolHandle *other); +}; + + class MetaPool { + Value *MPD; + hash_set<MetaPoolHandle *> HandleSet; + + public: + MetaPool(Value *mpd) : MPD(mpd) { + } + void addMetaPoolHandles(hash_set<MetaPoolHandle *> & mpHS) { + HandleSet.insert(mpHS.begin(), mpHS.end()); + } + hash_set<MetaPoolHandle *>& getHandleSet() { + return HandleSet; + } + Value * getMetaPoolValue() { + return MPD; + } + void setMetaPoolValue(Value *V) { + MPD = V; + } + void insert(MetaPoolHandle *mph) { + HandleSet.insert(mph); + } + const std::string& getName() { + return MPD->getName(); + } + ~MetaPool() { + HandleSet.clear(); + } + }; + +#endif + + + //===----------------------------------------------------------------------===// /// DSGraph - The graph that represents a function. /// @@ -219,13 +280,18 @@ /// constructed for. const TargetData &TD; +#ifdef LLVA_KERNEL + hash_map<const DSNode*, MetaPoolHandle*> PoolDescriptors; +#endif + + + void operator=(const DSGraph &); // DO NOT IMPLEMENT DSGraph(const DSGraph&); // DO NOT IMPLEMENT public: // Create a new, empty, DSGraph. DSGraph(EquivalenceClasses<GlobalValue*> &ECs, const TargetData &td) - : GlobalsGraph(0), PrintAuxCalls(false), ScalarMap(ECs), TD(td) {} - + : GlobalsGraph(0), PrintAuxCalls(false), ScalarMap(ECs), TD(td) { } // Compute the local DSGraph DSGraph(EquivalenceClasses<GlobalValue*> &ECs, const TargetData &TD, Function &F, DSGraph *GlobalsGraph); @@ -238,13 +304,38 @@ // source. You need to set a new GlobalsGraph with the setGlobalsGraph // method. // - DSGraph(const DSGraph &DSG, EquivalenceClasses<GlobalValue*> &ECs, + DSGraph( DSGraph &DSG, EquivalenceClasses<GlobalValue*> &ECs, unsigned CloneFlags = 0); ~DSGraph(); DSGraph *getGlobalsGraph() const { return GlobalsGraph; } void setGlobalsGraph(DSGraph *G) { GlobalsGraph = G; } +#ifdef LLVA_KERNEL +#if 1 + hash_map<const DSNode *, MetaPoolHandle*>& getPoolDescriptorsMap() { + return PoolDescriptors; + } + MetaPoolHandle *getPoolForNode(const DSNode *N) { + if (PoolDescriptors.count(N) > 0) { + return PoolDescriptors[N]; + } + return 0; + } +#else + hash_map<const DSNodeHandle *, MetaPoolHandle*>& getPoolDescriptorsMap() { + return PoolDescriptors; + } + MetaPoolHandle *getPoolForNode(const DSNodeHandle *N) { + if (PoolDescriptors.count(N) > 0) { + return PoolDescriptors[N]; + } + return 0; + } +#endif + +#endif + /// getGlobalECs - Return the set of equivalence classes that the global /// variables in the program form. EquivalenceClasses<GlobalValue*> &getGlobalECs() const { @@ -472,7 +563,7 @@ /// /// The CloneFlags member controls various aspects of the cloning process. /// - void cloneInto(const DSGraph &G, unsigned CloneFlags = 0); + void cloneInto(DSGraph &G, unsigned CloneFlags = 0); /// getFunctionArgumentsForCall - Given a function that is currently in this /// graph, return the DSNodeHandles that correspond to the pointer-compatible Index: llvm-poolalloc/include/dsa/DSGraphTraits.h diff -u llvm-poolalloc/include/dsa/DSGraphTraits.h:1.25 llvm-poolalloc/include/dsa/DSGraphTraits.h:1.26 --- llvm-poolalloc/include/dsa/DSGraphTraits.h:1.25 Thu Nov 2 19:43:47 2006 +++ llvm-poolalloc/include/dsa/DSGraphTraits.h Wed Dec 13 23:51:06 2006 @@ -16,7 +16,7 @@ #ifndef LLVM_ANALYSIS_DSGRAPHTRAITS_H #define LLVM_ANALYSIS_DSGRAPHTRAITS_H -#include "llvm/Analysis/DataStructure/DSGraph.h" +#include "dsa/DSGraph.h" #include "llvm/ADT/GraphTraits.h" #include "llvm/ADT/iterator" #include "llvm/ADT/STLExtras.h" Index: llvm-poolalloc/include/dsa/DSNode.h diff -u llvm-poolalloc/include/dsa/DSNode.h:1.60 llvm-poolalloc/include/dsa/DSNode.h:1.61 --- llvm-poolalloc/include/dsa/DSNode.h:1.60 Wed Dec 6 19:30:30 2006 +++ llvm-poolalloc/include/dsa/DSNode.h Wed Dec 13 23:51:06 2006 @@ -14,7 +14,7 @@ #ifndef LLVM_ANALYSIS_DSNODE_H #define LLVM_ANALYSIS_DSNODE_H -#include "llvm/Analysis/DataStructure/DSSupport.h" +#include "dsa/DSSupport.h" #include "llvm/ADT/hash_map" namespace llvm { @@ -91,8 +91,9 @@ Read = 1 << 6, // This node is read in this context Array = 1 << 7, // This node is treated like an array + External = 1 << 8, // This node comes from an external source //#ifndef NDEBUG - DEAD = 1 << 8, // This node is dead and should not be pointed to + DEAD = 1 << 9, // This node is dead and should not be pointed to //#endif Composition = AllocaNode | HeapNode | GlobalNode | UnknownNode @@ -118,10 +119,14 @@ /// DSNode(const DSNode &, DSGraph *G, bool NullLinks = false); +#if 0 ~DSNode() { dropAllReferences(); assert(hasNoReferrers() && "Referrers to dead node exist!"); } +#else + ~DSNode(); +#endif // Iterator for graph interface... Defined in DSGraphTraits.h typedef DSNodeIterator<DSNode> iterator; @@ -340,12 +345,14 @@ bool isIncomplete() const { return NodeType & Incomplete; } bool isComplete() const { return !isIncomplete(); } bool isDeadNode() const { return NodeType & DEAD; } + bool isExternalNode() const { return NodeType & External; } DSNode *setAllocaNodeMarker() { NodeType |= AllocaNode; return this; } DSNode *setHeapNodeMarker() { NodeType |= HeapNode; return this; } DSNode *setGlobalNodeMarker() { NodeType |= GlobalNode; return this; } DSNode *setUnknownNodeMarker() { NodeType |= UnknownNode; return this; } + DSNode *setExternalMarker() { NodeType |= External; return this; } DSNode *setIncompleteMarker() { NodeType |= Incomplete; return this; } DSNode *setModifiedMarker() { NodeType |= Modified; return this; } DSNode *setReadMarker() { NodeType |= Read; return this; } Index: llvm-poolalloc/include/dsa/DataStructure.h diff -u llvm-poolalloc/include/dsa/DataStructure.h:1.98 llvm-poolalloc/include/dsa/DataStructure.h:1.99 --- llvm-poolalloc/include/dsa/DataStructure.h:1.98 Mon Oct 23 14:52:54 2006 +++ llvm-poolalloc/include/dsa/DataStructure.h Wed Dec 13 23:51:06 2006 @@ -20,6 +20,7 @@ #include "llvm/ADT/hash_map" #include "llvm/ADT/hash_set" #include "llvm/ADT/EquivalenceClasses.h" +#include "poolalloc/Config/config.h" namespace llvm { @@ -30,11 +31,11 @@ class DSCallSite; class DSNode; class DSNodeHandle; +typedef std::map<const DSNode *, Value*> PoolDescriptorMapType; FunctionPass *createDataStructureStatsPass(); FunctionPass *createDataStructureGraphCheckerPass(); - // FIXME: move this stuff to a private header namespace DataStructureAnalysis { /// isPointerType - Return true if this first class type is big enough to hold @@ -43,7 +44,6 @@ bool isPointerType(const Type *Ty); } - // LocalDataStructures - The analysis that computes the local data structure // graphs for all of the functions in the program. // @@ -55,6 +55,10 @@ hash_map<Function*, DSGraph*> DSInfo; DSGraph *GlobalsGraph; +#ifdef LLVA_KERNEL + Function *AddPoolDescToMetaPool; +#endif + /// GlobalECs - The equivalence classes for each global value that is merged /// with other global values in the DSGraphs. EquivalenceClasses<GlobalValue*> GlobalECs; _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits