This is an archive of the discontinued LLVM Phabricator instance.

Add support for sub-byte aligned writes to lib/Support/Endian.h
ClosedPublic

Authored by tejohnson on Sep 25 2015, 10:02 PM.

Details

Summary

As per Duncan's review for D12536, I extracted the sub-byte bit aligned
reading and writing code into lib/Support. Added calls from
BackpatchWord.

I made the support general instead of tailoring it to the specific
use case and data type in the BackpatchWord case. However, I am not
sure how to add unit testing for the other data types. I did test it
for signed types with negative values to ensure the shifting/masking
handled the sign bit properly, by temporarily adding some write/read
calls into llvm operating on a temporary array.

Diff Detail

Repository
rL LLVM

Event Timeline

tejohnson updated this revision to Diff 35794.Sep 25 2015, 10:02 PM
tejohnson retitled this revision from to Add support for sub-byte aligned writes to lib/Support/Endian.h.
tejohnson updated this object.
tejohnson added a reviewer: dexonsmith.
tejohnson added a subscriber: llvm-commits.
tejohnson updated this revision to Diff 35991.Sep 29 2015, 9:29 AM
  • Implement review suggestion for assertion checking code.

    Duncan, let me know if you want me to pursue any more unittesting (and any pointers on how to do that would be great) before commit.
tejohnson updated this revision to Diff 36058.Sep 29 2015, 6:25 PM
  • Add unittests.
dexonsmith edited edge metadata.Sep 29 2015, 8:47 PM
dexonsmith added a subscriber: dexonsmith.

LGTM.

This revision was automatically updated to reflect the committed changes.