forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 351
🍒 [lldb][TypeSystem] Better support for _BitInt types #11747
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
@swift-ci test |
1 similar comment
|
@swift-ci test |
8e16b6f to
d27718a
Compare
|
@swift-ci test |
d27718a to
8e16b6f
Compare
llvm#165702) There were a couple of quirks with this parameter: 1. It wasn't being set consistently. E.g., vector types would be of count `1` but complex types would be `2`. Hence, it wasn't clear what count was referring to. 2. `count` was not being set if the input type was invalid, possibly leaving the input reference uninitialized. 3. Only one callsite actually made use of `count`, and that in itself seems like it could be improved (added a FIXME). If we ever need a "how many elements does this type represent", we can implement one with a new `TypeSystem` API that does exactly that. (cherry picked from commit a6eac9e)
…Int types (llvm#164372) DW_TAG_base_type DIEs are permitted to have both byte_size and bit_size attributes "If the value of an object of the given type does not fully occupy the storage described by a byte size attribute" * Add DataSizeInBits to DIBasicType (`DIBasicType(... dataSize: n ...)` in IR). * Change Clang to add DataSizeInBits to _BitInt type metadata. * Change LLVM to add DW_AT_bit_size to base_type DIEs that have non-zero DataSizeInBits. TODO: Do we need to emit DW_AT_data_bit_offset for big endian targets? See discussion on the PR. Fixes [llvm#61952](llvm#61952) --------- Co-authored-by: David Stenberg <[email protected]> (cherry picked from commit aa5fe56)
Follow on from llvm#164372 This changes the DW_AT_name for `_BitInt(N)` from `_BitInt` to `_BitInt(N)` (cherry picked from commit 30579c0)
One (DWARF-spec compliant) exmample is: llvm#164372, where we attach a `DW_AT_bit_size` to `_BitInt` types that can't be exactly described by a byte-size. This patch adds support for `DW_AT_bit_size` to `DWARFASTParserClang` when parsing type tags. Note, we don't use this bit-size yet, but will do so in follow-up patches. (cherry picked from commit 9ed8896)
Depends on: * llvm#165686 This patch ensures we make use of the `DW_AT_bit_size` on `DW_TAG_base_type`s (which since llvm#164372 can exist on `_BitInt`s) and adjusts `TypeSystemClang` to recognize `_BitInt`. For DWARF from older versions of Clang that didn't emit a `DW_AT_bit_size`, we would create `_BitInt`s using the byte-size. Not sure we can do much better than that. But the situation beforehand wasn't much better. Before: ``` (lldb) v (char) a = '\x01' (unsigned char) b = '\x01' (long) c = 2 (unsigned long) d = 2 ``` After: ``` (lldb) v (_BitInt(2)) a = 1 (unsigned _BitInt(2)) b = 1 (_BitInt(52)) c = 2 (unsigned _BitInt(52)) d = 2 ``` Fixes llvm#110273 (cherry picked from commit deb54ba)
The count parameter was removed in llvm#165702
8e16b6f to
2823e28
Compare
|
@swift-ci test |
|
@swift-ci test llvm |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This patch ensures we make use of the
DW_AT_bit_sizeonDW_TAG_base_types and adjustsTypeSystemClangto recognize_BitInt.For DWARF from older versions of Clang that didn't emit a
DW_AT_bit_size, we would create_BitInts using the byte-size. Notsure we can do much better than that. But the situation beforehand
wasn't much better.
Before:
After:
(cherry picked from commit deb54ba)