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

Lauro Ramos Venancio lauro.venancio at gmail.com
Thu Apr 12 11:33:33 PDT 2007



Changes in directory llvm/lib/Bytecode/Writer:

Writer.cpp updated: 1.171 -> 1.172
---
Log message:

Implement the "thread_local" keyword.


---
Diffs of the changes:  (+6 -5)

 Writer.cpp |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)


Index: llvm/lib/Bytecode/Writer/Writer.cpp
diff -u llvm/lib/Bytecode/Writer/Writer.cpp:1.171 llvm/lib/Bytecode/Writer/Writer.cpp:1.172
--- llvm/lib/Bytecode/Writer/Writer.cpp:1.171	Mon Apr  9 01:14:31 2007
+++ llvm/lib/Bytecode/Writer/Writer.cpp	Thu Apr 12 13:32:50 2007
@@ -950,7 +950,7 @@
            "Global must have an initializer or have external linkage!");
     
     // Fields: bit0 = isConstant, bit1 = hasInitializer, bit2-4=Linkage,
-    // bit5+ = Slot # for type.
+    // bit5 = isThreadLocal, bit6+ = Slot # for type.
     bool HasExtensionWord = (I->getAlignment() != 0) ||
                             I->hasSection() ||
       (I->getVisibility() != GlobalValue::DefaultVisibility);
@@ -958,12 +958,13 @@
     // If we need to use the extension byte, set linkage=3(internal) and
     // initializer = 0 (impossible!).
     if (!HasExtensionWord) {
-      unsigned oSlot = (Slot << 5) | (getEncodedLinkage(I) << 2) |
-                        (I->hasInitializer() << 1) | (unsigned)I->isConstant();
+      unsigned oSlot = (Slot << 6)| (((unsigned)I->isThreadLocal()) << 5) |
+                       (getEncodedLinkage(I) << 2) | (I->hasInitializer() << 1)
+                       | (unsigned)I->isConstant();
       output_vbr(oSlot);
     } else {  
-      unsigned oSlot = (Slot << 5) | (3 << 2) |
-                        (0 << 1) | (unsigned)I->isConstant();
+      unsigned oSlot = (Slot << 6) | (((unsigned)I->isThreadLocal()) << 5) |
+                       (3 << 2) | (0 << 1) | (unsigned)I->isConstant();
       output_vbr(oSlot);
       
       // The extension word has this format: bit 0 = has initializer, bit 1-3 =






More information about the llvm-commits mailing list