Refactor location description kind in order to be easier for extensions (needed for D60866).
In addition, cut off some bits from the other class fields.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
lib/CodeGen/AsmPrinter/DwarfExpression.h | ||
---|---|---|
124 ↗ | (On Diff #199785) | Perhaps I'm forgetting about a use-case here, but shouldn't memory and register be mutually exclusive? If so, should they share the same bit? |
lib/CodeGen/AsmPrinter/DwarfExpression.h | ||
---|---|---|
124 ↗ | (On Diff #199785) | Yes, thanks! We will need additional flags in order to mark parameter and entry value expressions (e.g. at the same time an expression will be entry value and register). |
lib/CodeGen/AsmPrinter/DwarfExpression.h | ||
---|---|---|
137 ↗ | (On Diff #200020) | We can let the compiler do this for us by defining: unsigned LocationKind : 3; unsigned LocationFlags: ... and initializing it to zero in the constructor. If we are worried about memory use here, I'd also cut off some bits from DwarfVersion. |
lib/CodeGen/AsmPrinter/DwarfExpression.h | ||
---|---|---|
137 ↗ | (On Diff #200020) | Good idea, thanks! |
-Introduce the LokcationKind and the LokcationFlags
-Cut off bits from the DwarfVersion
lib/CodeGen/AsmPrinter/DwarfExpression.h | ||
---|---|---|
114 ↗ | (On Diff #200263) | I don't think this has any effect on x86 for example, since SubRegisterSizeInBits will be padded to 32 bits. Perhaps it is a non-intrusive change to move DwarfVersion down to the other bit-fields? |
lib/CodeGen/AsmPrinter/DwarfExpression.h | ||
---|---|---|
114 ↗ | (On Diff #200263) | I see.. I didn't think about the alignment. |
lib/CodeGen/AsmPrinter/DwarfExpression.h | ||
---|---|---|
114 ↗ | (On Diff #200263) | I think what @dstenb meant was to make this into: uint64_t OffsetInBits = 0; unsigned SubRegisterOffsetInBits = 0; /// The kind of location description being produced. enum { Unknown = 0, Register, Memory, Implicit }; unsigned LocationKind : 3; unsigned LocationFlags : 2; unsigned DwarfVersion : 4; this way the packed bitfields all share one 32-bit slot. |
lib/CodeGen/AsmPrinter/DwarfExpression.h | ||
---|---|---|
118 ↗ | (On Diff #200273) | and these could be unsigned : 16. |
lib/CodeGen/AsmPrinter/DwarfExpression.h | ||
---|---|---|
114 ↗ | (On Diff #200263) | Sure. I understood the idea, but I didn’t want to move (and refactor) those other fields in this commit, but refactoring it this way makes sense to me. :) I will do that way. |
Thanks! One more nit inside, otherwise good to go.
lib/CodeGen/AsmPrinter/DwarfExpression.h | ||
---|---|---|
146 ↗ | (On Diff #200409) | assert(SizeInBits < 65536 && OffsetInBits < 65536); |