Allow IRInterpreter to deal with non-power-of-2 sized types to support some bitfield...
authorFrederic Riss <friss@apple.com>
Tue, 28 Aug 2018 22:50:01 +0000 (22:50 +0000)
committerFrederic Riss <friss@apple.com>
Tue, 28 Aug 2018 22:50:01 +0000 (22:50 +0000)
commitae6ca2fc3f5d043eab69e9f3122d7775d6354f98
treec95dbd007ea9156290357a193735d735d1bbff5f
parenta65bf65e0bb4f2c119bb388e7f036e664d108669
Allow IRInterpreter to deal with non-power-of-2 sized types to support some bitfield accesses.

Summary:
For some bitfield patterns (like the one added by this commit), Clang will
generate non-regular data types like i24 or i48. This patch follows a
pretty naive approach of just bumping the type size to the next power of 2.
DataExtractor know how to deal with weird sizes. The operations on Scalar
do not know how to deal with those types though, so we have to legalize the
size when creating a Scalar.

Reviewers: jingham, clayborg

Subscribers: lldb-commits

Differential Revision: https://reviews.llvm.org/D51245

llvm-svn: 340880
lldb/packages/Python/lldbsuite/test/lang/c/bitfields/TestBitfields.py
lldb/packages/Python/lldbsuite/test/lang/c/bitfields/main.c
lldb/source/Expression/IRInterpreter.cpp