[LLVMdev] A question about LLVM and pool allocation

Andrew Lenharth andrewl at lenharth.org
Tue Jul 10 07:09:18 PDT 2007


On 7/10/07, Seongwon Lee <swlee at altair.snu.ac.kr> wrote:
> HI guys.
> I'm trying to build the poolalloc on llvm-2.0 but there exist some errors.
>
> Can you tell me which version of llvm is known to make the poolalloc build
> and install successful?

Try the patch below.  I'll try to apply it and fix any other current
build problems later this week.


Andrew


Index: include/dsa/CallTargets.h
===================================================================
RCS file: /var/cvs/llvm/llvm-poolalloc/include/dsa/CallTargets.h,v
retrieving revision 1.1
diff -t -d -u -p -5 -r1.1 CallTargets.h
--- include/dsa/CallTargets.h   16 Jun 2006 14:33:00 -0000      1.1
+++ include/dsa/CallTargets.h   16 May 2007 08:26:25 -0000
@@ -28,10 +28,12 @@ namespace llvm {
    std::set<CallSite> CompleteSites;
    std::list<CallSite> AllSites;

    void findIndTargets(Module &M);
  public:
+    static char ID;
+    CallTargetFinder() : ModulePass((intptr_t)&ID) {}
    virtual bool runOnModule(Module &M);

    virtual void getAnalysisUsage(AnalysisUsage &AU) const;

    virtual void print(std::ostream &O, const Module *M) const;
Index: include/dsa/DataStructure.h
===================================================================
RCS file: /var/cvs/llvm/llvm-poolalloc/include/dsa/DataStructure.h,v
retrieving revision 1.101
diff -t -d -u -p -5 -r1.101 DataStructure.h
--- include/dsa/DataStructure.h 19 Apr 2007 16:02:19 -0000      1.101
+++ include/dsa/DataStructure.h 16 May 2007 08:26:25 -0000
@@ -73,14 +73,14 @@ protected:
  void setTargetData(TargetData& T) {
    TD = &T;
  }

  void formGlobalECs();
-
-  DataStructures() :TD(0), GraphSource(0), GlobalsGraph(0) {}
+  DataStructures() :ModulePass((intptr_t)&ID), TD(0), GraphSource(0),
GlobalsGraph(0) {}

 public:
+  static char ID;

  bool hasGraph(const Function &F) const {
    return DSInfo.find(const_cast<Function*>(&F)) != DSInfo.end();
  }

@@ -355,10 +355,12 @@ struct EquivClassGraphs : public ModuleP
  /// GlobalECs - The equivalence classes for each global value that is merged
  /// with other global values in the DSGraphs.
  EquivalenceClasses<GlobalValue*> GlobalECs;

 public:
+  static char ID;
+  EquivClassGraphs() : ModulePass((intptr_t)&ID) {}
  /// EquivClassGraphs - Computes the equivalence classes and then the
  /// folded DS graphs for each class.
  ///
  virtual bool runOnModule(Module &M);

Index: lib/DSA/DataStructureAA.cpp
===================================================================
RCS file: /var/cvs/llvm/llvm-poolalloc/lib/DSA/DataStructureAA.cpp,v
retrieving revision 1.43
diff -t -d -u -p -5 -r1.43 DataStructureAA.cpp
--- lib/DSA/DataStructureAA.cpp 17 Apr 2007 23:41:06 -0000      1.43
+++ lib/DSA/DataStructureAA.cpp 16 May 2007 08:26:25 -0000
@@ -34,11 +34,12 @@ namespace {
    // free this information, and when we move onto a new call site, this
    // information is also freed.
    CallSite MapCS;
    std::multimap<DSNode*, const DSNode*> CallerCalleeMap;
  public:
-    DSAA() : TD(0) {}
+    static char ID;
+    DSAA() : ModulePass((intptr_t)&ID), TD(0) {}
    ~DSAA() {
      InvalidateCache();
    }

    void InvalidateCache() {
Index: lib/DSA/DataStructureOpt.cpp
===================================================================
RCS file: /var/cvs/llvm/llvm-poolalloc/lib/DSA/DataStructureOpt.cpp,v
retrieving revision 1.19
diff -t -d -u -p -5 -r1.19 DataStructureOpt.cpp
--- lib/DSA/DataStructureOpt.cpp        17 Apr 2007 23:41:06 -0000      1.19
+++ lib/DSA/DataStructureOpt.cpp        16 May 2007 08:26:25 -0000
@@ -27,10 +27,12 @@ namespace {
  STATISTIC (NumGlobalsIsolated, "Number of globals with references dropped");

  class DSOpt : public ModulePass {
    TDDataStructures *TD;
  public:
+    static char ID;
+    DSOpt() : ModulePass((intptr_t)&ID) {}
    bool runOnModule(Module &M) {
      TD = &getAnalysis<TDDataStructures>();
      bool Changed = OptimizeGlobals(M);
      return Changed;
    }
Index: lib/DSA/DataStructureStats.cpp
===================================================================
RCS file: /var/cvs/llvm/llvm-poolalloc/lib/DSA/DataStructureStats.cpp,v
retrieving revision 1.28
diff -t -d -u -p -5 -r1.28 DataStructureStats.cpp
--- lib/DSA/DataStructureStats.cpp      17 Apr 2007 23:41:06 -0000      1.28
+++ lib/DSA/DataStructureStats.cpp      16 May 2007 08:26:25 -0000
@@ -41,10 +41,12 @@ namespace {
    const DSGraph *TDGraph;

    DSNode *getNodeForValue(Value *V);
    bool isNodeForValueCollapsed(Value *V);
  public:
+    static char ID;
+    DSGraphStats() : FunctionPass((intptr_t)&ID) {}
    /// Driver functions to compute the Load/Store Dep. Graph per function.
    bool runOnFunction(Function& F);

    /// getAnalysisUsage - This modify nothing, and uses the Top-Down Graph.
    void getAnalysisUsage(AnalysisUsage &AU) const {
Index: lib/DSA/GraphChecker.cpp
===================================================================
RCS file: /var/cvs/llvm/llvm-poolalloc/lib/DSA/GraphChecker.cpp,v
retrieving revision 1.25
diff -t -d -u -p -5 -r1.25 GraphChecker.cpp
--- lib/DSA/GraphChecker.cpp    17 Apr 2007 23:41:06 -0000      1.25
+++ lib/DSA/GraphChecker.cpp    16 May 2007 08:26:25 -0000
@@ -53,10 +53,11 @@ namespace {
  cl::list<std::string>
  AbortIfMerged("dsgc-abort-if-merged", cl::Hidden, cl::CommaSeparated,
             cl::desc("Abort if any of the named symbols are merged together"));

  struct DSGC : public FunctionPass {
+    static char ID;
    DSGC();
    bool doFinalization(Module &M);
    bool runOnFunction(Function &F);

    virtual void getAnalysisUsage(AnalysisUsage &AU) const {
@@ -79,11 +80,11 @@ namespace {
 FunctionPass *llvm::createDataStructureGraphCheckerPass() {
  return new DSGC();
 }


-DSGC::DSGC() {
+DSGC::DSGC() : FunctionPass((intptr_t)&ID) {
  if (!AbortIfAnyCollapsed && AbortIfCollapsed.empty() &&
      CheckFlags.empty() && AbortIfMerged.empty()) {
    cerr << "The -datastructure-gc is useless if you don't specify any"
         << " -dsgc-* options.  See the -help-hidden output for a list.\n";
    abort();
Index: lib/DSA/Steensgaard.cpp
===================================================================
RCS file: /var/cvs/llvm/llvm-poolalloc/lib/DSA/Steensgaard.cpp,v
retrieving revision 1.71
diff -t -d -u -p -5 -r1.71 Steensgaard.cpp
--- lib/DSA/Steensgaard.cpp     17 Apr 2007 23:41:06 -0000      1.71
+++ lib/DSA/Steensgaard.cpp     16 May 2007 08:26:25 -0000
@@ -27,11 +27,12 @@ namespace {
  class Steens : public ModulePass, public AliasAnalysis {
    DSGraph *ResultGraph;

    EquivalenceClasses<GlobalValue*> GlobalECs;  // Always empty
  public:
-    Steens() : ResultGraph(0) {}
+    static char ID;
+    Steens() : ModulePass((intptr_t)&ID), ResultGraph(0) {}
    ~Steens() {
      releaseMyMemory();
      assert(ResultGraph == 0 && "releaseMemory not called?");
    }



More information about the llvm-dev mailing list