[PATCH] D82881: [DEBUGINFO]Fix debug info for packed bitfields.

John Reagan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 8 08:51:37 PDT 2020


JohnReagan added a comment.

Yes, my BLISS language allows structures to have "negative" offsets.  You end up passing around a pointer to the "middle" and have some fields in either direction (often private in one direction, public the other).   It is also used as crude form of polymorphism back in the day before the word existed.

And my BLISS/Pascal let you provide explicit field offsets which then end up with alignment holes scattered around.  Along with alignment attributes on fields as well as on the overall structure itself.

For Pascal's PACKED RECORDs, subrange values get packed into a small set of bit positions and, unlike C, their alignment isn't derived from the underlying base type.

PACKED RECORD

  F1 : 1..10;
  F2 : 'A'..'L';
  F3 : (RED, WHITE, BLUE);

END;

Ends up with a size of 2 bytes for the overall type (and any variables of that type), F1 <https://reviews.llvm.org/F1> is 4 bits big at offset 0 bits from the start, F2 <https://reviews.llvm.org/F2> is 7 bits big at offset 4 bits from the start, F3 <https://reviews.llvm.org/F3> is 2 bits big at offset 11 bits from the start.  Of course, removing PACKED ends up with a much more pleasant layout but I have a legacy PACKED that started back in the VAX days when bytes were precious and I need to describe it.  (The first VAX shipped with a base of 256Kbytes [yes 'K'] but most customers splurged for an entire 1MB - the system max'd out at 8MB)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82881/new/

https://reviews.llvm.org/D82881





More information about the llvm-commits mailing list