[PATCH] D23384: Use a byte array as an internal buffer of BitVector.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 10 16:42:48 PDT 2016


ruiu created this revision.
ruiu added a reviewer: zturner.
ruiu added a subscriber: llvm-commits.

Previously, BitVector was using an array of `unsigned long` as an
internal buffer. That design choice was not desirable if we want to
allow exporting bitmaps or importing existing bitmaps, because the
internal buffer's contents are different on machines with different
endianness.

In PDB file processing, we create bitmaps and then write it to a file.
We also read a bitmap from disk and convert it to BitVector.
All these operations involve for-loop for each bit and data copying
because we cannot map existing bitmaps to BitVector.

This patch solves the problem. Now the internal buffer is represented
as a byte array. So, two BitVectors having the identical bits are now
represented in the same way both on the LE and BE machines. The
endianness problem is gone.

In this patch, we are still doing word-size operations instead of
byte-size operations where possible. Changing the internal format
shouldn't degrade the performance.

https://reviews.llvm.org/D23384

Files:
  include/llvm/ADT/BitVector.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23384.67631.patch
Type: text/x-patch
Size: 14340 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160810/dd956503/attachment.bin>


More information about the llvm-commits mailing list