[PATCH] D62091: [CommandLine] Reduce size of Option class by moving more members into bit field

Chris Bieneman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat May 18 10:58:05 PDT 2019


beanz added a comment.

The main thing is to make sure that if you have proper integer sized members they are properly aligned and packed, which this seems to do well.



================
Comment at: llvm/include/llvm/Support/CommandLine.h:278
+  uint16_t Misc : 5;
+  uint16_t FullyInitialized : 1; // Has addArgument been called?
+  uint16_t Position;             // Position of last occurrence of the option
----------------
If I'm counting right (and math isn't my strong point) we are at 15 bits used in the bitfield. I would add another 1-bit field named "Unused" just to mark out that we have one more bit before the bitfield would grow.

If the bitfield grows, it will result in 7-bytes of padding coming back in, which would be unfortunate.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62091





More information about the llvm-commits mailing list