Introducing nocapture, a parameter attribute for pointers to indicate that the
[oota-llvm.git] / lib / Bitcode / Writer / BitcodeWriter.cpp
index 279e447873cab76fc90b4097f95d852e64366816..0555ed90f64279f9f0d5afc61483d02a68c2d55d 100644 (file)
@@ -122,7 +122,16 @@ static void WriteAttributeTable(const ValueEnumerator &VE,
     for (unsigned i = 0, e = A.getNumSlots(); i != e; ++i) {
       const AttributeWithIndex &PAWI = A.getSlot(i);
       Record.push_back(PAWI.Index);
-      Record.push_back(PAWI.Attrs);
+
+      // FIXME: remove in LLVM 3.0
+      // Store the alignment in the bitcode as a 16-bit raw value instead of a
+      // 5-bit log2 encoded value. Shift the bits above the alignment up by
+      // 11 bits.
+      uint64_t FauxAttr = PAWI.Attrs & 0xffff;
+      FauxAttr |= (1ull<<16)<<((PAWI.Attrs & Attribute::Alignment) >> 16);
+      FauxAttr |= (PAWI.Attrs & (0x3FFull << 21)) << 11;
+
+      Record.push_back(FauxAttr);
     }
     
     Stream.EmitRecord(bitc::PARAMATTR_CODE_ENTRY, Record);