[llvm-commits] CVS: llvm/lib/VMCore/SlotCalculator.cpp
Alkis Evlogimenos
alkis at cs.uiuc.edu
Thu Oct 30 15:05:01 PST 2003
Changes in directory llvm/lib/VMCore:
SlotCalculator.cpp updated: 1.35 -> 1.36
---
Log message:
Output types in reverse postorder. This will allow the ByteCode/Reader
to create the minimum number of opaque types for each type with a
cycle in its type graph.
---
Diffs of the changes: (+17 -9)
Index: llvm/lib/VMCore/SlotCalculator.cpp
diff -u llvm/lib/VMCore/SlotCalculator.cpp:1.35 llvm/lib/VMCore/SlotCalculator.cpp:1.36
--- llvm/lib/VMCore/SlotCalculator.cpp:1.35 Tue Oct 28 21:12:12 2003
+++ llvm/lib/VMCore/SlotCalculator.cpp Thu Oct 30 15:04:44 2003
@@ -287,20 +287,28 @@
SC_DEBUG(" Inserted type: " << TheTy->getDescription() << " slot=" <<
ResultSlot << "\n");
- // Loop over any contained types in the definition... in depth first order.
+ // Loop over any contained types in the definition... in reverse depth
+ // first order.
//
+ std::vector<const Type*> DfsOrder;
for (df_iterator<const Type*> I = df_begin(TheTy), E = df_end(TheTy);
- I != E; ++I)
+ I != E; ++I) {
if (*I != TheTy) {
// If we haven't seen this sub type before, add it to our type table!
- const Type *SubTy = *I;
- if (getSlot(SubTy) == -1) {
- SC_DEBUG(" Inserting subtype: " << SubTy->getDescription() << "\n");
- int Slot = doInsertValue(SubTy);
- SC_DEBUG(" Inserted subtype: " << SubTy->getDescription() <<
- " slot=" << Slot << "\n");
- }
+ DfsOrder.push_back(*I);
}
+ }
+
+ for (std::vector<const Type*>::const_reverse_iterator
+ I = DfsOrder.rbegin(), E = DfsOrder.rend(); I != E; ++I) {
+ const Type *SubTy = *I;
+ if (getSlot(SubTy) == -1) {
+ SC_DEBUG(" Inserting subtype: " << SubTy->getDescription() << "\n");
+ int Slot = doInsertValue(SubTy);
+ SC_DEBUG(" Inserted subtype: " << SubTy->getDescription() <<
+ " slot=" << Slot << "\n");
+ }
+ }
return ResultSlot;
}
More information about the llvm-commits
mailing list