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

Chris Lattner lattner at cs.uiuc.edu
Fri May 26 11:42:46 PDT 2006



Changes in directory llvm/lib/Bytecode/Writer:

Writer.cpp updated: 1.120 -> 1.121
---
Log message:

Fix a bug in the bc reader/writer: we were not correctly encoding varargs 
nonccc calls (we were dropping the CC and tail flag).  This broke several
FORTRAN programs.

Testcase here: Regression/Assembler/2006-05-26-VarargsCallEncode.ll


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

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


Index: llvm/lib/Bytecode/Writer/Writer.cpp
diff -u llvm/lib/Bytecode/Writer/Writer.cpp:1.120 llvm/lib/Bytecode/Writer/Writer.cpp:1.121
--- llvm/lib/Bytecode/Writer/Writer.cpp:1.120	Fri May 19 16:57:37 2006
+++ llvm/lib/Bytecode/Writer/Writer.cpp	Fri May 26 13:42:34 2006
@@ -527,7 +527,8 @@
     // variable argument.
     NumFixedOperands = 3+NumParams;
   }
-  output_vbr(2 * I->getNumOperands()-NumFixedOperands);
+  output_vbr(2 * I->getNumOperands()-NumFixedOperands +
+             unsigned(Opcode == 56 || Opcode == 58));
 
   // The type for the function has already been emitted in the type field of the
   // instruction.  Just emit the slot # now.
@@ -548,6 +549,14 @@
     assert(Slot >= 0 && "No slot number for value!?!?");
     output_vbr((unsigned)Slot);
   }
+  
+  // If this is the escape sequence for call, emit the tailcall/cc info.
+  if (Opcode == 58) {
+    const CallInst *CI = cast<CallInst>(I);
+    output_vbr((CI->getCallingConv() << 1) | unsigned(CI->isTailCall()));
+  } else if (Opcode == 56) {    // Invoke escape sequence.
+    output_vbr(cast<InvokeInst>(I)->getCallingConv());
+  }
 }
 
 






More information about the llvm-commits mailing list