[llvm-commits] CVS: llvm/lib/Target/CBackend/CBackend.cpp

Chris Lattner sabre at nondot.org
Tue Jan 16 10:03:00 PST 2007



Changes in directory llvm/lib/Target/CBackend:

CBackend.cpp updated: 1.318 -> 1.319
---
Log message:

Fix SMG2000 with the CBE: opaque types need names too.


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

 CBackend.cpp |   18 ++++++++----------
 1 files changed, 8 insertions(+), 10 deletions(-)


Index: llvm/lib/Target/CBackend/CBackend.cpp
diff -u llvm/lib/Target/CBackend/CBackend.cpp:1.318 llvm/lib/Target/CBackend/CBackend.cpp:1.319
--- llvm/lib/Target/CBackend/CBackend.cpp:1.318	Tue Jan 16 01:22:23 2007
+++ llvm/lib/Target/CBackend/CBackend.cpp	Tue Jan 16 12:02:45 2007
@@ -272,7 +272,7 @@
     
     // If this isn't a struct type, remove it from our set of types to name.
     // This simplifies emission later.
-    if (!isa<StructType>(I->second)) {
+    if (!isa<StructType>(I->second) && !isa<OpaqueType>(I->second)) {
       TST.remove(I);
     } else {
       // If this is not used, remove it from the symbol table.
@@ -1691,23 +1691,21 @@
 
   // Print out forward declarations for structure types before anything else!
   Out << "/* Structure forward decls */\n";
-  for (; I != End; ++I)
-    if (const Type *STy = dyn_cast<StructType>(I->second)) {
-      std::string Name = "struct l_" + Mang->makeNameProper(I->first);
-      Out << Name << ";\n";
-      TypeNames.insert(std::make_pair(STy, Name));
-    }
+  for (; I != End; ++I) {
+    std::string Name = "struct l_" + Mang->makeNameProper(I->first);
+    Out << Name << ";\n";
+    TypeNames.insert(std::make_pair(I->second, Name));
+  }
 
   Out << '\n';
 
   // Now we can print out typedefs.  Above, we guaranteed that this can only be
-  // for struct types.
+  // for struct or opaque types.
   Out << "/* Typedefs */\n";
   for (I = TST.begin(); I != End; ++I) {
-    const StructType *Ty = cast<StructType>(I->second);
     std::string Name = "l_" + Mang->makeNameProper(I->first);
     Out << "typedef ";
-    printType(Out, Ty, false, Name);
+    printType(Out, I->second, false, Name);
     Out << ";\n";
   }
 






More information about the llvm-commits mailing list