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

Chris Lattner lattner at cs.uiuc.edu
Sat Nov 5 23:46:25 PST 2005



Changes in directory llvm/lib/Bytecode/Writer:

Writer.cpp updated: 1.111 -> 1.112
---
Log message:

don't misencode CC#'s


---
Diffs of the changes:  (+4 -3)

 Writer.cpp |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)


Index: llvm/lib/Bytecode/Writer/Writer.cpp
diff -u llvm/lib/Bytecode/Writer/Writer.cpp:1.111 llvm/lib/Bytecode/Writer/Writer.cpp:1.112
--- llvm/lib/Bytecode/Writer/Writer.cpp:1.111	Sun Nov  6 01:43:39 2005
+++ llvm/lib/Bytecode/Writer/Writer.cpp	Sun Nov  6 01:46:13 2005
@@ -968,12 +968,13 @@
     assert(Slot != -1 && "Module slot calculator is broken!");
     assert(Slot >= Type::FirstDerivedTyID && "Derived type not in range!");
     assert(((Slot << 6) >> 6) == Slot && "Slot # too big!");
-    unsigned ID = (Slot << 5) | (I->getCallingConv() & 15);
+    unsigned CC = I->getCallingConv()+1;
+    unsigned ID = (Slot << 5) | (CC & 15);
 
     if (I->isExternal())   // If external, we don't have an FunctionInfo block.
       ID |= 1 << 4;
     
-    if (I->getAlignment() || I->getCallingConv() & ~15)
+    if (I->getAlignment() || (CC & ~15) != 0)
       ID |= 1 << 31;       // Do we need an extension word?
     
     output_vbr(ID);
@@ -981,7 +982,7 @@
     if (ID & (1 << 31)) {
       // Extension byte: bits 0-4 = alignment, bits 5-9 = top nibble of calling
       // convention.
-      ID = (Log2_32(I->getAlignment())+1) | ((I->getCallingConv() >> 4) << 5);
+      ID = (Log2_32(I->getAlignment())+1) | ((CC >> 4) << 5);
       output_vbr(ID);
     }
   }






More information about the llvm-commits mailing list