[LLVMdev] opt does not load poolalloc

Martin Süßkraut edon.myder at web.de
Wed Dec 12 06:47:11 PST 2007


Hi,

I compiled the poolalloc from SVN head.

opt complains about missing symbol PoolAlloc::ID when I try to load
libpoolalloc.so. Defining PoolAlloc::ID is not enough, since it is
reused in PoolAllocPassAllPools.

The append patch fixes the problem for me.

Kind regards,
            Martin

Index: include/poolalloc/PoolAllocate.h
===================================================================
--- include/poolalloc/PoolAllocate.h    (revision 44934)
+++ include/poolalloc/PoolAllocate.h    (working copy)
@@ -144,7 +144,9 @@
   /// map contains the global variable that holds the pool descriptor for the
   /// node.
   std::map<const DSNode*, Value*> GlobalNodes;
-
+ protected:
+  PoolAllocate(intptr_t id, bool passAllArguments)
+      : ModulePass (id), PassAllArguments (passAllArguments) {}
  public:
   static char ID;
 #ifdef SAFECODE
@@ -276,14 +278,14 @@
   void CalculateLivePoolFreeBlocks(std::set<BasicBlock*>
&LiveBlocks,Value *PD);
 };

-
 /// PoolAllocatePassAllPools - This class is the same as the pool allocator,
 /// except that it passes pool descriptors into functions that do not do
 /// allocations or deallocations.  This is needed by the pointer compression
 /// pass, which requires a pool descriptor to be available for a pool if any
 /// load or store to that pool is performed.
 struct PoolAllocatePassAllPools : public PoolAllocate {
-  PoolAllocatePassAllPools() : PoolAllocate(true) {}
+  static char ID;
+  PoolAllocatePassAllPools() : PoolAllocate((intptr_t)&ID, true) {}
 };

 }
Index: lib/PoolAllocate/PoolAllocate.cpp
===================================================================
--- lib/PoolAllocate/PoolAllocate.cpp   (revision 44934)
+++ lib/PoolAllocate/PoolAllocate.cpp   (working copy)
@@ -45,6 +45,9 @@

 const Type *PoolAllocate::PoolDescPtrTy = 0;

+char PoolAllocate::ID = 0;
+char PoolAllocatePassAllPools::ID = 0;
+
 #if 0
 #define TIME_REGION(VARNAME, DESC) \
    NamedRegionTimer VARNAME(DESC)
@@ -647,9 +650,9 @@
     DSNode *N = I;
     if (
 #ifdef BOUNDS_CHECK
-  (N->isArray() ||
-#endif
-   (N->isHeapNode()))
+  N->isArray() ||
+#endif
+   N->isHeapNode())
       if (GlobalsGraphNodeMapping.count(N)) {
         // If it is a global pool, set up the pool descriptor appropriately.
         DSNode *GGN = GlobalsGraphNodeMapping[N].getNode();



More information about the llvm-dev mailing list