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
Event Timeline
lib/CodeGen/AsmPrinter/DwarfExpression.h | ||
---|---|---|
125 | 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 | ||
---|---|---|
125 | 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 | ||
---|---|---|
138 | 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 | ||
---|---|---|
138 | Good idea, thanks! |
-Introduce the LokcationKind and the LokcationFlags
-Cut off bits from the DwarfVersion
lib/CodeGen/AsmPrinter/DwarfExpression.h | ||
---|---|---|
114 | 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 | I see.. I didn't think about the alignment. |
lib/CodeGen/AsmPrinter/DwarfExpression.h | ||
---|---|---|
114 | 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 | and these could be unsigned : 16. |
lib/CodeGen/AsmPrinter/DwarfExpression.h | ||
---|---|---|
114 | 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 | assert(SizeInBits < 65536 && OffsetInBits < 65536); |
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?