[llvm-commits] CVS: llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp

Chris Lattner lattner at cs.uiuc.edu
Sun Feb 13 07:57:36 PST 2005



Changes in directory llvm-poolalloc/lib/PoolAllocate:

PointerCompress.cpp updated: 1.7 -> 1.8
---
Log message:

Add initial support for rewriting structure types.


---
Diffs of the changes:  (+10 -1)

 PointerCompress.cpp |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletion(-)


Index: llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp
diff -u llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.7 llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.8
--- llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.7	Thu Feb 10 17:32:49 2005
+++ llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp	Sun Feb 13 09:57:23 2005
@@ -132,7 +132,16 @@
     return OrigTy;
 
   // Okay, we have an aggregate type.
-  assert(0 && "FIXME: Unhandled aggregate type!");
+  if (const StructType *STy = dyn_cast<StructType>(OrigTy)) {
+    std::vector<const Type*> Elements;
+    Elements.reserve(STy->getNumElements());
+    for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i)
+      Elements.push_back(ComputeCompressedType(STy->getElementType(i),
+                                               NodeOffset, Nodes));
+    return StructType::get(Elements);
+  } else {
+    assert(0 && "FIXME: Unhandled aggregate type!");
+  }
 }
 
 /// dump - Emit a debugging dump for this pool info.






More information about the llvm-commits mailing list