[llvm-commits] CVS: llvm/lib/CWriter/Writer.cpp

Chris Lattner lattner at cs.uiuc.edu
Thu Aug 28 14:57:01 PDT 2003


Changes in directory llvm/lib/CWriter:

Writer.cpp updated: 1.119 -> 1.120

---
Log message:

Fix really nasty bugs in the CWriter, handling invoke instructions.  Tracking
these down was NOT phun.


---
Diffs of the changes:

Index: llvm/lib/CWriter/Writer.cpp
diff -u llvm/lib/CWriter/Writer.cpp:1.119 llvm/lib/CWriter/Writer.cpp:1.120
--- llvm/lib/CWriter/Writer.cpp:1.119	Sun Aug 24 16:00:22 2003
+++ llvm/lib/CWriter/Writer.cpp	Thu Aug 28 14:56:10 2003
@@ -894,7 +894,8 @@
          UI != UE; ++UI)
       if (TerminatorInst *TI = dyn_cast<TerminatorInst>(*UI))
         if (TI != Prev->getTerminator() ||
-            isa<SwitchInst>(Prev->getTerminator())) {
+            isa<SwitchInst>(Prev->getTerminator()) ||
+            isa<InvokeInst>(Prev->getTerminator())) {
           NeedsLabel = true;
           break;        
         }
@@ -968,6 +969,8 @@
   Out << "    }\n"
       << "    __llvm_jmpbuf_list = &Entry;\n"
       << "    ";
+
+  if (II.getType() != Type::VoidTy) outputLValue(&II);
   visitCallSite(&II);
   Out << ";\n"
       << "    __llvm_jmpbuf_list = Entry.next;\n"
@@ -998,7 +1001,7 @@
     Out << ";   /* for PHI node */\n";
   }
 
-  if (CurBB->getNext() != Succ) {
+  if (CurBB->getNext() != Succ || isa<InvokeInst>(CurBB->getTerminator())) {
     Out << std::string(Indent, ' ') << "  goto ";
     writeOperand(Succ);
     Out << ";\n";





More information about the llvm-commits mailing list